pict-section-flow 1.4.0 → 2.0.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 (164) hide show
  1. package/package.json +7 -2
  2. package/source/Pict-Section-Flow.js +20 -14
  3. package/source/providers/PictProvider-Flow-Background.js +303 -0
  4. package/source/providers/PictProvider-Flow-CSS.js +73 -7
  5. package/source/providers/PictProvider-Flow-Geometry.js +11 -421
  6. package/source/providers/PictProvider-Flow-Icons.js +12 -0
  7. package/source/providers/PictProvider-Flow-Layouts.js +107 -0
  8. package/source/services/PictService-Flow-ConnectionRenderer.js +1 -1
  9. package/source/services/PictService-Flow-CursorManager.js +113 -0
  10. package/source/services/PictService-Flow-InteractionManager.js +439 -59
  11. package/source/services/PictService-Flow-Layout.js +21 -16
  12. package/source/services/PictService-Flow-PathGenerator.js +30 -417
  13. package/source/services/PictService-Flow-RenderManager.js +9 -1
  14. package/source/services/PictService-Flow-ViewportManager.js +102 -0
  15. package/source/views/PictView-Flow-FloatingToolbar.js +5 -1
  16. package/source/views/PictView-Flow-Node.js +29 -0
  17. package/source/views/PictView-Flow-Toolbar.js +50 -3
  18. package/source/views/PictView-Flow.js +591 -2
  19. package/.claude/launch.json +0 -11
  20. package/docs/.nojekyll +0 -0
  21. package/docs/Architecture.md +0 -163
  22. package/docs/Custom-Styling.md +0 -275
  23. package/docs/Data_Model.md +0 -149
  24. package/docs/Event_System.md +0 -156
  25. package/docs/Getting_Started.md +0 -237
  26. package/docs/Implementation_Reference.md +0 -528
  27. package/docs/Layout_Persistence.md +0 -117
  28. package/docs/README.md +0 -103
  29. package/docs/Theme_Integration.md +0 -150
  30. package/docs/_brand.json +0 -18
  31. package/docs/_cover.md +0 -17
  32. package/docs/_playground.json +0 -24
  33. package/docs/_sidebar.md +0 -57
  34. package/docs/_topbar.md +0 -8
  35. package/docs/_version.json +0 -7
  36. package/docs/api/PictFlowCard.md +0 -216
  37. package/docs/api/PictFlowCardPropertiesPanel.md +0 -235
  38. package/docs/api/addConnection.md +0 -101
  39. package/docs/api/addNode.md +0 -137
  40. package/docs/api/autoLayout.md +0 -77
  41. package/docs/api/getFlowData.md +0 -112
  42. package/docs/api/marshalToView.md +0 -95
  43. package/docs/api/openPanel.md +0 -128
  44. package/docs/api/registerHandler.md +0 -174
  45. package/docs/api/registerNodeType.md +0 -142
  46. package/docs/api/removeConnection.md +0 -57
  47. package/docs/api/removeNode.md +0 -80
  48. package/docs/api/saveLayout.md +0 -152
  49. package/docs/api/screenToSVGCoords.md +0 -68
  50. package/docs/api/selectNode.md +0 -116
  51. package/docs/api/setTheme.md +0 -168
  52. package/docs/api/setZoom.md +0 -97
  53. package/docs/api/toggleFullscreen.md +0 -68
  54. package/docs/card-help/EACH.md +0 -19
  55. package/docs/card-help/FREAD.md +0 -24
  56. package/docs/card-help/FWRITE.md +0 -24
  57. package/docs/card-help/GET.md +0 -22
  58. package/docs/card-help/ITE.md +0 -23
  59. package/docs/card-help/LOG.md +0 -23
  60. package/docs/card-help/NOTE.md +0 -17
  61. package/docs/card-help/PREV.md +0 -18
  62. package/docs/card-help/SET.md +0 -27
  63. package/docs/card-help/SPKL.md +0 -22
  64. package/docs/card-help/STAT.md +0 -23
  65. package/docs/card-help/SW.md +0 -25
  66. package/docs/diagrams/architecture-at-a-glance.excalidraw +0 -4270
  67. package/docs/diagrams/architecture-at-a-glance.mmd +0 -30
  68. package/docs/diagrams/architecture-at-a-glance.svg +0 -2
  69. package/docs/diagrams/data-flow.excalidraw +0 -1451
  70. package/docs/diagrams/data-flow.mmd +0 -17
  71. package/docs/diagrams/data-flow.svg +0 -2
  72. package/docs/diagrams/high-level-design.excalidraw +0 -5767
  73. package/docs/diagrams/high-level-design.mmd +0 -86
  74. package/docs/diagrams/high-level-design.svg +0 -2
  75. package/docs/diagrams/relationships.excalidraw +0 -3852
  76. package/docs/diagrams/relationships.mmd +0 -9
  77. package/docs/diagrams/relationships.svg +0 -2
  78. package/docs/diagrams/service-initialization-sequence.excalidraw +0 -1466
  79. package/docs/diagrams/service-initialization-sequence.mmd +0 -19
  80. package/docs/diagrams/service-initialization-sequence.svg +0 -2
  81. package/docs/diagrams/svg-layer-structure.excalidraw +0 -1060
  82. package/docs/diagrams/svg-layer-structure.mmd +0 -18
  83. package/docs/diagrams/svg-layer-structure.svg +0 -2
  84. package/docs/examples/README.md +0 -9
  85. package/docs/examples/simple_cards/README.md +0 -677
  86. package/docs/examples/simple_cards/css/flowexample.css +0 -65
  87. package/docs/examples/simple_cards/index.html +0 -32
  88. package/docs/examples/simple_cards/js/pict.min.js +0 -12
  89. package/docs/examples/simple_cards/pict-section-flow-example-simple-cards.compatible.min.js +0 -1
  90. package/docs/index.html +0 -38
  91. package/docs/playground/app.json +0 -6
  92. package/docs/playground/appdata.json +0 -85
  93. package/docs/playground/application.js +0 -23
  94. package/docs/playground/pict.json +0 -17
  95. package/docs/playground/runtime/pict-application.min.js +0 -2
  96. package/docs/playground/runtime/pict-section-flow.min.js +0 -2
  97. package/docs/playground/runtime/pict-section-modal.min.js +0 -2
  98. package/docs/playground/runtime/pict.min.js +0 -12
  99. package/docs/retold-catalog.json +0 -244
  100. package/docs/retold-keyword-index.json +0 -26028
  101. package/example_applications/simple_cards/css/flowexample.css +0 -65
  102. package/example_applications/simple_cards/html/index.html +0 -32
  103. package/example_applications/simple_cards/package.json +0 -52
  104. package/example_applications/simple_cards/source/Pict-Application-FlowExample-Configuration.json +0 -15
  105. package/example_applications/simple_cards/source/Pict-Application-FlowExample.js +0 -539
  106. package/example_applications/simple_cards/source/card-help-content.js +0 -16
  107. package/example_applications/simple_cards/source/cards/FlowCard-Comment.js +0 -38
  108. package/example_applications/simple_cards/source/cards/FlowCard-DataPreview.js +0 -44
  109. package/example_applications/simple_cards/source/cards/FlowCard-Each.js +0 -38
  110. package/example_applications/simple_cards/source/cards/FlowCard-FileRead.js +0 -56
  111. package/example_applications/simple_cards/source/cards/FlowCard-FileWrite.js +0 -50
  112. package/example_applications/simple_cards/source/cards/FlowCard-GetValue.js +0 -37
  113. package/example_applications/simple_cards/source/cards/FlowCard-IfThenElse.js +0 -49
  114. package/example_applications/simple_cards/source/cards/FlowCard-LogValues.js +0 -55
  115. package/example_applications/simple_cards/source/cards/FlowCard-SetValue.js +0 -97
  116. package/example_applications/simple_cards/source/cards/FlowCard-Sparkline.js +0 -100
  117. package/example_applications/simple_cards/source/cards/FlowCard-StatusMonitor.js +0 -46
  118. package/example_applications/simple_cards/source/cards/FlowCard-Switch.js +0 -39
  119. package/example_applications/simple_cards/source/providers/PictRouter-FlowExample-Configuration.json +0 -22
  120. package/example_applications/simple_cards/source/sample-flows.js +0 -410
  121. package/example_applications/simple_cards/source/views/PictView-FlowExample-About.js +0 -184
  122. package/example_applications/simple_cards/source/views/PictView-FlowExample-BottomBar.js +0 -77
  123. package/example_applications/simple_cards/source/views/PictView-FlowExample-Documentation.js +0 -325
  124. package/example_applications/simple_cards/source/views/PictView-FlowExample-FileWriteInfo.js +0 -59
  125. package/example_applications/simple_cards/source/views/PictView-FlowExample-Layout.js +0 -90
  126. package/example_applications/simple_cards/source/views/PictView-FlowExample-MainWorkspace.js +0 -453
  127. package/example_applications/simple_cards/source/views/PictView-FlowExample-TopBar.js +0 -95
  128. package/scripts/generate-card-help.js +0 -214
  129. package/source/providers/edges/Edge-Bezier.js +0 -41
  130. package/source/providers/edges/Edge-Orthogonal.js +0 -37
  131. package/source/providers/edges/Edge-OrthogonalSnap.js +0 -72
  132. package/source/providers/edges/Edge-Perimeter-Linear.js +0 -31
  133. package/source/providers/edges/Edge-Perimeter-Orthogonal.js +0 -39
  134. package/source/providers/edges/Edge-Perimeter.js +0 -48
  135. package/source/providers/edges/Edge-PerimeterMath.js +0 -92
  136. package/source/providers/edges/Edge-Straight.js +0 -24
  137. package/source/providers/layouts/Layout-Circular.js +0 -203
  138. package/source/providers/layouts/Layout-Coerce.js +0 -40
  139. package/source/providers/layouts/Layout-Columnar.js +0 -134
  140. package/source/providers/layouts/Layout-Custom.js +0 -27
  141. package/source/providers/layouts/Layout-ForcedFromCenter.js +0 -256
  142. package/source/providers/layouts/Layout-Grid.js +0 -134
  143. package/source/providers/layouts/Layout-Layered.js +0 -155
  144. package/source/providers/layouts/Layout-Rank.js +0 -141
  145. package/source/providers/layouts/Layout-Staggered.js +0 -131
  146. package/source/providers/layouts/Layout-Tabular.js +0 -94
  147. package/test/CardPalette_tests.js +0 -43
  148. package/test/ConnectionHandleManager_tests.js +0 -717
  149. package/test/ConnectionRenderer_tests.js +0 -591
  150. package/test/ConnectionStyle_tests.js +0 -90
  151. package/test/DataManager_tests.js +0 -859
  152. package/test/Geometry_tests.js +0 -767
  153. package/test/InteractionManager_tests.js +0 -279
  154. package/test/Layout_tests.js +0 -1604
  155. package/test/NodeView_tests.js +0 -66
  156. package/test/PanelManager_tests.js +0 -172
  157. package/test/PathGenerator_tests.js +0 -978
  158. package/test/PortRenderer_tests.js +0 -376
  159. package/test/RenderManager_tests.js +0 -756
  160. package/test/Renderer_tests.js +0 -133
  161. package/test/SelectionManager_tests.js +0 -185
  162. package/test/StylePresets_tests.js +0 -153
  163. package/test/ToolbarExtraButtons_tests.js +0 -138
  164. package/test/UndirectedConnections_tests.js +0 -70
@@ -1,156 +0,0 @@
1
- # Event System
2
-
3
- Pict-Section-Flow exposes a rich event system through the `EventHandlerProvider`. Register handlers to react to user interactions, data changes, and lifecycle events without modifying core code.
4
-
5
- ## Registering Handlers
6
-
7
- ```javascript
8
- let tmpFlowView = _Pict.views.MyFlow;
9
-
10
- // Register a named handler
11
- tmpFlowView._EventHandlerProvider.registerHandler(
12
- 'onNodeAdded',
13
- (pNode, pFlowView) =>
14
- {
15
- console.log('Node added:', pNode.Title);
16
- },
17
- 'my-node-handler'
18
- );
19
- ```
20
-
21
- The third parameter is an optional handler hash for later removal. If omitted, a unique hash is generated and returned.
22
-
23
- ## Removing Handlers
24
-
25
- ```javascript
26
- // Remove a specific handler
27
- tmpFlowView._EventHandlerProvider.removeHandler('onNodeAdded', 'my-node-handler');
28
-
29
- // Remove all handlers for an event
30
- tmpFlowView._EventHandlerProvider.removeAllHandlers('onNodeAdded');
31
-
32
- // Remove all handlers for all events
33
- tmpFlowView._EventHandlerProvider.removeAllHandlers();
34
- ```
35
-
36
- ## Querying Handlers
37
-
38
- ```javascript
39
- // Check if any handlers are registered
40
- tmpFlowView._EventHandlerProvider.hasHandlers('onNodeAdded'); // true or false
41
-
42
- // Count registered handlers
43
- tmpFlowView._EventHandlerProvider.getHandlerCount('onNodeAdded'); // number
44
- ```
45
-
46
- ## Available Events
47
-
48
- ### Node Events
49
-
50
- | Event | Payload | Description |
51
- |-------|---------|-------------|
52
- | `onNodeSelected` | `node` or `null` | A node was selected or deselected |
53
- | `onNodeAdded` | `node` | A new node was created |
54
- | `onNodeRemoved` | `node` | A node was deleted |
55
- | `onNodeMoved` | `node` | A node was dragged to a new position |
56
-
57
- ### Connection Events
58
-
59
- | Event | Payload | Description |
60
- |-------|---------|-------------|
61
- | `onConnectionSelected` | `connection` | A connection was selected |
62
- | `onConnectionCreated` | `connection` | A new connection was created between ports |
63
- | `onConnectionRemoved` | `connection` | A connection was deleted |
64
- | `onConnectionHandleMoved` | `connection` | A bezier or orthogonal handle was dragged |
65
- | `onConnectionModeChanged` | `connection` | A connection toggled between bezier and orthogonal |
66
-
67
- ### Panel Events
68
-
69
- | Event | Payload | Description |
70
- |-------|---------|-------------|
71
- | `onPanelOpened` | `panelData` | A properties panel was opened |
72
- | `onPanelClosed` | `panelData` | A properties panel was closed |
73
- | `onPanelMoved` | `panelData` | A properties panel was dragged |
74
-
75
- ### Tether Events
76
-
77
- | Event | Payload | Description |
78
- |-------|---------|-------------|
79
- | `onTetherSelected` | `panelData` | A tether line was selected |
80
- | `onTetherHandleMoved` | `panelData` | A tether handle was dragged |
81
- | `onTetherModeChanged` | `panelData` | A tether toggled between bezier and orthogonal |
82
-
83
- ### Layout and Meta Events
84
-
85
- | Event | Payload | Description |
86
- |-------|---------|-------------|
87
- | `onLayoutSaved` | `layoutData` | A layout snapshot was saved |
88
- | `onLayoutRestored` | `layoutData` | A saved layout was restored |
89
- | `onLayoutDeleted` | `layoutData` | A saved layout was deleted |
90
- | `onFlowChanged` | `flowData` | Catch-all fired after any data mutation |
91
- | `onThemeChanged` | `themeKey` | The active theme was switched |
92
-
93
- ## Common Patterns
94
-
95
- ### Undo/Redo Stack
96
-
97
- ```javascript
98
- let tmpUndoStack = [];
99
- let tmpRedoStack = [];
100
-
101
- tmpFlowView._EventHandlerProvider.registerHandler(
102
- 'onFlowChanged',
103
- (pFlowData) =>
104
- {
105
- tmpUndoStack.push(JSON.parse(JSON.stringify(pFlowData)));
106
- tmpRedoStack = [];
107
- },
108
- 'undo-tracker'
109
- );
110
-
111
- function undo()
112
- {
113
- if (tmpUndoStack.length < 2) return;
114
- tmpRedoStack.push(tmpUndoStack.pop());
115
- tmpFlowView.setFlowData(tmpUndoStack[tmpUndoStack.length - 1]);
116
- }
117
- ```
118
-
119
- ### Server Sync
120
-
121
- ```javascript
122
- tmpFlowView._EventHandlerProvider.registerHandler(
123
- 'onFlowChanged',
124
- (pFlowData) =>
125
- {
126
- fetch('/api/flows/save',
127
- {
128
- method: 'POST',
129
- headers: { 'Content-Type': 'application/json' },
130
- body: JSON.stringify(pFlowData)
131
- });
132
- },
133
- 'server-sync'
134
- );
135
- ```
136
-
137
- ### Selection Sidebar
138
-
139
- ```javascript
140
- tmpFlowView._EventHandlerProvider.registerHandler(
141
- 'onNodeSelected',
142
- (pNode) =>
143
- {
144
- if (pNode)
145
- {
146
- document.getElementById('sidebar-title').textContent = pNode.Title;
147
- document.getElementById('sidebar-type').textContent = pNode.Type;
148
- }
149
- else
150
- {
151
- document.getElementById('sidebar-title').textContent = 'No selection';
152
- }
153
- },
154
- 'sidebar-updater'
155
- );
156
- ```
@@ -1,237 +0,0 @@
1
- # Getting Started
2
-
3
- This guide walks you through creating a flow diagram from scratch -- installing the package, registering a view, adding nodes and connections, and wiring up custom card types.
4
-
5
- ## Prerequisites
6
-
7
- - Node.js 16+
8
- - A Pict application (or willingness to create one)
9
-
10
- ## Installation
11
-
12
- ```bash
13
- npm install pict-section-flow
14
- ```
15
-
16
- If you are building for the browser, also install the build tool:
17
-
18
- ```bash
19
- npm install --save-dev quackage
20
- ```
21
-
22
- ## Step 1: Create a Pict Application
23
-
24
- If you do not already have a Pict application, create a minimal one:
25
-
26
- ```javascript
27
- const libPict = require('pict');
28
-
29
- let _Pict = new libPict(
30
- {
31
- Product: 'FlowDemo',
32
- ProductVersion: '1.0.0'
33
- });
34
- ```
35
-
36
- ## Step 2: Register the Flow View
37
-
38
- Pict-Section-Flow exports a View class. Register it with your Pict instance:
39
-
40
- ```javascript
41
- const libPictSectionFlow = require('pict-section-flow');
42
-
43
- _Pict.addView('MyFlowDiagram',
44
- {
45
- DefaultDestinationAddress: '#flow-container',
46
- EnableToolbar: true,
47
- EnableGridSnap: true,
48
- GridSnapSize: 20
49
- },
50
- libPictSectionFlow);
51
- ```
52
-
53
- Your HTML needs a target element:
54
-
55
- ```html
56
- <div id="flow-container"></div>
57
- ```
58
-
59
- ## Step 3: Initialize and Render
60
-
61
- ```javascript
62
- // Initialize the application (triggers view initialization)
63
- _Pict.initialize();
64
-
65
- // The flow view is now accessible
66
- let tmpFlowView = _Pict.views.MyFlowDiagram;
67
- ```
68
-
69
- ## Step 4: Add Nodes
70
-
71
- Use the `addNode` method to place nodes on the canvas:
72
-
73
- ```javascript
74
- // addNode(pType, pX, pY, pTitle, pData)
75
- let tmpStart = tmpFlowView.addNode('start', 50, 150, 'Begin');
76
- let tmpProcess = tmpFlowView.addNode('default', 250, 150, 'Process Data');
77
- let tmpEnd = tmpFlowView.addNode('end', 450, 150, 'Done');
78
- ```
79
-
80
- Five built-in node types are available out of the box:
81
-
82
- | Type | Ports | Color | Use Case |
83
- |------|-------|-------|----------|
84
- | `default` | In, Out | Gray | Generic operation |
85
- | `start` | Out | Green | Flow entry point |
86
- | `end` | In | Teal | Flow exit point |
87
- | `halt` | In | Red | Error termination |
88
- | `decision` | In, Yes, No | Orange | Conditional branch |
89
-
90
- ## Step 5: Connect Nodes
91
-
92
- Link two ports by providing node and port hashes:
93
-
94
- ```javascript
95
- // Get the output port of the start node
96
- let tmpSourcePort = tmpStart.Ports.find((pPort) => pPort.Direction === 'output');
97
- // Get the input port of the process node
98
- let tmpTargetPort = tmpProcess.Ports.find((pPort) => pPort.Direction === 'input');
99
-
100
- tmpFlowView.addConnection(
101
- tmpStart.Hash, tmpSourcePort.Hash,
102
- tmpProcess.Hash, tmpTargetPort.Hash
103
- );
104
- ```
105
-
106
- ## Step 6: Define a Custom Card Type
107
-
108
- For domain-specific node types, extend `PictFlowCard`:
109
-
110
- ```javascript
111
- const libPictFlowCard = require('pict-section-flow').PictFlowCard;
112
-
113
- class FileReadCard extends libPictFlowCard
114
- {
115
- constructor(pFable, pOptions, pServiceHash)
116
- {
117
- super(pFable, Object.assign({},
118
- {
119
- Title: 'File Read',
120
- Code: 'FREAD',
121
- Category: 'File I/O',
122
- Description: 'Read contents from a file path',
123
- TitleBarColor: '#2980b9',
124
- Width: 160,
125
- Height: 70,
126
- Inputs:
127
- [
128
- { Name: 'Path', Side: 'left', PortType: 'value' }
129
- ],
130
- Outputs:
131
- [
132
- { Name: 'Data', Side: 'right', PortType: 'value' },
133
- { Name: 'Error', Side: 'bottom', PortType: 'error' }
134
- ],
135
- PropertiesPanel:
136
- {
137
- PanelType: 'Form',
138
- Title: 'File Read Settings',
139
- DefaultWidth: 300,
140
- DefaultHeight: 180,
141
- Configuration:
142
- {
143
- Fields:
144
- [
145
- { Name: 'FilePath', DataType: 'String' },
146
- { Name: 'Encoding', DataType: 'String' }
147
- ]
148
- }
149
- }
150
- }, pOptions), pServiceHash);
151
- }
152
- }
153
- ```
154
-
155
- Register it with the flow view:
156
-
157
- ```javascript
158
- let tmpCard = new FileReadCard(_Pict, {});
159
- tmpCard.registerWithFlowView(tmpFlowView);
160
- ```
161
-
162
- The card now appears in the toolbar palette under the "File I/O" category.
163
-
164
- ## Step 7: Listen for Events
165
-
166
- Hook into the event system to react to user actions:
167
-
168
- ```javascript
169
- tmpFlowView._EventHandlerProvider.registerHandler('onNodeSelected',
170
- (pNode) =>
171
- {
172
- console.log('Selected node:', pNode.Title, pNode.Hash);
173
- });
174
-
175
- tmpFlowView._EventHandlerProvider.registerHandler('onFlowChanged',
176
- (pFlowData) =>
177
- {
178
- // Persist flow state to your backend
179
- fetch('/api/flows/my-flow',
180
- {
181
- method: 'PUT',
182
- headers: { 'Content-Type': 'application/json' },
183
- body: JSON.stringify(pFlowData)
184
- });
185
- });
186
- ```
187
-
188
- ## Step 8: Switch Themes
189
-
190
- Apply a built-in theme or register a custom one:
191
-
192
- ```javascript
193
- // Use a built-in theme
194
- tmpFlowView.setTheme('blueprint');
195
-
196
- // Or register your own
197
- tmpFlowView._ThemeProvider.registerTheme('dark',
198
- {
199
- Key: 'dark',
200
- Label: 'Dark Mode',
201
- CSSVariables:
202
- {
203
- '--pf-canvas-bg': '#1a1a2e',
204
- '--pf-node-body-fill': '#16213e',
205
- '--pf-text-primary': '#e8e8e8',
206
- '--pf-node-selected-stroke': '#e94560'
207
- }
208
- });
209
- tmpFlowView.setTheme('dark');
210
- ```
211
-
212
- ## Step 9: Build for the Browser
213
-
214
- Add a build script to your `package.json`:
215
-
216
- ```json
217
- {
218
- "scripts": {
219
- "build": "npx quack build"
220
- }
221
- }
222
- ```
223
-
224
- Then build:
225
-
226
- ```bash
227
- npm run build
228
- ```
229
-
230
- This produces a browser bundle in `dist/` that includes pict-section-flow and all its dependencies.
231
-
232
- ## Next Steps
233
-
234
- - **[Architecture](Architecture.md)** -- Understand the service/provider design
235
- - **[Implementation Reference](Implementation_Reference.md)** -- Full API for every method
236
- - **[Custom Styling](Custom-Styling.md)** -- CSS variables and theme configuration
237
- - **[Layout Persistence](Layout_Persistence.md)** -- Save layouts to localStorage or a REST API