pict-section-flow 0.0.1 → 0.0.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.
- package/docs/README.md +19 -0
- package/{example_application → example_applications/simple_cards}/html/index.html +2 -2
- package/example_applications/simple_cards/package.json +43 -0
- package/example_applications/simple_cards/source/Pict-Application-FlowExample.js +434 -0
- package/example_applications/simple_cards/source/cards/FlowCard-Each.js +36 -0
- package/example_applications/simple_cards/source/cards/FlowCard-FileRead.js +54 -0
- package/example_applications/simple_cards/source/cards/FlowCard-FileWrite.js +48 -0
- package/example_applications/simple_cards/source/cards/FlowCard-GetValue.js +35 -0
- package/example_applications/simple_cards/source/cards/FlowCard-IfThenElse.js +47 -0
- package/example_applications/simple_cards/source/cards/FlowCard-LogValues.js +53 -0
- package/example_applications/simple_cards/source/cards/FlowCard-SetValue.js +95 -0
- package/example_applications/simple_cards/source/cards/FlowCard-Switch.js +37 -0
- package/example_applications/simple_cards/source/views/PictView-FlowExample-FileWriteInfo.js +59 -0
- package/{example_application → example_applications/simple_cards}/source/views/PictView-FlowExample-Layout.js +5 -1
- package/example_applications/simple_cards/source/views/PictView-FlowExample-MainWorkspace.js +312 -0
- package/package.json +6 -6
- package/source/Pict-Section-Flow.js +19 -0
- package/source/PictFlowCard.js +207 -0
- package/source/PictFlowCardPropertiesPanel.js +105 -0
- package/source/panels/FlowCardPropertiesPanel-Form.js +174 -0
- package/source/panels/FlowCardPropertiesPanel-Markdown.js +148 -0
- package/source/panels/FlowCardPropertiesPanel-Template.js +88 -0
- package/source/panels/FlowCardPropertiesPanel-View.js +114 -0
- package/source/providers/PictProvider-Flow-EventHandler.js +19 -8
- package/source/providers/PictProvider-Flow-Geometry.js +64 -0
- package/source/providers/PictProvider-Flow-Layouts.js +284 -0
- package/source/providers/PictProvider-Flow-NodeTypes.js +70 -0
- package/source/providers/PictProvider-Flow-PanelChrome.js +72 -0
- package/source/providers/PictProvider-Flow-SVGHelpers.js +30 -0
- package/source/services/PictService-Flow-ConnectionRenderer.js +324 -66
- package/source/services/PictService-Flow-InteractionManager.js +399 -75
- package/source/services/PictService-Flow-Layout.js +159 -0
- package/source/services/PictService-Flow-PathGenerator.js +199 -0
- package/source/services/PictService-Flow-Tether.js +544 -0
- package/source/views/PictView-Flow-Node.js +95 -18
- package/source/views/PictView-Flow-PropertiesPanel.js +435 -0
- package/source/views/PictView-Flow-Toolbar.js +491 -5
- package/source/views/PictView-Flow.js +830 -8
- package/example_application/package.json +0 -41
- package/example_application/source/Pict-Application-FlowExample.js +0 -241
- package/example_application/source/views/PictView-FlowExample-MainWorkspace.js +0 -191
- /package/{example_application → example_applications/simple_cards}/css/flowexample.css +0 -0
- /package/{example_application → example_applications/simple_cards}/source/Pict-Application-FlowExample-Configuration.json +0 -0
- /package/{example_application → example_applications/simple_cards}/source/providers/PictRouter-FlowExample-Configuration.json +0 -0
- /package/{example_application → example_applications/simple_cards}/source/views/PictView-FlowExample-About.js +0 -0
- /package/{example_application → example_applications/simple_cards}/source/views/PictView-FlowExample-BottomBar.js +0 -0
- /package/{example_application → example_applications/simple_cards}/source/views/PictView-FlowExample-Documentation.js +0 -0
- /package/{example_application → example_applications/simple_cards}/source/views/PictView-FlowExample-TopBar.js +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
|
|
3
|
+
class FlowCardIfThenElse extends libPictFlowCard
|
|
4
|
+
{
|
|
5
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
6
|
+
{
|
|
7
|
+
super(pFable, Object.assign(
|
|
8
|
+
{},
|
|
9
|
+
{
|
|
10
|
+
Title: 'If-Then-Else',
|
|
11
|
+
Name: 'Conditional Branch',
|
|
12
|
+
Code: 'ITE',
|
|
13
|
+
Description: 'Evaluates a condition and routes to the Then or Else branch.',
|
|
14
|
+
Icon: '\u2753',
|
|
15
|
+
Tooltip: 'If-Then-Else: Routes flow based on a boolean condition',
|
|
16
|
+
Category: 'Control Flow',
|
|
17
|
+
TitleBarColor: '#e67e22',
|
|
18
|
+
BodyStyle: { fill: '#fef5e7', stroke: '#e67e22' },
|
|
19
|
+
Width: 200,
|
|
20
|
+
Height: 100,
|
|
21
|
+
Inputs:
|
|
22
|
+
[
|
|
23
|
+
{ Name: 'In', Side: 'left', MinimumInputCount: 1, MaximumInputCount: 1 }
|
|
24
|
+
],
|
|
25
|
+
Outputs:
|
|
26
|
+
[
|
|
27
|
+
{ Name: 'Then', Side: 'right' },
|
|
28
|
+
{ Name: 'Else', Side: 'bottom' }
|
|
29
|
+
],
|
|
30
|
+
PropertiesPanel:
|
|
31
|
+
{
|
|
32
|
+
PanelType: 'Markdown',
|
|
33
|
+
DefaultWidth: 300,
|
|
34
|
+
DefaultHeight: 200,
|
|
35
|
+
Title: 'If-Then-Else Info',
|
|
36
|
+
Configuration:
|
|
37
|
+
{
|
|
38
|
+
Markdown: '## Conditional Branch\n\nEvaluates a **boolean condition** and routes the flow:\n\n- **Then** output: condition is *true*\n- **Else** output: condition is *false*\n\nSet the condition expression in the node data.'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
pOptions),
|
|
43
|
+
pServiceHash);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = FlowCardIfThenElse;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
|
|
3
|
+
class FlowCardLogValues extends libPictFlowCard
|
|
4
|
+
{
|
|
5
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
6
|
+
{
|
|
7
|
+
super(pFable, Object.assign(
|
|
8
|
+
{},
|
|
9
|
+
{
|
|
10
|
+
Title: 'Log Values',
|
|
11
|
+
Name: 'Log to Console',
|
|
12
|
+
Code: 'LOG',
|
|
13
|
+
Description: 'Logs input values to the console or log output.',
|
|
14
|
+
Icon: '\uD83D\uDCDD',
|
|
15
|
+
Tooltip: 'Log Values: Output values to the log',
|
|
16
|
+
Category: 'Debug',
|
|
17
|
+
TitleBarColor: '#7f8c8d',
|
|
18
|
+
BodyStyle: { fill: '#f2f3f4', stroke: '#7f8c8d' },
|
|
19
|
+
Width: 160,
|
|
20
|
+
Height: 80,
|
|
21
|
+
Inputs:
|
|
22
|
+
[
|
|
23
|
+
{ Name: 'Values', Side: 'left', MinimumInputCount: 1, MaximumInputCount: -1 }
|
|
24
|
+
],
|
|
25
|
+
Outputs:
|
|
26
|
+
[
|
|
27
|
+
{ Name: 'Pass', Side: 'right' }
|
|
28
|
+
],
|
|
29
|
+
PropertiesPanel:
|
|
30
|
+
{
|
|
31
|
+
PanelType: 'Template',
|
|
32
|
+
DefaultWidth: 260,
|
|
33
|
+
DefaultHeight: 140,
|
|
34
|
+
Title: 'Log Settings',
|
|
35
|
+
Configuration:
|
|
36
|
+
{
|
|
37
|
+
Templates:
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
Hash: 'flow-card-log-panel',
|
|
41
|
+
Template: '<div style="padding:4px"><label style="font-size:11px;color:#7f8c8d">Log Level</label><div style="font-size:12px;padding:4px 0">{~D:Record.Data.LogLevel~}</div><label style="font-size:11px;color:#7f8c8d">Format</label><div style="font-size:12px;padding:4px 0">{~D:Record.Data.Format~}</div></div>'
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
TemplateHash: 'flow-card-log-panel'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
pOptions),
|
|
49
|
+
pServiceHash);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = FlowCardLogValues;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
|
|
3
|
+
class FlowCardSetValue extends libPictFlowCard
|
|
4
|
+
{
|
|
5
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
6
|
+
{
|
|
7
|
+
super(pFable, Object.assign(
|
|
8
|
+
{},
|
|
9
|
+
{
|
|
10
|
+
Title: 'Set Value',
|
|
11
|
+
Name: 'Assign Value',
|
|
12
|
+
Code: 'SET',
|
|
13
|
+
Description: 'Sets a named value in the flow context.',
|
|
14
|
+
Icon: '\u270F\uFE0F',
|
|
15
|
+
Tooltip: 'Set Value: Assign a value in the context',
|
|
16
|
+
Category: 'Data',
|
|
17
|
+
TitleBarColor: '#16a085',
|
|
18
|
+
BodyStyle: { fill: '#e8f8f5', stroke: '#16a085' },
|
|
19
|
+
Width: 170,
|
|
20
|
+
Height: 80,
|
|
21
|
+
Inputs:
|
|
22
|
+
[
|
|
23
|
+
{ Name: 'In', Side: 'left', MinimumInputCount: 1, MaximumInputCount: 1 }
|
|
24
|
+
],
|
|
25
|
+
Outputs:
|
|
26
|
+
[
|
|
27
|
+
{ Name: 'Out', Side: 'right' }
|
|
28
|
+
],
|
|
29
|
+
PropertiesPanel:
|
|
30
|
+
{
|
|
31
|
+
PanelType: 'Form',
|
|
32
|
+
DefaultWidth: 320,
|
|
33
|
+
DefaultHeight: 200,
|
|
34
|
+
Title: 'Set Value Properties',
|
|
35
|
+
Configuration:
|
|
36
|
+
{
|
|
37
|
+
Manifest:
|
|
38
|
+
{
|
|
39
|
+
Scope: 'FlowCardSetValue',
|
|
40
|
+
Sections:
|
|
41
|
+
[
|
|
42
|
+
{
|
|
43
|
+
Name: 'Value Assignment',
|
|
44
|
+
Hash: 'SetValueSection',
|
|
45
|
+
Groups:
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
Name: 'Settings',
|
|
49
|
+
Hash: 'SetValueGroup'
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
Descriptors:
|
|
55
|
+
{
|
|
56
|
+
'Record.Data.VariableName':
|
|
57
|
+
{
|
|
58
|
+
Name: 'Variable Name',
|
|
59
|
+
Hash: 'VariableName',
|
|
60
|
+
DataType: 'String',
|
|
61
|
+
Default: '',
|
|
62
|
+
PictForm:
|
|
63
|
+
{
|
|
64
|
+
Section: 'SetValueSection',
|
|
65
|
+
Group: 'SetValueGroup',
|
|
66
|
+
Row: 1,
|
|
67
|
+
Width: 12
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
'Record.Data.Expression':
|
|
71
|
+
{
|
|
72
|
+
Name: 'Value Expression',
|
|
73
|
+
Hash: 'Expression',
|
|
74
|
+
DataType: 'String',
|
|
75
|
+
Default: '',
|
|
76
|
+
PictForm:
|
|
77
|
+
{
|
|
78
|
+
Section: 'SetValueSection',
|
|
79
|
+
Group: 'SetValueGroup',
|
|
80
|
+
Row: 2,
|
|
81
|
+
Width: 12,
|
|
82
|
+
InputType: 'TextArea'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
pOptions),
|
|
91
|
+
pServiceHash);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = FlowCardSetValue;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
|
|
3
|
+
class FlowCardSwitch extends libPictFlowCard
|
|
4
|
+
{
|
|
5
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
6
|
+
{
|
|
7
|
+
super(pFable, Object.assign(
|
|
8
|
+
{},
|
|
9
|
+
{
|
|
10
|
+
Title: 'Switch',
|
|
11
|
+
Name: 'Multi-way Branch',
|
|
12
|
+
Code: 'SW',
|
|
13
|
+
Description: 'Routes flow to one of multiple cases based on a value.',
|
|
14
|
+
Icon: '\uD83D\uDD00',
|
|
15
|
+
Tooltip: 'Switch: Multi-way branch on a value',
|
|
16
|
+
Category: 'Control Flow',
|
|
17
|
+
TitleBarColor: '#d35400',
|
|
18
|
+
BodyStyle: { fill: '#fbeee6', stroke: '#d35400' },
|
|
19
|
+
Width: 200,
|
|
20
|
+
Height: 120,
|
|
21
|
+
Inputs:
|
|
22
|
+
[
|
|
23
|
+
{ Name: 'In', Side: 'left', MinimumInputCount: 1, MaximumInputCount: 1 }
|
|
24
|
+
],
|
|
25
|
+
Outputs:
|
|
26
|
+
[
|
|
27
|
+
{ Name: 'Case A', Side: 'right' },
|
|
28
|
+
{ Name: 'Case B', Side: 'right' },
|
|
29
|
+
{ Name: 'Default', Side: 'bottom' }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
pOptions),
|
|
33
|
+
pServiceHash);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = FlowCardSwitch;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
|
|
3
|
+
const _ViewConfiguration =
|
|
4
|
+
{
|
|
5
|
+
ViewIdentifier: "FlowExample-FileWriteInfo",
|
|
6
|
+
|
|
7
|
+
DefaultRenderable: "FileWriteInfo-Content",
|
|
8
|
+
DefaultDestinationAddress: "#FileWriteInfo-Container",
|
|
9
|
+
|
|
10
|
+
AutoRender: false,
|
|
11
|
+
|
|
12
|
+
Templates:
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
Hash: "FileWriteInfo-Template",
|
|
16
|
+
Template: /*html*/`
|
|
17
|
+
<div style="padding:6px;font-size:12px;line-height:1.6;color:#2c3e50">
|
|
18
|
+
<div style="margin-bottom:8px">
|
|
19
|
+
<label style="font-weight:600;font-size:11px;color:#7f8c8d;text-transform:uppercase;letter-spacing:0.5px">Output Path</label>
|
|
20
|
+
<div style="padding:4px 6px;background:#f8f9fa;border:1px solid #e0e0e0;border-radius:3px;margin-top:2px;font-family:monospace;font-size:11px">{~D:Record.Data.OutputPath~}</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div style="margin-bottom:8px">
|
|
23
|
+
<label style="font-weight:600;font-size:11px;color:#7f8c8d;text-transform:uppercase;letter-spacing:0.5px">Write Mode</label>
|
|
24
|
+
<div style="padding:4px 6px;background:#f8f9fa;border:1px solid #e0e0e0;border-radius:3px;margin-top:2px">{~D:Record.Data.WriteMode~}</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div style="margin-bottom:8px">
|
|
27
|
+
<label style="font-weight:600;font-size:11px;color:#7f8c8d;text-transform:uppercase;letter-spacing:0.5px">Encoding</label>
|
|
28
|
+
<div style="padding:4px 6px;background:#f8f9fa;border:1px solid #e0e0e0;border-radius:3px;margin-top:2px">{~D:Record.Data.Encoding~}</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div style="padding:6px;background:#eafaf1;border:1px solid #27ae60;border-radius:3px;font-size:11px;color:#27ae60">
|
|
31
|
+
This panel is rendered by a registered pict-view (View panel type).
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
`
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
Renderables:
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
RenderableHash: "FileWriteInfo-Content",
|
|
42
|
+
TemplateHash: "FileWriteInfo-Template",
|
|
43
|
+
DestinationAddress: "#FileWriteInfo-Container",
|
|
44
|
+
RenderMethod: "replace"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class FlowExampleFileWriteInfoView extends libPictView
|
|
50
|
+
{
|
|
51
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
52
|
+
{
|
|
53
|
+
super(pFable, pOptions, pServiceHash);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = FlowExampleFileWriteInfoView;
|
|
58
|
+
|
|
59
|
+
module.exports.default_configuration = _ViewConfiguration;
|
|
@@ -13,13 +13,17 @@ const _ViewConfiguration =
|
|
|
13
13
|
#FlowExample-Application-Container {
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
|
-
|
|
16
|
+
height: 100vh;
|
|
17
|
+
overflow: hidden;
|
|
17
18
|
}
|
|
18
19
|
#FlowExample-TopBar-Container {
|
|
19
20
|
flex-shrink: 0;
|
|
20
21
|
}
|
|
21
22
|
#FlowExample-Content-Container {
|
|
22
23
|
flex: 1;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
min-height: 0;
|
|
23
27
|
}
|
|
24
28
|
#FlowExample-BottomBar-Container {
|
|
25
29
|
flex-shrink: 0;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
const libPictView = require('pict-view');
|
|
2
|
+
const libPictSectionFlow = require('pict-section-flow');
|
|
3
|
+
|
|
4
|
+
// FlowCard definitions
|
|
5
|
+
const libFlowCardIfThenElse = require('../cards/FlowCard-IfThenElse.js');
|
|
6
|
+
const libFlowCardSwitch = require('../cards/FlowCard-Switch.js');
|
|
7
|
+
const libFlowCardEach = require('../cards/FlowCard-Each.js');
|
|
8
|
+
const libFlowCardFileRead = require('../cards/FlowCard-FileRead.js');
|
|
9
|
+
const libFlowCardFileWrite = require('../cards/FlowCard-FileWrite.js');
|
|
10
|
+
const libFlowCardLogValues = require('../cards/FlowCard-LogValues.js');
|
|
11
|
+
const libFlowCardSetValue = require('../cards/FlowCard-SetValue.js');
|
|
12
|
+
const libFlowCardGetValue = require('../cards/FlowCard-GetValue.js');
|
|
13
|
+
|
|
14
|
+
const _ViewConfiguration =
|
|
15
|
+
{
|
|
16
|
+
ViewIdentifier: "FlowExample-MainWorkspace",
|
|
17
|
+
|
|
18
|
+
DefaultRenderable: "FlowExample-MainWorkspace-Content",
|
|
19
|
+
DefaultDestinationAddress: "#FlowExample-Content-Container",
|
|
20
|
+
|
|
21
|
+
AutoRender: false,
|
|
22
|
+
|
|
23
|
+
CSS: /*css*/`
|
|
24
|
+
.flowexample-workspace {
|
|
25
|
+
padding: 0.75em;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
flex: 1;
|
|
29
|
+
min-height: 0;
|
|
30
|
+
}
|
|
31
|
+
.flowexample-workspace-header {
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
margin: 0 0 0.75em 0;
|
|
34
|
+
padding-bottom: 0.75em;
|
|
35
|
+
border-bottom: 1px solid #eee;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
.flowexample-workspace-header h1 {
|
|
41
|
+
margin: 0 0 0.25em 0;
|
|
42
|
+
font-size: 2em;
|
|
43
|
+
font-weight: 300;
|
|
44
|
+
color: #2c3e50;
|
|
45
|
+
}
|
|
46
|
+
.flowexample-workspace-header p {
|
|
47
|
+
margin: 0;
|
|
48
|
+
color: #7f8c8d;
|
|
49
|
+
font-size: 1.1em;
|
|
50
|
+
}
|
|
51
|
+
.flowexample-help-toggle {
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
margin-left: 1em;
|
|
54
|
+
width: 36px;
|
|
55
|
+
height: 36px;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
border: 2px solid #3498db;
|
|
58
|
+
background: #fff;
|
|
59
|
+
color: #3498db;
|
|
60
|
+
font-size: 1.2em;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
transition: background 0.15s, color 0.15s;
|
|
67
|
+
}
|
|
68
|
+
.flowexample-help-toggle:hover {
|
|
69
|
+
background: #3498db;
|
|
70
|
+
color: #fff;
|
|
71
|
+
}
|
|
72
|
+
.flowexample-help-toggle.active {
|
|
73
|
+
background: #3498db;
|
|
74
|
+
color: #fff;
|
|
75
|
+
}
|
|
76
|
+
#FlowExample-Flow-Container {
|
|
77
|
+
flex: 1;
|
|
78
|
+
min-height: 0;
|
|
79
|
+
}
|
|
80
|
+
.flowexample-help-panel {
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
display: none;
|
|
83
|
+
margin-bottom: 0.75em;
|
|
84
|
+
padding: 1.5em;
|
|
85
|
+
background: #f8f9fa;
|
|
86
|
+
border: 1px solid #dee2e6;
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
}
|
|
89
|
+
.flowexample-help-panel.visible {
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
.flowexample-help-panel h3 {
|
|
93
|
+
margin: 0 0 1em 0;
|
|
94
|
+
font-size: 1.1em;
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
color: #2c3e50;
|
|
97
|
+
}
|
|
98
|
+
.flowexample-hints {
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
101
|
+
gap: 1em;
|
|
102
|
+
}
|
|
103
|
+
.flowexample-hint {
|
|
104
|
+
background: #fff;
|
|
105
|
+
border: 1px solid #e0e0e0;
|
|
106
|
+
border-radius: 6px;
|
|
107
|
+
padding: 1em 1.25em;
|
|
108
|
+
}
|
|
109
|
+
.flowexample-hint h4 {
|
|
110
|
+
margin: 0 0 0.35em 0;
|
|
111
|
+
font-size: 0.95em;
|
|
112
|
+
color: #2c3e50;
|
|
113
|
+
}
|
|
114
|
+
.flowexample-hint p {
|
|
115
|
+
margin: 0;
|
|
116
|
+
color: #666;
|
|
117
|
+
font-size: 0.85em;
|
|
118
|
+
line-height: 1.5;
|
|
119
|
+
}
|
|
120
|
+
.flowexample-hint code {
|
|
121
|
+
background: #f4f4f5;
|
|
122
|
+
padding: 0.1em 0.3em;
|
|
123
|
+
border-radius: 3px;
|
|
124
|
+
font-size: 0.9em;
|
|
125
|
+
color: #e74c3c;
|
|
126
|
+
}
|
|
127
|
+
`,
|
|
128
|
+
|
|
129
|
+
Templates:
|
|
130
|
+
[
|
|
131
|
+
{
|
|
132
|
+
Hash: "FlowExample-MainWorkspace-Template",
|
|
133
|
+
Template: /*html*/`
|
|
134
|
+
<div class="flowexample-workspace">
|
|
135
|
+
<div class="flowexample-workspace-header">
|
|
136
|
+
<div>
|
|
137
|
+
<h1>Flow Diagram</h1>
|
|
138
|
+
<p>Build flow diagrams from cards. Open the Card Palette to browse available cards, or select a node type from the dropdown and click + Add Node.</p>
|
|
139
|
+
</div>
|
|
140
|
+
<button class="flowexample-help-toggle" id="FlowExample-HelpToggle" title="Toggle help">?</button>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="flowexample-help-panel" id="FlowExample-HelpPanel">
|
|
143
|
+
<h3>Quick Reference</h3>
|
|
144
|
+
<div class="flowexample-hints">
|
|
145
|
+
<div class="flowexample-hint">
|
|
146
|
+
<h4>Add Nodes</h4>
|
|
147
|
+
<p>Select a node type from the dropdown and click <code>+ Add Node</code> in the toolbar.</p>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="flowexample-hint">
|
|
150
|
+
<h4>Connect Nodes</h4>
|
|
151
|
+
<p>Drag from a green output port to a blue input port to create a connection.</p>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="flowexample-hint">
|
|
154
|
+
<h4>Move Nodes</h4>
|
|
155
|
+
<p>Click and drag any node to reposition it. Connections update automatically.</p>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="flowexample-hint">
|
|
158
|
+
<h4>Pan & Zoom</h4>
|
|
159
|
+
<p>Click and drag the background to pan. Use the mouse wheel to zoom in and out.</p>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="flowexample-hint">
|
|
162
|
+
<h4>Delete</h4>
|
|
163
|
+
<p>Select a node or connection and press <code>Delete</code> or click the Delete button.</p>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="flowexample-hint">
|
|
166
|
+
<h4>Auto Layout</h4>
|
|
167
|
+
<p>Click <code>Auto Layout</code> in the toolbar to automatically arrange nodes left to right.</p>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="flowexample-hint">
|
|
170
|
+
<h4>Properties Panel</h4>
|
|
171
|
+
<p>Double-click a node to open its properties panel (if the card type defines one).</p>
|
|
172
|
+
</div>
|
|
173
|
+
<div class="flowexample-hint">
|
|
174
|
+
<h4>Save Layouts</h4>
|
|
175
|
+
<p>Use the Layouts toolbar to save, restore, and delete named arrangement snapshots.</p>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<div id="FlowExample-Flow-Container"></div>
|
|
180
|
+
</div>
|
|
181
|
+
`
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
|
|
185
|
+
Renderables:
|
|
186
|
+
[
|
|
187
|
+
{
|
|
188
|
+
RenderableHash: "FlowExample-MainWorkspace-Content",
|
|
189
|
+
TemplateHash: "FlowExample-MainWorkspace-Template",
|
|
190
|
+
DestinationAddress: "#FlowExample-Content-Container",
|
|
191
|
+
RenderMethod: "replace"
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
class FlowExampleMainWorkspaceView extends libPictView
|
|
197
|
+
{
|
|
198
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
199
|
+
{
|
|
200
|
+
super(pFable, pOptions, pServiceHash);
|
|
201
|
+
|
|
202
|
+
this._FlowView = null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Build a map of FlowCard node type configurations keyed by hash.
|
|
207
|
+
* These are passed as NodeTypes in the FlowView options so they
|
|
208
|
+
* are available from the moment the NodeTypeProvider is created,
|
|
209
|
+
* before the toolbar renders.
|
|
210
|
+
*/
|
|
211
|
+
_buildFlowCardNodeTypes()
|
|
212
|
+
{
|
|
213
|
+
let tmpCardClasses =
|
|
214
|
+
[
|
|
215
|
+
libFlowCardIfThenElse,
|
|
216
|
+
libFlowCardSwitch,
|
|
217
|
+
libFlowCardEach,
|
|
218
|
+
libFlowCardFileRead,
|
|
219
|
+
libFlowCardFileWrite,
|
|
220
|
+
libFlowCardLogValues,
|
|
221
|
+
libFlowCardSetValue,
|
|
222
|
+
libFlowCardGetValue
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
let tmpNodeTypes = {};
|
|
226
|
+
|
|
227
|
+
for (let i = 0; i < tmpCardClasses.length; i++)
|
|
228
|
+
{
|
|
229
|
+
let tmpCard = new tmpCardClasses[i](this.fable, {}, `FlowCard-${i}`);
|
|
230
|
+
let tmpConfig = tmpCard.getNodeTypeConfiguration();
|
|
231
|
+
tmpNodeTypes[tmpConfig.Hash] = tmpConfig;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return tmpNodeTypes;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent)
|
|
238
|
+
{
|
|
239
|
+
// Create and render the flow section view into its container
|
|
240
|
+
if (!this._FlowView)
|
|
241
|
+
{
|
|
242
|
+
this._FlowView = this.pict.addView('FlowExample-FlowDiagram',
|
|
243
|
+
{
|
|
244
|
+
ViewIdentifier: 'FlowExample-FlowDiagram',
|
|
245
|
+
|
|
246
|
+
DefaultRenderable: 'Flow-Container',
|
|
247
|
+
DefaultDestinationAddress: '#FlowExample-Flow-Container',
|
|
248
|
+
|
|
249
|
+
AutoRender: false,
|
|
250
|
+
|
|
251
|
+
FlowDataAddress: 'AppData.FlowExample.SampleFlow',
|
|
252
|
+
|
|
253
|
+
TargetElementAddress: '#Flow-SVG-Container',
|
|
254
|
+
|
|
255
|
+
EnableToolbar: true,
|
|
256
|
+
EnablePanning: true,
|
|
257
|
+
EnableZooming: true,
|
|
258
|
+
EnableNodeDragging: true,
|
|
259
|
+
EnableConnectionCreation: true,
|
|
260
|
+
EnableGridSnap: false,
|
|
261
|
+
GridSnapSize: 20,
|
|
262
|
+
|
|
263
|
+
MinZoom: 0.1,
|
|
264
|
+
MaxZoom: 5.0,
|
|
265
|
+
ZoomStep: 0.1,
|
|
266
|
+
|
|
267
|
+
DefaultNodeType: 'default',
|
|
268
|
+
DefaultNodeWidth: 180,
|
|
269
|
+
DefaultNodeHeight: 80,
|
|
270
|
+
|
|
271
|
+
// Pre-register FlowCard node types so they are available
|
|
272
|
+
// when the NodeTypeProvider is created, before toolbar renders
|
|
273
|
+
NodeTypes: this._buildFlowCardNodeTypes(),
|
|
274
|
+
|
|
275
|
+
Renderables:
|
|
276
|
+
[
|
|
277
|
+
{
|
|
278
|
+
RenderableHash: 'Flow-Container',
|
|
279
|
+
TemplateHash: 'Flow-Container-Template',
|
|
280
|
+
DestinationAddress: '#FlowExample-Flow-Container',
|
|
281
|
+
RenderMethod: 'replace'
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
libPictSectionFlow
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Reset the flow view's render state so it re-initializes SVG elements
|
|
290
|
+
// when re-rendered (e.g. after navigating away and back)
|
|
291
|
+
this._FlowView.initialRenderComplete = false;
|
|
292
|
+
this._FlowView.render();
|
|
293
|
+
|
|
294
|
+
// Wire up the help toggle button
|
|
295
|
+
let tmpHelpToggle = document.getElementById('FlowExample-HelpToggle');
|
|
296
|
+
let tmpHelpPanel = document.getElementById('FlowExample-HelpPanel');
|
|
297
|
+
if (tmpHelpToggle && tmpHelpPanel)
|
|
298
|
+
{
|
|
299
|
+
tmpHelpToggle.addEventListener('click', function ()
|
|
300
|
+
{
|
|
301
|
+
tmpHelpPanel.classList.toggle('visible');
|
|
302
|
+
tmpHelpToggle.classList.toggle('active');
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return super.onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
module.exports = FlowExampleMainWorkspaceView;
|
|
311
|
+
|
|
312
|
+
module.exports.default_configuration = _ViewConfiguration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Pict Section Flow Diagram",
|
|
5
5
|
"main": "source/Pict-Section-Flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"author": "steven velozo <steven@velozo.com>",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"pict-view": "^1.0.
|
|
15
|
-
"pict-provider": "^1.0.
|
|
16
|
-
"fable-serviceproviderbase": "^3.0.
|
|
14
|
+
"pict-view": "^1.0.67",
|
|
15
|
+
"pict-provider": "^1.0.12",
|
|
16
|
+
"fable-serviceproviderbase": "^3.0.19"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"pict": "^1.0.
|
|
20
|
-
"quackage": "^1.0.
|
|
19
|
+
"pict": "^1.0.354",
|
|
20
|
+
"quackage": "^1.0.58"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -12,8 +12,27 @@ module.exports.PictViewFlowToolbar = require('./views/PictView-Flow-Toolbar.js')
|
|
|
12
12
|
// Services
|
|
13
13
|
module.exports.PictServiceFlowInteractionManager = require('./services/PictService-Flow-InteractionManager.js');
|
|
14
14
|
module.exports.PictServiceFlowConnectionRenderer = require('./services/PictService-Flow-ConnectionRenderer.js');
|
|
15
|
+
module.exports.PictServiceFlowTether = require('./services/PictService-Flow-Tether.js');
|
|
15
16
|
module.exports.PictServiceFlowLayout = require('./services/PictService-Flow-Layout.js');
|
|
17
|
+
module.exports.PictServiceFlowPathGenerator = require('./services/PictService-Flow-PathGenerator.js');
|
|
16
18
|
|
|
17
19
|
// Providers
|
|
18
20
|
module.exports.PictProviderFlowNodeTypes = require('./providers/PictProvider-Flow-NodeTypes.js');
|
|
19
21
|
module.exports.PictProviderFlowEventHandler = require('./providers/PictProvider-Flow-EventHandler.js');
|
|
22
|
+
module.exports.PictProviderFlowLayouts = require('./providers/PictProvider-Flow-Layouts.js');
|
|
23
|
+
module.exports.PictProviderFlowSVGHelpers = require('./providers/PictProvider-Flow-SVGHelpers.js');
|
|
24
|
+
module.exports.PictProviderFlowGeometry = require('./providers/PictProvider-Flow-Geometry.js');
|
|
25
|
+
module.exports.PictProviderFlowPanelChrome = require('./providers/PictProvider-Flow-PanelChrome.js');
|
|
26
|
+
|
|
27
|
+
// FlowCard base class
|
|
28
|
+
module.exports.PictFlowCard = require('./PictFlowCard.js');
|
|
29
|
+
|
|
30
|
+
// FlowCardPropertiesPanel base class and panel types
|
|
31
|
+
module.exports.PictFlowCardPropertiesPanel = require('./PictFlowCardPropertiesPanel.js');
|
|
32
|
+
module.exports.FlowCardPropertiesPanelTemplate = require('./panels/FlowCardPropertiesPanel-Template.js');
|
|
33
|
+
module.exports.FlowCardPropertiesPanelMarkdown = require('./panels/FlowCardPropertiesPanel-Markdown.js');
|
|
34
|
+
module.exports.FlowCardPropertiesPanelForm = require('./panels/FlowCardPropertiesPanel-Form.js');
|
|
35
|
+
module.exports.FlowCardPropertiesPanelView = require('./panels/FlowCardPropertiesPanel-View.js');
|
|
36
|
+
|
|
37
|
+
// Properties panel renderer view
|
|
38
|
+
module.exports.PictViewFlowPropertiesPanel = require('./views/PictView-Flow-PropertiesPanel.js');
|