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
@@ -74,7 +74,17 @@ const _DefaultConfiguration =
74
74
  },
75
75
  {
76
76
  Hash: 'Flow-NodeProps-Editor',
77
- Template: '<div class="pict-flow-node-props-fields"><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title</label><input type="text" class="pict-flow-node-props-input" data-prop="Title" value="{~D:Record.Title~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Width" value="{~D:Record.Width~}" min="60" step="10" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Height</label><input type="number" class="pict-flow-node-props-input" data-prop="Height" value="{~D:Record.Height~}" min="40" step="10" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Fill</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyFill" value="{~D:Record.BodyFillValue~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Stroke</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyStroke" value="{~D:Record.BodyStrokeValue~}" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Stroke Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Style.BodyStrokeWidth" value="{~D:Record.BodyStrokeWidthValue~}" min="0" max="10" step="0.5" /></div><div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title Bar</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.TitleBarColor" value="{~D:Record.TitleBarColorValue~}" /></div></div>'
77
+ // Inline oninput/onpointerdown wired to the FlowView's helper
78
+ // see PictViewFlow._applyNodePropChange / _stopEvent.
79
+ Template: '<div class="pict-flow-node-props-fields" data-flow-view="{~D:Record.FlowViewIdentifier~}" data-node-hash="{~D:Record.NodeHash~}">'
80
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title</label><input type="text" class="pict-flow-node-props-input" data-prop="Title" value="{~D:Record.Title~}" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
81
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Width" value="{~D:Record.Width~}" min="60" step="10" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
82
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Height</label><input type="number" class="pict-flow-node-props-input" data-prop="Height" value="{~D:Record.Height~}" min="40" step="10" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
83
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Fill</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyFill" value="{~D:Record.BodyFillValue~}" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
84
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Body Stroke</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.BodyStroke" value="{~D:Record.BodyStrokeValue~}" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
85
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Stroke Width</label><input type="number" class="pict-flow-node-props-input" data-prop="Style.BodyStrokeWidth" value="{~D:Record.BodyStrokeWidthValue~}" min="0" max="10" step="0.5" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
86
+ + '<div class="pict-flow-node-props-field"><label class="pict-flow-node-props-label">Title Bar</label><input type="color" class="pict-flow-node-props-input pict-flow-node-props-color" data-prop="Style.TitleBarColor" value="{~D:Record.TitleBarColorValue~}" oninput="_Pict.views[\'{~D:Record.FlowViewIdentifier~}\']._applyNodePropChange(\'{~D:Record.NodeHash~}\', this.getAttribute(\'data-prop\'), this.value, this.type, event)" onpointerdown="event.stopPropagation()" /></div>'
87
+ + '</div>'
78
88
  }
79
89
  ]
80
90
  };
@@ -216,12 +226,11 @@ class PictViewFlowPropertiesPanel extends libPictView
216
226
  let tmpFO = pPanelsLayer.querySelector(`[data-panel-hash="${pPanelData.Hash}"]`);
217
227
  if (tmpFO)
218
228
  {
219
- // Render appearance and help tabs
229
+ // Render appearance and help tabs. Tab-switching click handlers
230
+ // are inline `onclick=` attributes in Flow-PanelChrome-Template
231
+ // that call FlowView._handlePanelTabClick → switchPanelTab.
220
232
  this._renderAppearanceTab(pPanelData, tmpFO);
221
233
  this._renderHelpTab(pPanelData, tmpFO);
222
-
223
- // Wire up tab switching
224
- this._wireTabSwitching(tmpFO);
225
234
  }
226
235
  }
227
236
 
@@ -559,27 +568,16 @@ class PictViewFlowPropertiesPanel extends libPictView
559
568
  BodyFillValue: tmpStyle.BodyFill || tmpDefaultBodyFill,
560
569
  BodyStrokeValue: tmpStyle.BodyStroke || tmpDefaultBodyStroke,
561
570
  BodyStrokeWidthValue: tmpStyle.BodyStrokeWidth || 1,
562
- TitleBarColorValue: tmpStyle.TitleBarColor || tmpDefaultTitleBarColor
571
+ TitleBarColorValue: tmpStyle.TitleBarColor || tmpDefaultTitleBarColor,
572
+ NodeHash: pPanelData.NodeHash,
573
+ FlowViewIdentifier: this._FlowView.options.ViewIdentifier
563
574
  };
564
575
 
565
- tmpAppearancePane.innerHTML = this.pict.parseTemplateByHash('Flow-NodeProps-Editor', tmpRecord);
566
-
567
- // Wire up live change handlers on all input fields
568
- let tmpInputs = tmpAppearancePane.querySelectorAll('.pict-flow-node-props-input');
569
- for (let i = 0; i < tmpInputs.length; i++)
570
- {
571
- let tmpInput = tmpInputs[i];
572
- let tmpProp = tmpInput.getAttribute('data-prop');
573
-
574
- tmpInput.addEventListener('input', (pEvent) =>
575
- {
576
- pEvent.stopPropagation();
577
- this._applyNodePropChange(pPanelData.NodeHash, tmpProp, tmpInput.value, tmpInput.type);
578
- });
579
-
580
- // Prevent pointer events from propagating to SVG drag handler
581
- tmpInput.addEventListener('pointerdown', (pEvent) => { pEvent.stopPropagation(); });
582
- }
576
+ // Inputs in the rendered template carry inline oninput/onpointerdown
577
+ // handlers that call the FlowView's _applyNodePropChange — no
578
+ // addEventListener wiring needed here.
579
+ this.pict.ContentAssignment.assignContent(tmpAppearancePane,
580
+ this.pict.parseTemplateByHash('Flow-NodeProps-Editor', tmpRecord));
583
581
  }
584
582
 
585
583
  /**
@@ -619,42 +617,37 @@ class PictViewFlowPropertiesPanel extends libPictView
619
617
  }
620
618
 
621
619
  /**
622
- * Wire up tab switching on all tab buttons within a panel foreignObject.
620
+ * Switch the visible tab pane within a panel foreignObject. Invoked
621
+ * from the inline `onclick` handler on tab buttons in
622
+ * Flow-PanelChrome-Template via FlowView._handlePanelTabClick.
623
623
  *
624
- * @param {Element} pForeignObject - The panel's SVG foreignObject element
624
+ * @param {Element} pTabElement - The clicked tab button
625
625
  */
626
- _wireTabSwitching(pForeignObject)
626
+ switchPanelTab(pTabElement)
627
627
  {
628
- let tmpTabs = pForeignObject.querySelectorAll('.pict-flow-panel-tab');
629
- let tmpPanes = pForeignObject.querySelectorAll('.pict-flow-panel-tab-pane');
628
+ let tmpForeignObject = pTabElement.closest('foreignObject');
629
+ if (!tmpForeignObject) return;
630
+
631
+ let tmpTarget = pTabElement.getAttribute('data-tab-target');
632
+ let tmpTabs = tmpForeignObject.querySelectorAll('.pict-flow-panel-tab');
633
+ let tmpPanes = tmpForeignObject.querySelectorAll('.pict-flow-panel-tab-pane');
630
634
 
631
635
  for (let i = 0; i < tmpTabs.length; i++)
632
636
  {
633
- tmpTabs[i].addEventListener('click', (pEvent) =>
634
- {
635
- pEvent.stopPropagation();
636
- let tmpTarget = pEvent.currentTarget.getAttribute('data-tab-target');
637
-
638
- // Deactivate all tabs and panes
639
- for (let j = 0; j < tmpTabs.length; j++)
640
- {
641
- tmpTabs[j].classList.remove('active');
642
- }
643
- for (let j = 0; j < tmpPanes.length; j++)
644
- {
645
- tmpPanes[j].classList.remove('active');
646
- tmpPanes[j].style.display = 'none';
647
- }
637
+ tmpTabs[i].classList.remove('active');
638
+ }
639
+ for (let i = 0; i < tmpPanes.length; i++)
640
+ {
641
+ tmpPanes[i].classList.remove('active');
642
+ tmpPanes[i].style.display = 'none';
643
+ }
648
644
 
649
- // Activate the selected tab and pane
650
- pEvent.currentTarget.classList.add('active');
651
- let tmpTargetPane = pForeignObject.querySelector('.pict-flow-panel-tab-pane[data-tab="' + tmpTarget + '"]');
652
- if (tmpTargetPane)
653
- {
654
- tmpTargetPane.classList.add('active');
655
- tmpTargetPane.style.display = 'block';
656
- }
657
- });
645
+ pTabElement.classList.add('active');
646
+ let tmpTargetPane = tmpForeignObject.querySelector('.pict-flow-panel-tab-pane[data-tab="' + tmpTarget + '"]');
647
+ if (tmpTargetPane)
648
+ {
649
+ tmpTargetPane.classList.add('active');
650
+ tmpTargetPane.style.display = 'block';
658
651
  }
659
652
  }
660
653