pict-section-flow 1.3.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 (162) 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 +99 -7
  5. package/source/providers/PictProvider-Flow-ConnectorShapes.js +8 -0
  6. package/source/providers/PictProvider-Flow-Geometry.js +11 -421
  7. package/source/providers/PictProvider-Flow-Icons.js +20 -0
  8. package/source/providers/PictProvider-Flow-Layouts.js +107 -0
  9. package/source/services/PictService-Flow-ConnectionRenderer.js +77 -5
  10. package/source/services/PictService-Flow-CursorManager.js +113 -0
  11. package/source/services/PictService-Flow-InteractionManager.js +443 -61
  12. package/source/services/PictService-Flow-Layout.js +21 -16
  13. package/source/services/PictService-Flow-PathGenerator.js +30 -417
  14. package/source/services/PictService-Flow-RenderManager.js +9 -1
  15. package/source/services/PictService-Flow-ViewportManager.js +102 -0
  16. package/source/views/PictView-Flow-FloatingToolbar.js +57 -0
  17. package/source/views/PictView-Flow-Node.js +36 -0
  18. package/source/views/PictView-Flow-PropertiesPanel.js +27 -5
  19. package/source/views/PictView-Flow-Toolbar.js +148 -13
  20. package/source/views/PictView-Flow.js +628 -3
  21. package/.claude/launch.json +0 -11
  22. package/docs/.nojekyll +0 -0
  23. package/docs/Architecture.md +0 -163
  24. package/docs/Custom-Styling.md +0 -275
  25. package/docs/Data_Model.md +0 -149
  26. package/docs/Event_System.md +0 -156
  27. package/docs/Getting_Started.md +0 -237
  28. package/docs/Implementation_Reference.md +0 -528
  29. package/docs/Layout_Persistence.md +0 -117
  30. package/docs/README.md +0 -103
  31. package/docs/Theme_Integration.md +0 -150
  32. package/docs/_brand.json +0 -18
  33. package/docs/_cover.md +0 -17
  34. package/docs/_playground.json +0 -24
  35. package/docs/_sidebar.md +0 -57
  36. package/docs/_topbar.md +0 -8
  37. package/docs/_version.json +0 -7
  38. package/docs/api/PictFlowCard.md +0 -216
  39. package/docs/api/PictFlowCardPropertiesPanel.md +0 -235
  40. package/docs/api/addConnection.md +0 -101
  41. package/docs/api/addNode.md +0 -137
  42. package/docs/api/autoLayout.md +0 -77
  43. package/docs/api/getFlowData.md +0 -112
  44. package/docs/api/marshalToView.md +0 -95
  45. package/docs/api/openPanel.md +0 -128
  46. package/docs/api/registerHandler.md +0 -174
  47. package/docs/api/registerNodeType.md +0 -142
  48. package/docs/api/removeConnection.md +0 -57
  49. package/docs/api/removeNode.md +0 -80
  50. package/docs/api/saveLayout.md +0 -152
  51. package/docs/api/screenToSVGCoords.md +0 -68
  52. package/docs/api/selectNode.md +0 -116
  53. package/docs/api/setTheme.md +0 -168
  54. package/docs/api/setZoom.md +0 -97
  55. package/docs/api/toggleFullscreen.md +0 -68
  56. package/docs/card-help/EACH.md +0 -19
  57. package/docs/card-help/FREAD.md +0 -24
  58. package/docs/card-help/FWRITE.md +0 -24
  59. package/docs/card-help/GET.md +0 -22
  60. package/docs/card-help/ITE.md +0 -23
  61. package/docs/card-help/LOG.md +0 -23
  62. package/docs/card-help/NOTE.md +0 -17
  63. package/docs/card-help/PREV.md +0 -18
  64. package/docs/card-help/SET.md +0 -27
  65. package/docs/card-help/SPKL.md +0 -22
  66. package/docs/card-help/STAT.md +0 -23
  67. package/docs/card-help/SW.md +0 -25
  68. package/docs/diagrams/architecture-at-a-glance.excalidraw +0 -4270
  69. package/docs/diagrams/architecture-at-a-glance.mmd +0 -30
  70. package/docs/diagrams/architecture-at-a-glance.svg +0 -2
  71. package/docs/diagrams/data-flow.excalidraw +0 -1451
  72. package/docs/diagrams/data-flow.mmd +0 -17
  73. package/docs/diagrams/data-flow.svg +0 -2
  74. package/docs/diagrams/high-level-design.excalidraw +0 -5767
  75. package/docs/diagrams/high-level-design.mmd +0 -86
  76. package/docs/diagrams/high-level-design.svg +0 -2
  77. package/docs/diagrams/relationships.excalidraw +0 -3852
  78. package/docs/diagrams/relationships.mmd +0 -9
  79. package/docs/diagrams/relationships.svg +0 -2
  80. package/docs/diagrams/service-initialization-sequence.excalidraw +0 -1466
  81. package/docs/diagrams/service-initialization-sequence.mmd +0 -19
  82. package/docs/diagrams/service-initialization-sequence.svg +0 -2
  83. package/docs/diagrams/svg-layer-structure.excalidraw +0 -1060
  84. package/docs/diagrams/svg-layer-structure.mmd +0 -18
  85. package/docs/diagrams/svg-layer-structure.svg +0 -2
  86. package/docs/examples/README.md +0 -9
  87. package/docs/examples/simple_cards/README.md +0 -677
  88. package/docs/examples/simple_cards/css/flowexample.css +0 -65
  89. package/docs/examples/simple_cards/index.html +0 -32
  90. package/docs/examples/simple_cards/js/pict.min.js +0 -12
  91. package/docs/examples/simple_cards/pict-section-flow-example-simple-cards.compatible.min.js +0 -1
  92. package/docs/index.html +0 -38
  93. package/docs/playground/app.json +0 -6
  94. package/docs/playground/appdata.json +0 -85
  95. package/docs/playground/application.js +0 -23
  96. package/docs/playground/pict.json +0 -17
  97. package/docs/playground/runtime/pict-application.min.js +0 -2
  98. package/docs/playground/runtime/pict-section-flow.min.js +0 -2
  99. package/docs/playground/runtime/pict-section-modal.min.js +0 -2
  100. package/docs/playground/runtime/pict.min.js +0 -12
  101. package/docs/retold-catalog.json +0 -244
  102. package/docs/retold-keyword-index.json +0 -26028
  103. package/example_applications/simple_cards/css/flowexample.css +0 -65
  104. package/example_applications/simple_cards/html/index.html +0 -32
  105. package/example_applications/simple_cards/package.json +0 -52
  106. package/example_applications/simple_cards/source/Pict-Application-FlowExample-Configuration.json +0 -15
  107. package/example_applications/simple_cards/source/Pict-Application-FlowExample.js +0 -539
  108. package/example_applications/simple_cards/source/card-help-content.js +0 -16
  109. package/example_applications/simple_cards/source/cards/FlowCard-Comment.js +0 -38
  110. package/example_applications/simple_cards/source/cards/FlowCard-DataPreview.js +0 -44
  111. package/example_applications/simple_cards/source/cards/FlowCard-Each.js +0 -38
  112. package/example_applications/simple_cards/source/cards/FlowCard-FileRead.js +0 -56
  113. package/example_applications/simple_cards/source/cards/FlowCard-FileWrite.js +0 -50
  114. package/example_applications/simple_cards/source/cards/FlowCard-GetValue.js +0 -37
  115. package/example_applications/simple_cards/source/cards/FlowCard-IfThenElse.js +0 -49
  116. package/example_applications/simple_cards/source/cards/FlowCard-LogValues.js +0 -55
  117. package/example_applications/simple_cards/source/cards/FlowCard-SetValue.js +0 -97
  118. package/example_applications/simple_cards/source/cards/FlowCard-Sparkline.js +0 -100
  119. package/example_applications/simple_cards/source/cards/FlowCard-StatusMonitor.js +0 -46
  120. package/example_applications/simple_cards/source/cards/FlowCard-Switch.js +0 -39
  121. package/example_applications/simple_cards/source/providers/PictRouter-FlowExample-Configuration.json +0 -22
  122. package/example_applications/simple_cards/source/sample-flows.js +0 -410
  123. package/example_applications/simple_cards/source/views/PictView-FlowExample-About.js +0 -184
  124. package/example_applications/simple_cards/source/views/PictView-FlowExample-BottomBar.js +0 -77
  125. package/example_applications/simple_cards/source/views/PictView-FlowExample-Documentation.js +0 -325
  126. package/example_applications/simple_cards/source/views/PictView-FlowExample-FileWriteInfo.js +0 -59
  127. package/example_applications/simple_cards/source/views/PictView-FlowExample-Layout.js +0 -90
  128. package/example_applications/simple_cards/source/views/PictView-FlowExample-MainWorkspace.js +0 -453
  129. package/example_applications/simple_cards/source/views/PictView-FlowExample-TopBar.js +0 -95
  130. package/scripts/generate-card-help.js +0 -214
  131. package/source/providers/edges/Edge-Bezier.js +0 -41
  132. package/source/providers/edges/Edge-Orthogonal.js +0 -37
  133. package/source/providers/edges/Edge-OrthogonalSnap.js +0 -72
  134. package/source/providers/edges/Edge-Perimeter-Linear.js +0 -31
  135. package/source/providers/edges/Edge-Perimeter-Orthogonal.js +0 -39
  136. package/source/providers/edges/Edge-Perimeter.js +0 -48
  137. package/source/providers/edges/Edge-PerimeterMath.js +0 -92
  138. package/source/providers/edges/Edge-Straight.js +0 -24
  139. package/source/providers/layouts/Layout-Circular.js +0 -203
  140. package/source/providers/layouts/Layout-Coerce.js +0 -40
  141. package/source/providers/layouts/Layout-Columnar.js +0 -134
  142. package/source/providers/layouts/Layout-Custom.js +0 -27
  143. package/source/providers/layouts/Layout-ForcedFromCenter.js +0 -256
  144. package/source/providers/layouts/Layout-Grid.js +0 -134
  145. package/source/providers/layouts/Layout-Layered.js +0 -155
  146. package/source/providers/layouts/Layout-Rank.js +0 -141
  147. package/source/providers/layouts/Layout-Staggered.js +0 -131
  148. package/source/providers/layouts/Layout-Tabular.js +0 -94
  149. package/test/ConnectionHandleManager_tests.js +0 -717
  150. package/test/ConnectionRenderer_tests.js +0 -591
  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
@@ -1,11 +0,0 @@
1
- {
2
- "version": "0.0.1",
3
- "configurations": [
4
- {
5
- "name": "simple-cards",
6
- "runtimeExecutable": "npx",
7
- "runtimeArgs": ["http-server", "example_applications/simple_cards/dist", "-p", "8085", "-c-1"],
8
- "port": 8085
9
- }
10
- ]
11
- }
package/docs/.nojekyll DELETED
File without changes
@@ -1,163 +0,0 @@
1
- # Architecture
2
-
3
- Pict-Section-Flow follows the standard Pict layered architecture -- Views for rendering, Services for business logic, and Providers for configuration and stateless utilities. All components register with a Fable instance through the service provider pattern.
4
-
5
- ## High-Level Design
6
-
7
- <!-- bespoke diagram: edit diagrams/high-level-design.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
8
- ![High-Level Design](diagrams/high-level-design.svg)
9
-
10
- ## Data Flow
11
-
12
- All mutations flow through a predictable pipeline:
13
-
14
- <!-- bespoke diagram: edit diagrams/data-flow.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
15
- ![Data Flow](diagrams/data-flow.svg)
16
-
17
- ## SVG Layer Structure
18
-
19
- The rendering system uses SVG group elements in a specific z-order:
20
-
21
- <!-- bespoke diagram: edit diagrams/svg-layer-structure.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
22
- ![SVG Layer Structure](diagrams/svg-layer-structure.svg)
23
-
24
- Connections render behind nodes so lines do not obscure node bodies. Tethers render above nodes so the connecting line from a panel to its node is always visible. Panels render last so they float above everything.
25
-
26
- ## Component Roles
27
-
28
- ### Views
29
-
30
- | View | Role |
31
- |------|------|
32
- | `PictViewFlow` | Main entry point. Orchestrates services, providers, and child views. Exposes the public API. |
33
- | `PictViewFlowNode` | Renders individual node SVG groups (title bar, body, ports, labels). |
34
- | `PictViewFlowToolbar` | Renders the docked toolbar with palette cards, zoom controls, and layout buttons. |
35
- | `PictViewFlowFloatingToolbar` | Renders context-sensitive floating toolbar on node selection. |
36
- | `PictViewFlowPropertiesPanel` | Renders panel chrome and delegates content to panel type handlers. |
37
-
38
- ### Services
39
-
40
- | Service | Role |
41
- |---------|------|
42
- | `DataManager` | CRUD for nodes and connections. Marshals to/from AppData. Fires data events. |
43
- | `RenderManager` | Orchestrates full and partial re-renders. Delegates to node, connection, and panel renderers. |
44
- | `SelectionManager` | Tracks selected node, connection, or tether. Fires selection events. |
45
- | `ViewportManager` | Pan, zoom, fullscreen, coordinate transforms. |
46
- | `PanelManager` | Open, close, toggle, and position properties panels. |
47
- | `InteractionManager` | Pointer and keyboard event handling. State machine for drag modes. |
48
- | `Layout Service` | Grid snap math and topological auto-layout algorithm. |
49
- | `ConnectionRenderer` | Renders bezier and orthogonal paths with arrowheads. |
50
- | `PathGenerator` | Pure math: bezier curves and orthogonal routing. |
51
- | `PortRenderer` | Renders port circles on node boundaries. |
52
- | `ConnectionHandleManager` | Manages bezier control point state for manual path adjustments. |
53
- | `Tether` | Renders the connecting lines between panels and their parent nodes. |
54
-
55
- ### Providers
56
-
57
- | Provider | Role |
58
- |----------|------|
59
- | `NodeTypes` | Registry of available node types. Cards register here. |
60
- | `EventHandler` | Named event system with multi-handler support. |
61
- | `Layouts` | Save/restore/delete layout snapshots. Pluggable storage backend. |
62
- | `Theme` | Named theme registry. Applies CSS variable overrides. |
63
- | `CSS` | Generates and injects all CSS into Pict's CSSMap service. |
64
- | `Geometry` | Port positioning math: local coordinates, minimum node height, port counts by side. |
65
- | `Noise` | Perlin-like noise for the hand-drawn rendering effect. |
66
- | `SVGHelpers` | DOM utilities for creating and manipulating SVG elements. |
67
- | `ConnectorShapes` | SVG marker definitions for arrowheads by port type. |
68
- | `Icons` | Icon template library for toolbar and node UI. |
69
- | `PanelChrome` | Panel title bar and tab bar template generation. |
70
-
71
- ## Flow Data Structure
72
-
73
- The canonical flow state is a plain JavaScript object:
74
-
75
- ```javascript
76
- {
77
- Nodes:
78
- [
79
- {
80
- Hash: 'node-<UUID>',
81
- Type: 'start',
82
- X: 50, Y: 180,
83
- Width: 140, Height: 80,
84
- Title: 'Start',
85
- Ports:
86
- [
87
- {
88
- Hash: 'port-<UUID>',
89
- Direction: 'output',
90
- Side: 'right',
91
- Label: 'Out',
92
- PortType: 'event'
93
- }
94
- ],
95
- Data: {}
96
- }
97
- ],
98
-
99
- Connections:
100
- [
101
- {
102
- Hash: 'conn-<UUID>',
103
- SourceNodeHash: 'node-...',
104
- SourcePortHash: 'port-...',
105
- TargetNodeHash: 'node-...',
106
- TargetPortHash: 'port-...',
107
- Data:
108
- {
109
- LineMode: 'bezier',
110
- HandleCustomized: false
111
- }
112
- }
113
- ],
114
-
115
- OpenPanels:
116
- [
117
- {
118
- Hash: 'panel-<UUID>',
119
- NodeHash: 'node-...',
120
- PanelType: 'Template',
121
- Title: 'Properties',
122
- X: 300, Y: 250,
123
- Width: 300, Height: 200
124
- }
125
- ],
126
-
127
- SavedLayouts: [],
128
-
129
- ViewState:
130
- {
131
- PanX: 0, PanY: 0,
132
- Zoom: 1,
133
- SelectedNodeHash: null,
134
- SelectedConnectionHash: null,
135
- SelectedTetherHash: null
136
- }
137
- }
138
- ```
139
-
140
- ## Service Initialization Sequence
141
-
142
- When PictViewFlow initializes, it follows a declarative registry to instantiate all components:
143
-
144
- <!-- bespoke diagram: edit diagrams/service-initialization-sequence.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
145
- ![Service Initialization Sequence](diagrams/service-initialization-sequence.svg)
146
-
147
- ## Design Patterns
148
-
149
- ### Service Provider Pattern
150
-
151
- Every service and provider extends `fable-serviceproviderbase` and registers with the Fable instance. This means any component can access any other through `this.fable` without explicit imports or singletons.
152
-
153
- ### Event-Driven Architecture
154
-
155
- The `EventHandlerProvider` decouples application code from the flow internals. Services fire events; application code registers handlers. This avoids subclassing or monkey-patching to extend behavior.
156
-
157
- ### Data/View Separation
158
-
159
- The flow data structure is completely separate from the SVG DOM. Mutations operate on the data model; the render manager regenerates the DOM from the model. This makes serialization, undo/redo, and server sync straightforward.
160
-
161
- ### Selective Re-rendering
162
-
163
- Full re-renders are used when the graph topology changes (node added/removed, connection added/removed). During interactive operations like node dragging, only the affected elements (the dragged node and its connections) are updated for smooth performance.
@@ -1,275 +0,0 @@
1
- # Custom Styling
2
-
3
- The flow diagram exposes a comprehensive set of CSS custom properties (design tokens) on the `.pict-flow-container` element. Override any of these variables to theme the flow diagram without modifying source code.
4
-
5
- ## Quick Start
6
-
7
- Add a `<style>` block after the flow diagram initializes, or use a theme provider:
8
-
9
- ```css
10
- /* Override via CSS */
11
- .pict-flow-container {
12
- --pf-canvas-bg: #1a1a2e;
13
- --pf-node-body-fill: #16213e;
14
- --pf-node-body-stroke: #0f3460;
15
- --pf-text-primary: #e8e8e8;
16
- --pf-node-selected-stroke: #e94560;
17
- }
18
- ```
19
-
20
- ```javascript
21
- // Override via the Theme Provider API
22
- flowView._ThemeProvider.registerTheme('dark',
23
- {
24
- Key: 'dark',
25
- Label: 'Dark Mode',
26
- CSSVariables:
27
- {
28
- '--pf-canvas-bg': '#1a1a2e',
29
- '--pf-node-body-fill': '#16213e',
30
- '--pf-node-body-stroke': '#0f3460',
31
- '--pf-text-primary': '#e8e8e8',
32
- '--pf-node-selected-stroke': '#e94560'
33
- },
34
- NodeBodyMode: 'rect'
35
- });
36
- flowView.setTheme('dark');
37
- ```
38
-
39
- ## Design Token Reference
40
-
41
- All variables are prefixed `--pf-` (short for *pict-flow*) and defined on `.pict-flow-container`. Default values shown below are for the built-in Modern theme.
42
-
43
- ### Text
44
-
45
- | Variable | Default | Description |
46
- |----------|---------|-------------|
47
- | `--pf-text-primary` | `#2c3e50` | Primary text color (labels, body text, form values) |
48
- | `--pf-text-heading` | `#1a252f` | Heading text (info panel headers) |
49
- | `--pf-text-secondary` | `#7f8c8d` | Secondary text (descriptions, field labels) |
50
- | `--pf-text-tertiary` | `#8e99a4` | Tertiary text (section titles, constraints) |
51
- | `--pf-text-placeholder` | `#95a5a6` | Placeholder/muted text (category labels, code badges) |
52
-
53
- ### Node
54
-
55
- | Variable | Default | Description |
56
- |----------|---------|-------------|
57
- | `--pf-node-body-fill` | `#ffffff` | Node body background |
58
- | `--pf-node-body-stroke` | `#d0d4d8` | Node body border |
59
- | `--pf-node-body-stroke-hover` | `#b0b8c0` | Node body border on hover |
60
- | `--pf-node-body-stroke-width` | `1` | Node body border width |
61
- | `--pf-node-body-radius` | `8px` | Node body corner radius |
62
- | `--pf-node-shadow` | `drop-shadow(0 1px 3px rgba(0,0,0,0.10))` | Default node shadow |
63
- | `--pf-node-shadow-hover` | `drop-shadow(0 2px 6px rgba(0,0,0,0.15))` | Shadow on hover |
64
- | `--pf-node-shadow-selected` | `drop-shadow(0 2px 8px rgba(52,152,219,0.25))` | Shadow when selected |
65
- | `--pf-node-shadow-dragging` | `drop-shadow(0 4px 12px rgba(0,0,0,0.20))` | Shadow while dragging |
66
- | `--pf-node-title-fill` | `#ffffff` | Title text color (on the title bar) |
67
- | `--pf-node-title-size` | `11.5px` | Title font size |
68
- | `--pf-node-title-weight` | `600` | Title font weight |
69
- | `--pf-node-title-bar-color` | `#2c3e50` | Default title bar background color |
70
- | `--pf-node-type-label-fill` | `#a0a8b0` | Node type label color (appears on hover) |
71
- | `--pf-node-selected-stroke` | `#3498db` | Primary accent / selection stroke color |
72
-
73
- ### Node Variants
74
-
75
- Built-in node types override the node body fill and stroke. Use these tokens to customize variant colors globally.
76
-
77
- | Variable | Default | Description |
78
- |----------|---------|-------------|
79
- | `--pf-node-start-fill` | `#eafaf1` | Start node body fill |
80
- | `--pf-node-start-stroke` | `#27ae60` | Start node body stroke |
81
- | `--pf-node-end-fill` | `#e8f8f5` | End node body fill |
82
- | `--pf-node-end-stroke` | `#1abc9c` | End node body stroke |
83
- | `--pf-node-halt-fill` | `#fdedec` | Halt/error node body fill |
84
- | `--pf-node-halt-stroke` | `#e74c3c` | Halt/error node body stroke |
85
- | `--pf-node-decision-fill` | `#fff9e6` | Decision node body fill |
86
- | `--pf-node-decision-stroke` | `#f39c12` | Decision node body stroke |
87
-
88
- ### Ports
89
-
90
- | Variable | Default | Description |
91
- |----------|---------|-------------|
92
- | `--pf-port-input-fill` | `#3498db` | Input port circle fill |
93
- | `--pf-port-output-fill` | `#2ecc71` | Output port circle fill |
94
- | `--pf-port-stroke` | `#ffffff` | Port circle border color |
95
- | `--pf-port-stroke-width` | `2` | Port circle border width |
96
- | `--pf-port-label-bg` | `rgba(255,253,240,0.5)` | Port label badge background |
97
- | `--pf-port-label-text` | `#2c3e50` | Port label text color |
98
-
99
- ### Port Type Colors
100
-
101
- When ports have a `PortType` set, these colors override the default input/output fills.
102
-
103
- | Variable | Default | Description |
104
- |----------|---------|-------------|
105
- | `--pf-port-event-in-fill` | `#3498db` | Event input port |
106
- | `--pf-port-event-out-fill` | `#2ecc71` | Event output port |
107
- | `--pf-port-setting-fill` | `#e67e22` | Setting port |
108
- | `--pf-port-value-fill` | `#f1c40f` | Value port |
109
- | `--pf-port-error-fill` | `#e74c3c` | Error port |
110
-
111
- ### Connection Type Colors
112
-
113
- Connections inherit color from their source port type.
114
-
115
- | Variable | Default | Description |
116
- |----------|---------|-------------|
117
- | `--pf-connection-event-in-stroke` | `#3498db` | Event-in connection stroke |
118
- | `--pf-connection-event-out-stroke` | `#2ecc71` | Event-out connection stroke |
119
- | `--pf-connection-setting-stroke` | `#e67e22` | Setting connection stroke |
120
- | `--pf-connection-value-stroke` | `#f1c40f` | Value connection stroke |
121
- | `--pf-connection-error-stroke` | `#e74c3c` | Error connection stroke |
122
-
123
- ### Connections
124
-
125
- | Variable | Default | Description |
126
- |----------|---------|-------------|
127
- | `--pf-connection-stroke` | `#95a5a6` | Default connection line color |
128
- | `--pf-connection-stroke-hover` | `#7f8c8d` | Connection line color on hover |
129
- | `--pf-connection-selected-stroke` | `#3498db` | Connection line color when selected |
130
-
131
- ### Panels
132
-
133
- | Variable | Default | Description |
134
- |----------|---------|-------------|
135
- | `--pf-panel-bg` | `#ffffff` | Panel background |
136
- | `--pf-panel-border` | `#d0d4d8` | Panel border color |
137
- | `--pf-panel-radius` | `8px` | Panel corner radius |
138
- | `--pf-panel-shadow` | `0 4px 12px rgba(0,0,0,0.10), ...` | Panel box shadow |
139
- | `--pf-panel-titlebar-bg` | `#f7f8fa` | Panel title bar background |
140
- | `--pf-panel-titlebar-border` | `#e8eaed` | Title bar bottom border |
141
- | `--pf-panel-title-color` | `#2c3e50` | Panel title text color |
142
-
143
- ### Tabs
144
-
145
- | Variable | Default | Description |
146
- |----------|---------|-------------|
147
- | `--pf-tab-text` | `#8e99a4` | Inactive tab text color |
148
- | `--pf-tab-text-hover` | `#5a6a7a` | Tab text color on hover |
149
- | `--pf-tab-active-border` | `var(--pf-node-selected-stroke)` | Active tab top border color |
150
- | `--pf-resize-handle-hover` | `#e0e3e6` | Panel resize handle hover color |
151
-
152
- ### Forms & Inputs
153
-
154
- | Variable | Default | Description |
155
- |----------|---------|-------------|
156
- | `--pf-input-border` | `#d5d8dc` | Input/select border color |
157
- | `--pf-input-border-focus` | `#3498db` | Input border color on focus |
158
- | `--pf-divider-light` | `#ecf0f1` | Light divider/separator color |
159
- | `--pf-divider-medium` | `#e8eaed` | Medium divider/separator color |
160
-
161
- ### Buttons
162
-
163
- | Variable | Default | Description |
164
- |----------|---------|-------------|
165
- | `--pf-button-border` | `#bdc3c7` | Button border color |
166
- | `--pf-button-hover-border` | `#95a5a6` | Button border color on hover |
167
- | `--pf-button-hover-bg` | `#ecf0f1` | Button background on hover |
168
- | `--pf-button-active-bg` | `#d5dbdb` | Button background on active/press |
169
- | `--pf-button-danger-text` | `#e74c3c` | Danger button text color |
170
- | `--pf-button-danger-hover-bg` | `#fdedec` | Danger button hover background |
171
- | `--pf-button-close-color` | `#b0b8c0` | Panel close button color |
172
-
173
- ### Badges
174
-
175
- | Variable | Default | Description |
176
- |----------|---------|-------------|
177
- | `--pf-badge-category-bg` | `#f0f2f4` | Category badge background |
178
- | `--pf-badge-category-text` | `#6b7b8d` | Category badge text color |
179
- | `--pf-badge-code-bg` | `#eaf2f8` | Code badge background |
180
- | `--pf-badge-code-text` | `#2980b9` | Code badge text color |
181
-
182
- ### Info Panel
183
-
184
- | Variable | Default | Description |
185
- |----------|---------|-------------|
186
- | `--pf-port-item-bg` | `#f8f9fa` | Port list item background |
187
-
188
- ### Toolbar
189
-
190
- | Variable | Default | Description |
191
- |----------|---------|-------------|
192
- | `--pf-toolbar-bg` | `#ffffff` | Toolbar background |
193
- | `--pf-toolbar-border` | `#e0e0e0` | Toolbar border and group separators |
194
-
195
- ### Palette Cards
196
-
197
- | Variable | Default | Description |
198
- |----------|---------|-------------|
199
- | `--pf-card-border` | `#d5d8dc` | Palette card border |
200
- | `--pf-card-hover-bg` | `#eaf2f8` | Palette card hover background |
201
- | `--pf-card-hover-shadow` | `0 1px 3px rgba(52,152,219,0.15)` | Palette card hover shadow |
202
-
203
- ### Canvas
204
-
205
- | Variable | Default | Description |
206
- |----------|---------|-------------|
207
- | `--pf-canvas-bg` | `#fafafa` | Background color of the SVG canvas |
208
- | `--pf-grid-stroke` | `#e8e8e8` | Grid line color |
209
-
210
- ## Per-Node-Type Overrides
211
-
212
- Individual node types can scope-override any variable. The flow renderer adds a CSS class `.pict-flow-node-{type}` to each node group. Target these classes to customize specific node types without affecting others:
213
-
214
- ```css
215
- /* Make "FileRead" nodes stand out */
216
- .pict-flow-node-FileRead .pict-flow-node-body {
217
- fill: #fef9e7;
218
- stroke: #f4d03f;
219
- }
220
- ```
221
-
222
- ## Theme Provider API
223
-
224
- The `PictProviderFlowTheme` service manages named themes and applies them via CSS variable overrides.
225
-
226
- ### Registering a Theme
227
-
228
- ```javascript
229
- flowView._ThemeProvider.registerTheme('corporate',
230
- {
231
- Key: 'corporate',
232
- Label: 'Corporate',
233
- CSSVariables:
234
- {
235
- '--pf-canvas-bg': '#f5f6fa',
236
- '--pf-node-selected-stroke': '#0066cc',
237
- '--pf-node-body-stroke': '#c8d6e5',
238
- '--pf-toolbar-bg': '#ffffff',
239
- '--pf-panel-titlebar-bg': '#f0f2f5'
240
- },
241
- NodeBodyMode: 'rect',
242
- NoiseConfig: { Enabled: false }
243
- });
244
- ```
245
-
246
- ### Switching Themes
247
-
248
- ```javascript
249
- flowView.setTheme('corporate'); // Apply the corporate theme
250
- flowView.setTheme('default'); // Restore the default Modern theme
251
- flowView.setTheme('sketch'); // Hand-drawn style (built-in)
252
- flowView.setTheme('blueprint'); // Blueprint style (built-in)
253
- ```
254
-
255
- ### Theme Properties
256
-
257
- | Property | Type | Description |
258
- |----------|------|-------------|
259
- | `Key` | `string` | Unique identifier for the theme |
260
- | `Label` | `string` | Display name |
261
- | `CSSVariables` | `object` | Map of `--pf-*` variable names to values |
262
- | `AdditionalCSS` | `string` | Extra CSS appended after variable overrides |
263
- | `NodeBodyMode` | `string` | Node rendering mode: `'rect'` or `'bracket'` |
264
- | `NoiseConfig` | `object` | Hand-drawn effect configuration |
265
-
266
- ### How It Works
267
-
268
- When a theme is activated:
269
-
270
- 1. The CSS provider calls `generateCSS()` which aggregates all domain CSS
271
- 2. If an active theme defines `CSSVariables`, they are emitted as a `.pict-flow-container` override block appended after the base CSS
272
- 3. If `AdditionalCSS` is defined, it is appended after the variable overrides
273
- 4. The combined CSS is re-injected via the Pict `CSSMap` service
274
-
275
- This means theme variable overrides have higher specificity than the base defaults (same selector, later in source order), and `AdditionalCSS` can add entirely new rules or increase specificity where needed.
@@ -1,149 +0,0 @@
1
- # Data Model
2
-
3
- The entire flow graph state is represented by a single JSON object called **FlowData**. Every mutation goes through the `DataManager` service and triggers a re-render. This structure is what gets persisted when you call `marshalFromView()` and restored with `marshalToView()`.
4
-
5
- ## FlowData Structure
6
-
7
- ```javascript
8
- {
9
- Nodes: [], // Array of node objects
10
- Connections: [], // Array of connection objects
11
- OpenPanels: [], // Array of panel objects
12
- SavedLayouts: [], // Array of layout snapshots
13
- ViewState:
14
- {
15
- PanX: 0, // Viewport horizontal offset
16
- PanY: 0, // Viewport vertical offset
17
- Zoom: 1, // Viewport zoom level
18
- SelectedNodeHash: null,
19
- SelectedConnectionHash: null,
20
- SelectedTetherHash: null
21
- }
22
- }
23
- ```
24
-
25
- ## Node
26
-
27
- Each node represents a discrete operation in the flow graph.
28
-
29
- ```javascript
30
- {
31
- Hash: 'abc123', // Unique identifier (auto-generated)
32
- Type: 'ITE', // Card type code (references NodeTypes)
33
- X: 200, // Horizontal position in SVG space
34
- Y: 150, // Vertical position in SVG space
35
- Width: 200, // Node width in pixels
36
- Height: 100, // Node height in pixels
37
- Title: 'If-Then-Else', // Display title on the node
38
- Ports: // Array of port definitions
39
- [
40
- {
41
- Hash: 'port-1',
42
- Direction: 'input', // 'input' or 'output'
43
- Side: 'left', // Port position on node edge
44
- Label: 'In', // Port label text
45
- PortType: 'event-in', // Optional type for coloring
46
- DataType: 'boolean', // Optional data type hint
47
- MinimumInputCount: 1, // Minimum connections (0 = optional)
48
- MaximumInputCount: 1 // Maximum connections (-1 = unlimited)
49
- }
50
- ],
51
- Style: // Optional per-node style overrides
52
- {
53
- BodyFill: '#fef5e7',
54
- BodyStroke: '#e67e22',
55
- BodyStrokeWidth: 1,
56
- TitleBarColor: '#e67e22'
57
- },
58
- Data: {} // User-defined payload (card-specific)
59
- }
60
- ```
61
-
62
- ### Port Side Positions
63
-
64
- Ports can be placed at 12 positions around the node perimeter using a zone system:
65
-
66
- ```
67
- top-left top top-right
68
- left-top (body) right-top
69
- left right
70
- left-bottom (body) right-bottom
71
- bottom-left bottom bottom-right
72
- ```
73
-
74
- The legacy four-value sides (`left`, `right`, `top`, `bottom`) map to the middle zone of each edge.
75
-
76
- ## Connection
77
-
78
- A connection links an output port on one node to an input port on another.
79
-
80
- ```javascript
81
- {
82
- Hash: 'conn-1',
83
- SourceNodeHash: 'node-a',
84
- SourcePortHash: 'port-out',
85
- TargetNodeHash: 'node-b',
86
- TargetPortHash: 'port-in',
87
- Data:
88
- {
89
- LineMode: 'bezier', // 'bezier' or 'orthogonal'
90
- HandleCustomized: false, // True if handles have been manually moved
91
-
92
- // Bezier handles (multi-point curve control)
93
- BezierHandles: [{ x: 300, y: 175 }],
94
-
95
- // Orthogonal handles (right-angle path corners)
96
- OrthoCorner1X: 250,
97
- OrthoCorner1Y: 150,
98
- OrthoCorner2X: 350,
99
- OrthoCorner2Y: 200,
100
- OrthoMidOffset: 0
101
- }
102
- }
103
- ```
104
-
105
- ### Connection Routing
106
-
107
- Connections support two path modes:
108
-
109
- - **Bezier** (default) -- Smooth curves with one or more control handles. Right-click a connection to add a handle; drag handles to reshape the curve.
110
- - **Orthogonal** -- Right-angle paths with two corner points. Double-click a connection handle to toggle between bezier and orthogonal modes.
111
-
112
- ## Panel
113
-
114
- An open properties panel associated with a node.
115
-
116
- ```javascript
117
- {
118
- Hash: 'panel-1',
119
- NodeHash: 'node-a', // The node this panel belongs to
120
- PanelType: 'Form', // 'Template', 'Markdown', 'Form', 'View', or 'Info'
121
- Title: 'Set Value Properties',
122
- X: 450, // Panel position in SVG space
123
- Y: 100,
124
- Width: 320,
125
- Height: 200
126
- }
127
- ```
128
-
129
- Each panel is rendered as an HTML `foreignObject` inside the SVG, with a tether line connecting it to its parent node. Panels can be dragged, resized, and have tabbed views for Properties, Help, and Appearance.
130
-
131
- ## ViewState
132
-
133
- Viewport and selection state, persisted with the flow data.
134
-
135
- ```javascript
136
- {
137
- PanX: -120, // Horizontal pan offset
138
- PanY: -50, // Vertical pan offset
139
- Zoom: 0.85, // Zoom level (0.1 to 5.0)
140
- SelectedNodeHash: 'node-a', // Currently selected node (null if none)
141
- SelectedConnectionHash: null, // Currently selected connection
142
- SelectedTetherHash: null // Currently selected tether line
143
- }
144
- ```
145
-
146
- ## Relationships
147
-
148
- <!-- bespoke diagram: edit diagrams/relationships.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
149
- ![Relationships](diagrams/relationships.svg)