pict-section-flow 0.0.17 → 0.0.19

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 (90) hide show
  1. package/README.md +18 -18
  2. package/docs/Architecture.md +1 -1
  3. package/docs/Data_Model.md +2 -2
  4. package/docs/Getting_Started.md +5 -5
  5. package/docs/Implementation_Reference.md +6 -6
  6. package/docs/Layout_Persistence.md +3 -3
  7. package/docs/README.md +12 -12
  8. package/docs/Theme_Integration.md +150 -0
  9. package/docs/_cover.md +1 -1
  10. package/docs/_sidebar.md +7 -6
  11. package/docs/_version.json +7 -0
  12. package/docs/api/PictFlowCard.md +6 -6
  13. package/docs/api/PictFlowCardPropertiesPanel.md +2 -2
  14. package/docs/api/addConnection.md +4 -4
  15. package/docs/api/addNode.md +6 -6
  16. package/docs/api/autoLayout.md +2 -2
  17. package/docs/api/getFlowData.md +5 -5
  18. package/docs/api/marshalToView.md +3 -3
  19. package/docs/api/openPanel.md +2 -2
  20. package/docs/api/registerHandler.md +3 -3
  21. package/docs/api/registerNodeType.md +3 -3
  22. package/docs/api/removeConnection.md +5 -5
  23. package/docs/api/removeNode.md +6 -6
  24. package/docs/api/saveLayout.md +2 -2
  25. package/docs/api/screenToSVGCoords.md +2 -2
  26. package/docs/api/selectNode.md +3 -3
  27. package/docs/api/setTheme.md +2 -2
  28. package/docs/api/setZoom.md +3 -3
  29. package/docs/api/toggleFullscreen.md +2 -2
  30. package/docs/card-help/EACH.md +3 -3
  31. package/docs/card-help/FREAD.md +5 -5
  32. package/docs/card-help/FWRITE.md +5 -5
  33. package/docs/card-help/GET.md +2 -2
  34. package/docs/card-help/ITE.md +3 -3
  35. package/docs/card-help/LOG.md +4 -4
  36. package/docs/card-help/NOTE.md +1 -1
  37. package/docs/card-help/PREV.md +2 -2
  38. package/docs/card-help/SET.md +5 -5
  39. package/docs/card-help/SPKL.md +2 -2
  40. package/docs/card-help/STAT.md +3 -3
  41. package/docs/card-help/SW.md +4 -4
  42. package/docs/css/docuserve.css +277 -23
  43. package/docs/index.html +2 -2
  44. package/docs/retold-catalog.json +1 -1
  45. package/docs/retold-keyword-index.json +1 -1
  46. package/example_applications/simple_cards/css/flowexample.css +2 -2
  47. package/example_applications/simple_cards/source/card-help-content.js +12 -12
  48. package/example_applications/simple_cards/source/cards/FlowCard-DataPreview.js +1 -1
  49. package/example_applications/simple_cards/source/sample-flows.js +410 -0
  50. package/example_applications/simple_cards/source/views/PictView-FlowExample-About.js +5 -5
  51. package/example_applications/simple_cards/source/views/PictView-FlowExample-Documentation.js +5 -5
  52. package/example_applications/simple_cards/source/views/PictView-FlowExample-FileWriteInfo.js +4 -4
  53. package/example_applications/simple_cards/source/views/PictView-FlowExample-MainWorkspace.js +141 -8
  54. package/example_applications/simple_cards/source/views/PictView-FlowExample-TopBar.js +2 -2
  55. package/package.json +8 -7
  56. package/source/Pict-Section-Flow.js +26 -0
  57. package/source/providers/PictProvider-Flow-CSS.js +435 -61
  58. package/source/providers/PictProvider-Flow-ConnectorShapes.js +9 -5
  59. package/source/providers/PictProvider-Flow-NodeTypes.js +10 -0
  60. package/source/providers/PictProvider-Flow-PanelChrome.js +7 -17
  61. package/source/providers/PictProvider-Flow-Theme.js +7 -7
  62. package/source/providers/edges/Edge-Bezier.js +41 -0
  63. package/source/providers/edges/Edge-Orthogonal.js +37 -0
  64. package/source/providers/edges/Edge-OrthogonalSnap.js +72 -0
  65. package/source/providers/edges/Edge-Perimeter-Linear.js +31 -0
  66. package/source/providers/edges/Edge-Perimeter-Orthogonal.js +39 -0
  67. package/source/providers/edges/Edge-Perimeter.js +48 -0
  68. package/source/providers/edges/Edge-PerimeterMath.js +92 -0
  69. package/source/providers/edges/Edge-Straight.js +24 -0
  70. package/source/providers/layouts/Layout-Circular.js +203 -0
  71. package/source/providers/layouts/Layout-Coerce.js +40 -0
  72. package/source/providers/layouts/Layout-Columnar.js +134 -0
  73. package/source/providers/layouts/Layout-Custom.js +27 -0
  74. package/source/providers/layouts/Layout-ForcedFromCenter.js +256 -0
  75. package/source/providers/layouts/Layout-Grid.js +134 -0
  76. package/source/providers/layouts/Layout-Layered.js +209 -0
  77. package/source/providers/layouts/Layout-Tabular.js +94 -0
  78. package/source/services/PictService-Flow-ConnectionRenderer.js +532 -28
  79. package/source/services/PictService-Flow-DataManager.js +12 -1
  80. package/source/services/PictService-Flow-InteractionManager.js +39 -42
  81. package/source/services/PictService-Flow-Layout.js +305 -121
  82. package/source/services/PictService-Flow-PortRenderer.js +108 -26
  83. package/source/services/PictService-Flow-RenderManager.js +41 -11
  84. package/source/views/PictView-Flow-FloatingToolbar.js +69 -61
  85. package/source/views/PictView-Flow-Node.js +47 -6
  86. package/source/views/PictView-Flow-PropertiesPanel.js +46 -53
  87. package/source/views/PictView-Flow-Toolbar.js +1065 -485
  88. package/source/views/PictView-Flow.js +455 -7
  89. package/test/Layout_tests.js +1400 -0
  90. package/test/PortRenderer_tests.js +11 -2
@@ -17,17 +17,17 @@ const _ViewConfiguration =
17
17
  <div style="padding:6px;font-size:12px;line-height:1.6;color:#2c3e50">
18
18
  <div style="margin-bottom:8px">
19
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>
20
+ <div style="padding:4px 6px;background:#f8f9fa;border:1px solid var(--theme-color-border-default, #e0e0e0);border-radius:3px;margin-top:2px;font-family:monospace;font-size:11px">{~D:Record.Data.OutputPath~}</div>
21
21
  </div>
22
22
  <div style="margin-bottom:8px">
23
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>
24
+ <div style="padding:4px 6px;background:#f8f9fa;border:1px solid var(--theme-color-border-default, #e0e0e0);border-radius:3px;margin-top:2px">{~D:Record.Data.WriteMode~}</div>
25
25
  </div>
26
26
  <div style="margin-bottom:8px">
27
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>
28
+ <div style="padding:4px 6px;background:#f8f9fa;border:1px solid var(--theme-color-border-default, #e0e0e0);border-radius:3px;margin-top:2px">{~D:Record.Data.Encoding~}</div>
29
29
  </div>
30
- <div style="padding:6px;background:#eafaf1;border:1px solid #27ae60;border-radius:3px;font-size:11px;color:#27ae60">
30
+ <div style="padding:6px;background:#eafaf1;border:1px solid var(--theme-color-status-success, #27ae60);border-radius:3px;font-size:11px;color:var(--theme-color-status-success, #27ae60)">
31
31
  This panel is rendered by a registered pict-view (View panel type).
32
32
  </div>
33
33
  </div>
@@ -1,5 +1,6 @@
1
1
  const libPictView = require('pict-view');
2
2
  const libPictSectionFlow = require('pict-section-flow');
3
+ const libSampleFlows = require('../sample-flows.js');
3
4
 
4
5
  // FlowCard definitions
5
6
  const libFlowCardIfThenElse = require('../cards/FlowCard-IfThenElse.js');
@@ -36,7 +37,7 @@ const _ViewConfiguration =
36
37
  flex-shrink: 0;
37
38
  margin: 0 0 0.75em 0;
38
39
  padding-bottom: 0.75em;
39
- border-bottom: 1px solid #eee;
40
+ border-bottom: 1px solid var(--theme-color-border-light, #eee);
40
41
  display: flex;
41
42
  align-items: flex-start;
42
43
  justify-content: space-between;
@@ -59,7 +60,7 @@ const _ViewConfiguration =
59
60
  height: 36px;
60
61
  border-radius: 50%;
61
62
  border: 2px solid #3498db;
62
- background: #fff;
63
+ background: var(--theme-color-background-panel, #fff);
63
64
  color: #3498db;
64
65
  font-size: 1.2em;
65
66
  font-weight: 700;
@@ -71,16 +72,57 @@ const _ViewConfiguration =
71
72
  }
72
73
  .flowexample-help-toggle:hover {
73
74
  background: #3498db;
74
- color: #fff;
75
+ color: var(--theme-color-background-panel, #fff);
75
76
  }
76
77
  .flowexample-help-toggle.active {
77
78
  background: #3498db;
78
- color: #fff;
79
+ color: var(--theme-color-background-panel, #fff);
79
80
  }
80
81
  #FlowExample-Flow-Container {
81
82
  flex: 1;
82
83
  min-height: 0;
83
84
  }
85
+ .flowexample-sample-bar {
86
+ flex-shrink: 0;
87
+ margin: 0 0 0.75em 0;
88
+ padding: 0.6em 0.75em;
89
+ background: var(--theme-color-background-panel, #fff);
90
+ border: 1px solid var(--theme-color-border-light, #dee2e6);
91
+ border-radius: 6px;
92
+ display: flex;
93
+ align-items: center;
94
+ gap: 0.6em;
95
+ flex-wrap: wrap;
96
+ }
97
+ .flowexample-sample-bar label {
98
+ font-weight: 600;
99
+ color: #2c3e50;
100
+ font-size: 0.9em;
101
+ }
102
+ .flowexample-sample-bar select {
103
+ padding: 0.35em 0.55em;
104
+ border: 1px solid #ced4da;
105
+ border-radius: 4px;
106
+ background: #fff;
107
+ font-size: 0.95em;
108
+ min-width: 220px;
109
+ }
110
+ .flowexample-sample-description {
111
+ flex: 1;
112
+ min-width: 280px;
113
+ color: #5a6470;
114
+ font-size: 0.85em;
115
+ line-height: 1.4;
116
+ }
117
+ .flowexample-sample-recommended {
118
+ padding: 0.2em 0.55em;
119
+ background: #eaf6ee;
120
+ color: #1f7a3f;
121
+ border-radius: 4px;
122
+ font-size: 0.8em;
123
+ font-weight: 600;
124
+ white-space: nowrap;
125
+ }
84
126
  .flowexample-help-panel {
85
127
  flex-shrink: 0;
86
128
  display: none;
@@ -105,8 +147,8 @@ const _ViewConfiguration =
105
147
  gap: 1em;
106
148
  }
107
149
  .flowexample-hint {
108
- background: #fff;
109
- border: 1px solid #e0e0e0;
150
+ background: var(--theme-color-background-panel, #fff);
151
+ border: 1px solid var(--theme-color-border-default, #e0e0e0);
110
152
  border-radius: 6px;
111
153
  padding: 1em 1.25em;
112
154
  }
@@ -117,7 +159,7 @@ const _ViewConfiguration =
117
159
  }
118
160
  .flowexample-hint p {
119
161
  margin: 0;
120
- color: #666;
162
+ color: var(--theme-color-text-secondary, #666);
121
163
  font-size: 0.85em;
122
164
  line-height: 1.5;
123
165
  }
@@ -126,7 +168,7 @@ const _ViewConfiguration =
126
168
  padding: 0.1em 0.3em;
127
169
  border-radius: 3px;
128
170
  font-size: 0.9em;
129
- color: #e74c3c;
171
+ color: var(--theme-color-status-error, #e74c3c);
130
172
  }
131
173
  `,
132
174
 
@@ -180,6 +222,12 @@ const _ViewConfiguration =
180
222
  </div>
181
223
  </div>
182
224
  </div>
225
+ <div class="flowexample-sample-bar">
226
+ <label for="FlowExample-SampleSelect">Sample graph:</label>
227
+ <select id="FlowExample-SampleSelect"></select>
228
+ <span class="flowexample-sample-recommended" id="FlowExample-SampleRecommended"></span>
229
+ <span class="flowexample-sample-description" id="FlowExample-SampleDescription">Pick a sample, then open the <strong>Algorithm</strong> popup in the toolbar to compare layouts.</span>
230
+ </div>
183
231
  <div id="FlowExample-Flow-Container"></div>
184
232
  </div>
185
233
  `
@@ -311,8 +359,93 @@ class FlowExampleMainWorkspaceView extends libPictView
311
359
  });
312
360
  }
313
361
 
362
+ // Populate the sample-graph selector and wire its change handler.
363
+ this._populateSampleSelector();
364
+
314
365
  return super.onAfterRender(pRenderable, pRenderDestinationAddress, pRecord, pContent);
315
366
  }
367
+
368
+ /**
369
+ * Populate the sample-graph dropdown above the flow diagram and wire
370
+ * the change handler. The first option ("Hello World") is the rich
371
+ * default flow that lives in AppData.FlowExample.SampleFlow; the rest
372
+ * come from sample-flows.js and showcase a different layout strength.
373
+ */
374
+ _populateSampleSelector()
375
+ {
376
+ let tmpSelect = document.getElementById('FlowExample-SampleSelect');
377
+ let tmpDesc = document.getElementById('FlowExample-SampleDescription');
378
+ let tmpReco = document.getElementById('FlowExample-SampleRecommended');
379
+ if (!tmpSelect || !tmpDesc || !tmpReco) return;
380
+
381
+ // Clear pre-existing options
382
+ while (tmpSelect.firstChild) tmpSelect.removeChild(tmpSelect.firstChild);
383
+
384
+ let tmpHelloOpt = document.createElement('option');
385
+ tmpHelloOpt.value = '__hello-world__';
386
+ tmpHelloOpt.textContent = 'Hello World — multi-feature reference';
387
+ tmpSelect.appendChild(tmpHelloOpt);
388
+
389
+ let tmpKeys = libSampleFlows.getSampleNames();
390
+ for (let i = 0; i < tmpKeys.length; i++)
391
+ {
392
+ let tmpSample = libSampleFlows.getSample(tmpKeys[i]);
393
+ let tmpOpt = document.createElement('option');
394
+ tmpOpt.value = tmpKeys[i];
395
+ tmpOpt.textContent = tmpSample.Name;
396
+ tmpSelect.appendChild(tmpOpt);
397
+ }
398
+
399
+ // Initial description (Hello World)
400
+ tmpDesc.innerHTML = 'Pick a sample, then open the <strong>Algorithm</strong> popup in the toolbar to compare layouts.';
401
+ tmpReco.style.display = 'none';
402
+
403
+ let tmpView = this;
404
+ tmpSelect.addEventListener('change', function ()
405
+ {
406
+ let tmpKey = tmpSelect.value;
407
+ tmpView._loadSample(tmpKey, tmpDesc, tmpReco);
408
+ });
409
+ }
410
+
411
+ /**
412
+ * Load a sample flow into the FlowView. `__hello-world__` reloads the
413
+ * original AppData-backed flow; everything else comes from sample-flows.
414
+ *
415
+ * @param {string} pKey
416
+ * @param {HTMLElement} pDescEl
417
+ * @param {HTMLElement} pRecoEl
418
+ */
419
+ _loadSample(pKey, pDescEl, pRecoEl)
420
+ {
421
+ if (!this._FlowView) return;
422
+
423
+ if (pKey === '__hello-world__')
424
+ {
425
+ this._FlowView.setFlowData(this.pict.AppData.FlowExample.SampleFlow);
426
+ pDescEl.innerHTML = 'The full reference flow with all card types, properties panels, and an error branch. Originally designed by hand — set <code>LayoutAlgorithm</code> to <em>Layered</em> to see how the auto-layout compares.';
427
+ pRecoEl.style.display = 'none';
428
+ return;
429
+ }
430
+
431
+ let tmpSample = libSampleFlows.getSample(pKey);
432
+ if (!tmpSample) return;
433
+
434
+ // setFlowData expects a fresh _FlowData-shaped object — deep clone so
435
+ // re-loading the same sample doesn't share mutated node references
436
+ // with prior loads.
437
+ this._FlowView.setFlowData(JSON.parse(JSON.stringify(tmpSample.Flow)));
438
+ pDescEl.textContent = tmpSample.Description;
439
+ if (tmpSample.Recommended)
440
+ {
441
+ pRecoEl.style.display = '';
442
+ pRecoEl.textContent = `Try: ${tmpSample.Recommended}`;
443
+ }
444
+ else
445
+ {
446
+ pRecoEl.style.display = 'none';
447
+ }
448
+ }
316
449
  }
317
450
 
318
451
  module.exports = FlowExampleMainWorkspaceView;
@@ -32,7 +32,7 @@ const _ViewConfiguration =
32
32
  cursor: pointer;
33
33
  }
34
34
  .flowexample-topbar-brand:hover {
35
- color: #fff;
35
+ color: var(--theme-color-background-panel, #fff);
36
36
  }
37
37
  .flowexample-topbar-nav {
38
38
  display: flex;
@@ -50,7 +50,7 @@ const _ViewConfiguration =
50
50
  }
51
51
  .flowexample-topbar-nav a:hover {
52
52
  background-color: #34495e;
53
- color: #fff;
53
+ color: var(--theme-color-background-panel, #fff);
54
54
  }
55
55
  `,
56
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-flow",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "Pict Section Flow Diagram",
5
5
  "main": "source/Pict-Section-Flow.js",
6
6
  "scripts": {
@@ -14,15 +14,16 @@
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
16
  "fable-serviceproviderbase": "^3.0.19",
17
- "pict-provider": "^1.0.12",
18
- "pict-section-form": "^1.0.195",
19
- "pict-view": "^1.0.67"
17
+ "pict-provider": "^1.0.13",
18
+ "pict-section-form": "^1.0.196",
19
+ "pict-view": "^1.0.68"
20
20
  },
21
21
  "devDependencies": {
22
22
  "chai": "^6.2.2",
23
23
  "mocha": "^11.7.5",
24
- "pict": "^1.0.359",
25
- "pict-router": "^1.0.9",
26
- "quackage": "^1.0.65"
24
+ "pict": "^1.0.367",
25
+ "pict-docuserve": "^0.1.6",
26
+ "pict-router": "^1.0.10",
27
+ "quackage": "^1.2.3"
27
28
  }
28
29
  }
@@ -35,6 +35,32 @@ module.exports.PictProviderFlowCSS = require('./providers/PictProvider-Flow-CSS.
35
35
  module.exports.PictProviderFlowIcons = require('./providers/PictProvider-Flow-Icons.js');
36
36
  module.exports.PictProviderFlowConnectorShapes = require('./providers/PictProvider-Flow-ConnectorShapes.js');
37
37
 
38
+ // Layout algorithm descriptors (consumers can register custom algorithms via
39
+ // _LayoutService.registerAlgorithm({ Name, Apply, DefaultParameters, ParameterSchema }))
40
+ module.exports.LayoutAlgorithms =
41
+ {
42
+ Custom: require('./providers/layouts/Layout-Custom.js'),
43
+ Layered: require('./providers/layouts/Layout-Layered.js'),
44
+ ForcedFromCenter: require('./providers/layouts/Layout-ForcedFromCenter.js'),
45
+ Grid: require('./providers/layouts/Layout-Grid.js'),
46
+ Circular: require('./providers/layouts/Layout-Circular.js'),
47
+ Tabular: require('./providers/layouts/Layout-Tabular.js'),
48
+ Columnar: require('./providers/layouts/Layout-Columnar.js')
49
+ };
50
+
51
+ // Edge-theme descriptors (consumers can register custom edge themes via
52
+ // _LayoutService.registerEdgeTheme({ Name, GeneratePath, AdjustLayout?, ResolveAttachment?, ... }))
53
+ module.exports.EdgeThemes =
54
+ {
55
+ Bezier: require('./providers/edges/Edge-Bezier.js'),
56
+ Orthogonal: require('./providers/edges/Edge-Orthogonal.js'),
57
+ Straight: require('./providers/edges/Edge-Straight.js'),
58
+ OrthogonalSnap: require('./providers/edges/Edge-OrthogonalSnap.js'),
59
+ Perimeter: require('./providers/edges/Edge-Perimeter.js'),
60
+ PerimeterLinear: require('./providers/edges/Edge-Perimeter-Linear.js'),
61
+ PerimeterOrthogonal: require('./providers/edges/Edge-Perimeter-Orthogonal.js')
62
+ };
63
+
38
64
  // FlowCard base class
39
65
  module.exports.PictFlowCard = require('./PictFlowCard.js');
40
66