pict-section-flow 1.4.0 → 2.0.1
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/package.json +7 -2
- package/source/Pict-Section-Flow.js +20 -14
- package/source/providers/PictProvider-Flow-Background.js +303 -0
- package/source/providers/PictProvider-Flow-CSS.js +73 -7
- package/source/providers/PictProvider-Flow-Geometry.js +11 -421
- package/source/providers/PictProvider-Flow-Icons.js +12 -0
- package/source/providers/PictProvider-Flow-Layouts.js +107 -0
- package/source/services/PictService-Flow-ConnectionRenderer.js +1 -1
- package/source/services/PictService-Flow-CursorManager.js +113 -0
- package/source/services/PictService-Flow-InteractionManager.js +439 -59
- package/source/services/PictService-Flow-Layout.js +21 -16
- package/source/services/PictService-Flow-PathGenerator.js +30 -417
- package/source/services/PictService-Flow-RenderManager.js +23 -3
- package/source/services/PictService-Flow-ViewportManager.js +102 -0
- package/source/views/PictView-Flow-FloatingToolbar.js +5 -1
- package/source/views/PictView-Flow-Node.js +29 -0
- package/source/views/PictView-Flow-Toolbar.js +50 -3
- package/source/views/PictView-Flow.js +591 -2
- package/.claude/launch.json +0 -11
- package/docs/.nojekyll +0 -0
- package/docs/Architecture.md +0 -163
- package/docs/Custom-Styling.md +0 -275
- package/docs/Data_Model.md +0 -149
- package/docs/Event_System.md +0 -156
- package/docs/Getting_Started.md +0 -237
- package/docs/Implementation_Reference.md +0 -528
- package/docs/Layout_Persistence.md +0 -117
- package/docs/README.md +0 -103
- package/docs/Theme_Integration.md +0 -150
- package/docs/_brand.json +0 -18
- package/docs/_cover.md +0 -17
- package/docs/_playground.json +0 -24
- package/docs/_sidebar.md +0 -57
- package/docs/_topbar.md +0 -8
- package/docs/_version.json +0 -7
- package/docs/api/PictFlowCard.md +0 -216
- package/docs/api/PictFlowCardPropertiesPanel.md +0 -235
- package/docs/api/addConnection.md +0 -101
- package/docs/api/addNode.md +0 -137
- package/docs/api/autoLayout.md +0 -77
- package/docs/api/getFlowData.md +0 -112
- package/docs/api/marshalToView.md +0 -95
- package/docs/api/openPanel.md +0 -128
- package/docs/api/registerHandler.md +0 -174
- package/docs/api/registerNodeType.md +0 -142
- package/docs/api/removeConnection.md +0 -57
- package/docs/api/removeNode.md +0 -80
- package/docs/api/saveLayout.md +0 -152
- package/docs/api/screenToSVGCoords.md +0 -68
- package/docs/api/selectNode.md +0 -116
- package/docs/api/setTheme.md +0 -168
- package/docs/api/setZoom.md +0 -97
- package/docs/api/toggleFullscreen.md +0 -68
- package/docs/card-help/EACH.md +0 -19
- package/docs/card-help/FREAD.md +0 -24
- package/docs/card-help/FWRITE.md +0 -24
- package/docs/card-help/GET.md +0 -22
- package/docs/card-help/ITE.md +0 -23
- package/docs/card-help/LOG.md +0 -23
- package/docs/card-help/NOTE.md +0 -17
- package/docs/card-help/PREV.md +0 -18
- package/docs/card-help/SET.md +0 -27
- package/docs/card-help/SPKL.md +0 -22
- package/docs/card-help/STAT.md +0 -23
- package/docs/card-help/SW.md +0 -25
- package/docs/diagrams/architecture-at-a-glance.excalidraw +0 -4270
- package/docs/diagrams/architecture-at-a-glance.mmd +0 -30
- package/docs/diagrams/architecture-at-a-glance.svg +0 -2
- package/docs/diagrams/data-flow.excalidraw +0 -1451
- package/docs/diagrams/data-flow.mmd +0 -17
- package/docs/diagrams/data-flow.svg +0 -2
- package/docs/diagrams/high-level-design.excalidraw +0 -5767
- package/docs/diagrams/high-level-design.mmd +0 -86
- package/docs/diagrams/high-level-design.svg +0 -2
- package/docs/diagrams/relationships.excalidraw +0 -3852
- package/docs/diagrams/relationships.mmd +0 -9
- package/docs/diagrams/relationships.svg +0 -2
- package/docs/diagrams/service-initialization-sequence.excalidraw +0 -1466
- package/docs/diagrams/service-initialization-sequence.mmd +0 -19
- package/docs/diagrams/service-initialization-sequence.svg +0 -2
- package/docs/diagrams/svg-layer-structure.excalidraw +0 -1060
- package/docs/diagrams/svg-layer-structure.mmd +0 -18
- package/docs/diagrams/svg-layer-structure.svg +0 -2
- package/docs/examples/README.md +0 -9
- package/docs/examples/simple_cards/README.md +0 -677
- package/docs/examples/simple_cards/css/flowexample.css +0 -65
- package/docs/examples/simple_cards/index.html +0 -32
- package/docs/examples/simple_cards/js/pict.min.js +0 -12
- package/docs/examples/simple_cards/pict-section-flow-example-simple-cards.compatible.min.js +0 -1
- package/docs/index.html +0 -38
- package/docs/playground/app.json +0 -6
- package/docs/playground/appdata.json +0 -85
- package/docs/playground/application.js +0 -23
- package/docs/playground/pict.json +0 -17
- package/docs/playground/runtime/pict-application.min.js +0 -2
- package/docs/playground/runtime/pict-section-flow.min.js +0 -2
- package/docs/playground/runtime/pict-section-modal.min.js +0 -2
- package/docs/playground/runtime/pict.min.js +0 -12
- package/docs/retold-catalog.json +0 -244
- package/docs/retold-keyword-index.json +0 -26028
- package/example_applications/simple_cards/css/flowexample.css +0 -65
- package/example_applications/simple_cards/html/index.html +0 -32
- package/example_applications/simple_cards/package.json +0 -52
- package/example_applications/simple_cards/source/Pict-Application-FlowExample-Configuration.json +0 -15
- package/example_applications/simple_cards/source/Pict-Application-FlowExample.js +0 -539
- package/example_applications/simple_cards/source/card-help-content.js +0 -16
- package/example_applications/simple_cards/source/cards/FlowCard-Comment.js +0 -38
- package/example_applications/simple_cards/source/cards/FlowCard-DataPreview.js +0 -44
- package/example_applications/simple_cards/source/cards/FlowCard-Each.js +0 -38
- package/example_applications/simple_cards/source/cards/FlowCard-FileRead.js +0 -56
- package/example_applications/simple_cards/source/cards/FlowCard-FileWrite.js +0 -50
- package/example_applications/simple_cards/source/cards/FlowCard-GetValue.js +0 -37
- package/example_applications/simple_cards/source/cards/FlowCard-IfThenElse.js +0 -49
- package/example_applications/simple_cards/source/cards/FlowCard-LogValues.js +0 -55
- package/example_applications/simple_cards/source/cards/FlowCard-SetValue.js +0 -97
- package/example_applications/simple_cards/source/cards/FlowCard-Sparkline.js +0 -100
- package/example_applications/simple_cards/source/cards/FlowCard-StatusMonitor.js +0 -46
- package/example_applications/simple_cards/source/cards/FlowCard-Switch.js +0 -39
- package/example_applications/simple_cards/source/providers/PictRouter-FlowExample-Configuration.json +0 -22
- package/example_applications/simple_cards/source/sample-flows.js +0 -410
- package/example_applications/simple_cards/source/views/PictView-FlowExample-About.js +0 -184
- package/example_applications/simple_cards/source/views/PictView-FlowExample-BottomBar.js +0 -77
- package/example_applications/simple_cards/source/views/PictView-FlowExample-Documentation.js +0 -325
- package/example_applications/simple_cards/source/views/PictView-FlowExample-FileWriteInfo.js +0 -59
- package/example_applications/simple_cards/source/views/PictView-FlowExample-Layout.js +0 -90
- package/example_applications/simple_cards/source/views/PictView-FlowExample-MainWorkspace.js +0 -453
- package/example_applications/simple_cards/source/views/PictView-FlowExample-TopBar.js +0 -95
- package/scripts/generate-card-help.js +0 -214
- package/source/providers/edges/Edge-Bezier.js +0 -41
- package/source/providers/edges/Edge-Orthogonal.js +0 -37
- package/source/providers/edges/Edge-OrthogonalSnap.js +0 -72
- package/source/providers/edges/Edge-Perimeter-Linear.js +0 -31
- package/source/providers/edges/Edge-Perimeter-Orthogonal.js +0 -39
- package/source/providers/edges/Edge-Perimeter.js +0 -48
- package/source/providers/edges/Edge-PerimeterMath.js +0 -92
- package/source/providers/edges/Edge-Straight.js +0 -24
- package/source/providers/layouts/Layout-Circular.js +0 -203
- package/source/providers/layouts/Layout-Coerce.js +0 -40
- package/source/providers/layouts/Layout-Columnar.js +0 -134
- package/source/providers/layouts/Layout-Custom.js +0 -27
- package/source/providers/layouts/Layout-ForcedFromCenter.js +0 -256
- package/source/providers/layouts/Layout-Grid.js +0 -134
- package/source/providers/layouts/Layout-Layered.js +0 -155
- package/source/providers/layouts/Layout-Rank.js +0 -141
- package/source/providers/layouts/Layout-Staggered.js +0 -131
- package/source/providers/layouts/Layout-Tabular.js +0 -94
- package/test/CardPalette_tests.js +0 -43
- package/test/ConnectionHandleManager_tests.js +0 -717
- package/test/ConnectionRenderer_tests.js +0 -591
- package/test/ConnectionStyle_tests.js +0 -90
- package/test/DataManager_tests.js +0 -859
- package/test/Geometry_tests.js +0 -767
- package/test/InteractionManager_tests.js +0 -279
- package/test/Layout_tests.js +0 -1604
- package/test/NodeView_tests.js +0 -66
- package/test/PanelManager_tests.js +0 -172
- package/test/PathGenerator_tests.js +0 -978
- package/test/PortRenderer_tests.js +0 -376
- package/test/RenderManager_tests.js +0 -756
- package/test/Renderer_tests.js +0 -133
- package/test/SelectionManager_tests.js +0 -185
- package/test/StylePresets_tests.js +0 -153
- package/test/ToolbarExtraButtons_tests.js +0 -138
- package/test/UndirectedConnections_tests.js +0 -70
package/docs/README.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# Pict-Section-Flow
|
|
2
|
-
|
|
3
|
-
An interactive flow diagram section view for the [Pict](https://fable-retold.github.io/pict/) application framework. Build node-based visual editors, workflow designers, and data pipeline tools with a declarative, configuration-driven API.
|
|
4
|
-
|
|
5
|
-
Pict-Section-Flow provides a complete graph editing experience -- nodes, ports, connections, properties panels, theming, and layout persistence -- all composable through the Fable service provider pattern.
|
|
6
|
-
|
|
7
|
-
## What It Does
|
|
8
|
-
|
|
9
|
-
Pict-Section-Flow renders an SVG-based canvas where users can:
|
|
10
|
-
|
|
11
|
-
- **Drag nodes** from a palette onto the canvas
|
|
12
|
-
- **Connect ports** between nodes with bezier or orthogonal paths
|
|
13
|
-
- **Open properties panels** on any node for editing, documentation, or custom views
|
|
14
|
-
- **Pan and zoom** the viewport with mouse or trackpad
|
|
15
|
-
- **Save and restore** spatial layouts to localStorage or a remote backend
|
|
16
|
-
- **Theme the entire diagram** with built-in themes or CSS custom properties
|
|
17
|
-
|
|
18
|
-
All interaction is driven by a JSON data structure that represents the flow graph. The view marshals data bidirectionally with Pict's `AppData` store, so the flow state integrates naturally with the rest of your application.
|
|
19
|
-
|
|
20
|
-
## Architecture at a Glance
|
|
21
|
-
|
|
22
|
-
<!-- bespoke diagram: edit diagrams/architecture-at-a-glance.mmd or .hints.json, then: npx pict-renderer-graph build modules/pict/pict-section-flow/docs -->
|
|
23
|
-

|
|
24
|
-
|
|
25
|
-
The module follows the standard Pict layered architecture:
|
|
26
|
-
|
|
27
|
-
- **Views** handle rendering and DOM interaction
|
|
28
|
-
- **Services** contain business logic (CRUD, selection, viewport math)
|
|
29
|
-
- **Providers** supply configuration and stateless utilities (themes, node types, geometry)
|
|
30
|
-
|
|
31
|
-
## Key Concepts
|
|
32
|
-
|
|
33
|
-
### Flow Data
|
|
34
|
-
|
|
35
|
-
The entire graph state lives in a single JSON object with four collections: `Nodes`, `Connections`, `OpenPanels`, and `SavedLayouts`. Every mutation goes through the `DataManager` service and triggers a re-render.
|
|
36
|
-
|
|
37
|
-
### Custom Card Types
|
|
38
|
-
|
|
39
|
-
Developers define reusable node types by extending `PictFlowCard`. Each card declares its title, ports, category, appearance, and optional properties panel. Cards register with the flow view's `NodeTypeProvider` and appear in the toolbar palette.
|
|
40
|
-
|
|
41
|
-
### Properties Panels
|
|
42
|
-
|
|
43
|
-
Nodes can open floating panels tethered to them by a line. Four built-in panel types cover common needs -- Template, Markdown, Form, and View -- or you can create custom panel types by extending `PictFlowCardPropertiesPanel`.
|
|
44
|
-
|
|
45
|
-
### Theming
|
|
46
|
-
|
|
47
|
-
Six built-in themes ship with the module. The theme system is CSS-variable-based: override any of 70+ `--pf-*` design tokens on `.pict-flow-container` to customize colors, shadows, radii, and typography without touching source code.
|
|
48
|
-
|
|
49
|
-
### Event Hooks
|
|
50
|
-
|
|
51
|
-
The `EventHandlerProvider` exposes 20+ named events (node selected, connection created, flow changed, theme changed, etc.). Register handlers to build integrations, undo/redo stacks, or server sync without modifying core code.
|
|
52
|
-
|
|
53
|
-
## Quick Example
|
|
54
|
-
|
|
55
|
-
```javascript
|
|
56
|
-
const libPictSectionFlow = require('pict-section-flow');
|
|
57
|
-
const libPict = require('pict');
|
|
58
|
-
|
|
59
|
-
let _Pict = new libPict({ Product: 'FlowDemo' });
|
|
60
|
-
|
|
61
|
-
_Pict.addView('MyFlow', {}, libPictSectionFlow);
|
|
62
|
-
|
|
63
|
-
let tmpFlow = _Pict.views.MyFlow;
|
|
64
|
-
|
|
65
|
-
// Add two nodes
|
|
66
|
-
let tmpStart = tmpFlow.addNode('start', 50, 150, 'Begin');
|
|
67
|
-
let tmpEnd = tmpFlow.addNode('end', 400, 150, 'Done');
|
|
68
|
-
|
|
69
|
-
// Connect them
|
|
70
|
-
tmpFlow.addConnection(
|
|
71
|
-
tmpStart.Hash, tmpStart.Ports[0].Hash,
|
|
72
|
-
tmpEnd.Hash, tmpEnd.Ports[0].Hash
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// Listen for changes
|
|
76
|
-
tmpFlow._EventHandlerProvider.registerHandler('onFlowChanged',
|
|
77
|
-
(pFlowData) =>
|
|
78
|
-
{
|
|
79
|
-
console.log('Flow updated:', pFlowData.Nodes.length, 'nodes');
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Learn More
|
|
84
|
-
|
|
85
|
-
- **[Getting Started](Getting_Started.md)** -- Build your first flow diagram in five minutes
|
|
86
|
-
- **[Architecture](Architecture.md)** -- Detailed service/provider design with data flow diagrams
|
|
87
|
-
- **[Implementation Reference](Implementation_Reference.md)** -- Complete API surface for every service and provider
|
|
88
|
-
- **[Custom Styling](Custom-Styling.md)** -- CSS custom properties reference and theme API
|
|
89
|
-
- **[Layout Persistence](Layout_Persistence.md)** -- Save and restore layouts with localStorage or REST
|
|
90
|
-
|
|
91
|
-
## Ecosystem
|
|
92
|
-
|
|
93
|
-
Pict-Section-Flow is part of the [Retold](https://github.com/stevenvelozo/retold) module suite:
|
|
94
|
-
|
|
95
|
-
- [pict](https://fable-retold.github.io/pict/) -- Core MVC application framework
|
|
96
|
-
- [pict-view](https://fable-retold.github.io/pict-view/) -- View base class
|
|
97
|
-
- [pict-provider](https://fable-retold.github.io/pict-provider/) -- Provider base class
|
|
98
|
-
- [pict-section-form](https://fable-retold.github.io/pict-section-form/) -- Form sections (used for Form panel type)
|
|
99
|
-
- [fable](https://fable-retold.github.io/fable/) -- Service infrastructure and dependency injection
|
|
100
|
-
|
|
101
|
-
## License
|
|
102
|
-
|
|
103
|
-
MIT
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# Theme integration
|
|
2
|
-
|
|
3
|
-
`pict-section-flow` participates in the host application's theme system in two layers:
|
|
4
|
-
|
|
5
|
-
1. **Host theme (light/dark/palette)** - provided by `pict-provider-theme` via `--theme-color-*` CSS custom properties on `:root` and a `theme-light` / `theme-dark` class on `<html>`.
|
|
6
|
-
2. **Flow visual theme (sketch, blueprint, mono, retro-80s, retro-90s, whiteboard, default)** - provided by the editor's own `PictProvider-Flow-Theme` and applied as scope-local overrides on `.pict-flow-container`.
|
|
7
|
-
|
|
8
|
-
Both layers cooperate. The flow editor's `--pf-*` tokens default to the matching `--theme-color-*` token, so when the host swaps light/dark or palette, all neutral flow chrome (panels, toolbars, text, connections, grid) updates with no JS work. Visual themes that intentionally diverge from the host palette (e.g. blueprint's deep blue canvas, retro-80s neon) override the relevant `--pf-*` tokens explicitly.
|
|
9
|
-
|
|
10
|
-
## Host wiring
|
|
11
|
-
|
|
12
|
-
When a host application registers `pict-provider-theme`:
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
const libPictProviderTheme = require('pict-provider-theme');
|
|
16
|
-
pict.addProvider('Theme', libPictProviderTheme.default_configuration, libPictProviderTheme);
|
|
17
|
-
pict.providers.Theme.registerTheme(require('pict-provider-theme/source/themes/pict-default.json'));
|
|
18
|
-
pict.providers.Theme.applyTheme('pict-default', 'system');
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
...the flow editor automatically detects it during `onBeforeInitialize` (duck-typed via `applyTheme`/`onApply`/`listThemes`) and subscribes to its `onApply` hook. On every host theme change the editor:
|
|
22
|
-
|
|
23
|
-
- Re-runs `_CSSProvider.registerCSS()` so CSS layered on top by the active flow visual theme stays in the cascade.
|
|
24
|
-
- Calls `_reinjectMarkerDefs()` so SVG `<marker>` arrowhead polygons rebuild with the new fills.
|
|
25
|
-
- Calls `renderFlow()` to repaint nodes/connections (so any inline-rendered colors refresh).
|
|
26
|
-
|
|
27
|
-
No code changes are required in host apps beyond installing and applying `pict-provider-theme` as you would for any other consumer.
|
|
28
|
-
|
|
29
|
-
## Token mapping
|
|
30
|
-
|
|
31
|
-
| Flow token (`--pf-...`) | Host token (`--theme-color-...`) | Hardcoded fallback |
|
|
32
|
-
|---|---|---|
|
|
33
|
-
| `--pf-text-primary` | `text-primary` | `#2c3e50` |
|
|
34
|
-
| `--pf-text-secondary` | `text-secondary` | `#7f8c8d` |
|
|
35
|
-
| `--pf-text-tertiary` | `text-muted` | `#8e99a4` |
|
|
36
|
-
| `--pf-node-body-fill` | `background-panel` | `#ffffff` |
|
|
37
|
-
| `--pf-node-body-stroke` | `border-default` | `#d0d4d8` |
|
|
38
|
-
| `--pf-node-body-stroke-hover` | `border-strong` | `#b0b8c0` |
|
|
39
|
-
| `--pf-node-selected-stroke` | `brand-primary` | `#3498db` |
|
|
40
|
-
| `--pf-node-shadow` (and hover/dragging) | `shadow-color` | `rgba(0,0,0,0.10)` |
|
|
41
|
-
| `--pf-port-input-fill` | `status-info` | `#3498db` |
|
|
42
|
-
| `--pf-port-output-fill` | `status-success` | `#2ecc71` |
|
|
43
|
-
| `--pf-port-error-fill` | `status-error` | `#e74c3c` |
|
|
44
|
-
| `--pf-connection-stroke` | `border-strong` | `#95a5a6` |
|
|
45
|
-
| `--pf-connection-selected-stroke` | `brand-primary` | `#3498db` |
|
|
46
|
-
| `--pf-panel-bg` | `background-panel` | `#ffffff` |
|
|
47
|
-
| `--pf-panel-titlebar-bg` | `background-secondary` | `#f7f8fa` |
|
|
48
|
-
| `--pf-toolbar-bg` | `background-panel` | `#ffffff` |
|
|
49
|
-
| `--pf-toolbar-border` | `border-default` | `#e0e0e0` |
|
|
50
|
-
| `--pf-canvas-bg` | `background-secondary` | `#fafafa` |
|
|
51
|
-
| `--pf-grid-stroke` | `border-light` | `#e8e8e8` |
|
|
52
|
-
| `--pf-input-border` | `border-default` | `#d5d8dc` |
|
|
53
|
-
| `--pf-input-border-focus` | `focus-outline` | `#3498db` |
|
|
54
|
-
|
|
55
|
-
Tokens not in this list (e.g. node-variant fills, Chart.js-style category colors) keep hardcoded values because they aren't conventionally part of host palettes.
|
|
56
|
-
|
|
57
|
-
## Card color roles
|
|
58
|
-
|
|
59
|
-
Card types and individual nodes can opt into a **color role** that tracks the host theme automatically. Roles are class-driven, so changing the host theme repaints every card using that role with no JS work.
|
|
60
|
-
|
|
61
|
-
### Available roles
|
|
62
|
-
|
|
63
|
-
| Role | Tracks | Typical use |
|
|
64
|
-
|---|---|---|
|
|
65
|
-
| `success` | `--theme-color-status-success` | Start, success, complete |
|
|
66
|
-
| `warning` | `--theme-color-status-warning` | Decision, caution, conditional |
|
|
67
|
-
| `error` | `--theme-color-status-error` | Halt, error, abort |
|
|
68
|
-
| `info` | `--theme-color-status-info` | Informational, log, debug |
|
|
69
|
-
| `accent` | `--theme-color-brand-accent` | End, brand-flavored highlights |
|
|
70
|
-
| `neutral` | `--theme-color-text-primary` + `--theme-color-background-panel` | Default, generic |
|
|
71
|
-
|
|
72
|
-
Each role exposes `--pf-color-<role>` (the strong/title-bar color) and `--pf-color-<role>-soft` (a tinted body fill computed via `color-mix(...)` against the strong color). Hosts can override either token at any scope to retint a role globally.
|
|
73
|
-
|
|
74
|
-
### Built-in node types
|
|
75
|
-
|
|
76
|
-
The five default node types ship with roles wired up:
|
|
77
|
-
|
|
78
|
-
| Type | Role |
|
|
79
|
-
|---|---|
|
|
80
|
-
| `default` | `neutral` |
|
|
81
|
-
| `start` | `success` |
|
|
82
|
-
| `end` | `accent` |
|
|
83
|
-
| `halt` | `error` |
|
|
84
|
-
| `decision` | `warning` |
|
|
85
|
-
|
|
86
|
-
Their hex `TitleBarColor` / `BodyStyle` fields remain as fallbacks for code paths that bypass CSS (legacy consumers, exports). When the role's CSS class is in effect, those hex presentation attributes are overridden by the role rules - host themes propagate, but the hex values keep the editor presentable in unstyled contexts.
|
|
87
|
-
|
|
88
|
-
### Custom card types
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
flowView._NodeTypeProvider.registerNodeType('my-card-type', {
|
|
92
|
-
Hash: 'my-card-type',
|
|
93
|
-
Label: 'My Card',
|
|
94
|
-
DefaultPorts: [ /* ... */ ],
|
|
95
|
-
ColorRole: 'info', // theme-aware
|
|
96
|
-
TitleBarColor: '#3498db', // optional fallback
|
|
97
|
-
BodyStyle: { fill: '#ebf5fb' } // optional fallback
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
The renderer adds `pict-flow-node-color-info` to the node group; CSS handles the rest.
|
|
102
|
-
|
|
103
|
-
### Per-node overrides
|
|
104
|
-
|
|
105
|
-
A specific card can override the role its type defines:
|
|
106
|
-
|
|
107
|
-
```javascript
|
|
108
|
-
flowData.Nodes.push({
|
|
109
|
-
Hash: 'node-special',
|
|
110
|
-
Type: 'my-card-type',
|
|
111
|
-
ColorRole: 'warning', // override the type's role
|
|
112
|
-
// ...
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Set `ColorRole: 'none'` on a specific node to opt out of role styling entirely (useful when keeping a custom hex via `Style.BodyFill` etc.).
|
|
117
|
-
|
|
118
|
-
### Custom roles
|
|
119
|
-
|
|
120
|
-
To define new roles, add `--pf-color-<role>` / `--pf-color-<role>-soft` tokens at `.pict-flow-container` scope and matching `.pict-flow-node-color-<role>` CSS rules in your host stylesheet:
|
|
121
|
-
|
|
122
|
-
```css
|
|
123
|
-
.pict-flow-container {
|
|
124
|
-
--pf-color-experimental: var(--theme-color-brand-primary, #6b8eff);
|
|
125
|
-
--pf-color-experimental-soft: color-mix(in srgb, var(--pf-color-experimental) 14%, transparent);
|
|
126
|
-
}
|
|
127
|
-
.pict-flow-node-color-experimental .pict-flow-node-body {
|
|
128
|
-
fill: var(--pf-color-experimental-soft);
|
|
129
|
-
stroke: var(--pf-color-experimental);
|
|
130
|
-
stroke-width: 1.5;
|
|
131
|
-
}
|
|
132
|
-
.pict-flow-node-color-experimental .pict-flow-node-title-bar,
|
|
133
|
-
.pict-flow-node-color-experimental .pict-flow-node-title-bar-bottom {
|
|
134
|
-
fill: var(--pf-color-experimental);
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Arrowhead markers
|
|
139
|
-
|
|
140
|
-
`<marker>` elements live inside `<defs>` and don't pick up the same CSS variable cascade as regular SVG content in every browser. To make them theme-tracking, each generated polygon now carries a class (`pict-flow-arrowhead-default`, `pict-flow-arrowhead-selected`, `pict-flow-arrowhead-event-in`, ...) and the corresponding CSS rule sets `fill` to the matching `--pf-...` token. The `fill="..."` attribute remains on the polygon as a graceful fallback when CSS can't reach it.
|
|
141
|
-
|
|
142
|
-
## Flow visual themes
|
|
143
|
-
|
|
144
|
-
The seven flow themes (`default`, `sketch`, `blueprint`, `mono`, `retro-80s`, `retro-90s`, `whiteboard`) ship with explicit `CSSVariables` and `AdditionalCSS` blocks. They layer on top of the host theme by emitting their overrides into `.pict-flow-container { ... }`. Because `:root`-scoped host tokens have lower specificity than `.pict-flow-container`-scoped flow tokens, the visual theme always wins where it sets a value, and the host theme controls everything it doesn't.
|
|
145
|
-
|
|
146
|
-
The `default` flow theme intentionally sets no overrides - it lets the host theme drive the look.
|
|
147
|
-
|
|
148
|
-
## Disabling host integration
|
|
149
|
-
|
|
150
|
-
If a host wants the flow editor to ignore the host theme (e.g. to keep a fixed Sketch-style appearance regardless of the surrounding page), don't apply a host theme provider - or unsubscribe after construction by calling the dispose function returned via `flowView._HostThemeUnsubscribe`. This is rarely needed; flow visual themes already win where they care.
|
package/docs/_brand.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Hash": "pict-section-flow",
|
|
3
|
-
"Name": "Pict Section Flow",
|
|
4
|
-
"Tagline": "Flow diagram section for visual workflow and process representations",
|
|
5
|
-
"Palette": "mix",
|
|
6
|
-
"Icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"frame-pict-section-flow-filled-light\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#36d1d8\"/>\n\t\t<g clip-path=\"url(#frame-pict-section-flow-filled-light)\"><path d=\"M 16 26 L 48 66 L 80 26 Z\" fill=\"rgba(255,255,255,0.18)\"/>\n\t\t\t\t\t<path d=\"M 24 16 L 48 44 L 72 16 Z\" fill=\"#dc9958\" opacity=\"0.9\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"28\" font-weight=\"600\"\n\t\t\tfill=\"#ffffff\" letter-spacing=\"-1\">PSF</text>\n\t</svg>",
|
|
7
|
-
"IconType": "svg",
|
|
8
|
-
"Favicon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"fav-pict-section-flow-light\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#36d1d8\"/>\n\t\t<g clip-path=\"url(#fav-pict-section-flow-light)\"><path d=\"M 16 26 L 48 66 L 80 26 Z\" fill=\"rgba(255,255,255,0.22)\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"60\" font-weight=\"800\"\n\t\t\tfill=\"#ffffff\" letter-spacing=\"-1\">P</text>\n\t</svg>",
|
|
9
|
-
"FaviconDark": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\" width=\"96\" height=\"96\">\n\t\t<defs>\n\t\t\t<clipPath id=\"fav-pict-section-flow-dark\">\n\t\t\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\"/>\n\t\t\t</clipPath>\n\t\t</defs>\n\t\t<path d=\"M 2 48\n\t\t\tC 2 18.0222416, 18.0222416 2, 48 2\n\t\t\tC 77.9777584 2, 94 18.0222416, 94 48\n\t\t\tC 94 77.9777584, 77.9777584 94, 48 94\n\t\t\tC 18.0222416 94, 2 77.9777584, 2 48 Z\" fill=\"#87dfe2\"/>\n\t\t<g clip-path=\"url(#fav-pict-section-flow-dark)\"><path d=\"M 16 26 L 48 66 L 80 26 Z\" fill=\"rgba(255,255,255,0.22)\"/></g>\n\t\t<text x=\"48\" y=\"50\" text-anchor=\"middle\" dominant-baseline=\"central\"\n\t\t\tfont-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\"\n\t\t\tfont-size=\"60\" font-weight=\"800\"\n\t\t\tfill=\"#101418\" letter-spacing=\"-1\">P</text>\n\t</svg>",
|
|
10
|
-
"Colors": {
|
|
11
|
-
"Primary": "#36d1d8",
|
|
12
|
-
"Secondary": "#dc9958",
|
|
13
|
-
"PrimaryLight": "#36d1d8",
|
|
14
|
-
"PrimaryDark": "#87dfe2",
|
|
15
|
-
"SecondaryLight": "#dc9958",
|
|
16
|
-
"SecondaryDark": "#e9c7a7"
|
|
17
|
-
}
|
|
18
|
-
}
|
package/docs/_cover.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Pict-Section-Flow
|
|
2
|
-
|
|
3
|
-
> Interactive flow diagram section view for the Pict application framework
|
|
4
|
-
|
|
5
|
-
- Node-based graph editor with typed ports and bezier connections
|
|
6
|
-
- Custom card types, properties panels, and event hooks
|
|
7
|
-
- Six built-in themes with 70+ CSS design tokens
|
|
8
|
-
- Layout persistence to localStorage or any backend
|
|
9
|
-
|
|
10
|
-
[GitHub](https://github.com/fable-retold/pict-section-flow)
|
|
11
|
-
[Get Started](#pict-section-flow)
|
|
12
|
-
|
|
13
|
-
<!-- docuserve:examples:start -->
|
|
14
|
-
| Example | Complexity | Launch |
|
|
15
|
-
|---------|------------|--------|
|
|
16
|
-
| [Simple Cards](examples/simple%5Fcards/README.md) | Basic | [Launch](examples/simple%5Fcards/index.html) |
|
|
17
|
-
<!-- docuserve:examples:end -->
|
package/docs/_playground.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Kind": "section",
|
|
3
|
-
"WrapperKind": "view",
|
|
4
|
-
"SectionType": "pict-section-flow",
|
|
5
|
-
"ApplicationModule": "PictSectionFlow",
|
|
6
|
-
"ApplicationGlobal": "PictSectionFlow",
|
|
7
|
-
"ViewName": "Flow",
|
|
8
|
-
"ViewConfigKey": "FlowViewConfig",
|
|
9
|
-
"ManifestKey": "DefaultFlowManifest",
|
|
10
|
-
"Editors":
|
|
11
|
-
[
|
|
12
|
-
{ "Hash": "pictConfig", "Label": "Pict Config", "Language": "json", "DefaultPath": "playground/pict.json" },
|
|
13
|
-
{ "Hash": "appConfig", "Label": "App Config", "Language": "json", "DefaultPath": "playground/app.json" },
|
|
14
|
-
{ "Hash": "appData", "Label": "Initial AppData", "Language": "json", "DefaultPath": "playground/appdata.json" },
|
|
15
|
-
{ "Hash": "application", "Label": "Application Code", "Language": "javascript", "DefaultPath": "playground/application.js" }
|
|
16
|
-
],
|
|
17
|
-
"Imports":
|
|
18
|
-
[
|
|
19
|
-
{ "Name": "pict", "Source": "local", "Path": "playground/runtime/pict.min.js" },
|
|
20
|
-
{ "Name": "pict-application", "Source": "local", "Path": "playground/runtime/pict-application.min.js" },
|
|
21
|
-
{ "Name": "pict-section-modal", "Source": "local", "Path": "playground/runtime/pict-section-modal.min.js" },
|
|
22
|
-
{ "Name": "pict-section-flow", "Source": "local", "Path": "playground/runtime/pict-section-flow.min.js" }
|
|
23
|
-
]
|
|
24
|
-
}
|
package/docs/_sidebar.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
- Getting Started
|
|
2
|
-
|
|
3
|
-
- [Overview](/)
|
|
4
|
-
- [Quick Start](Getting_Started.md)
|
|
5
|
-
- [Custom Styling](Custom-Styling.md)
|
|
6
|
-
- [Theme Integration](Theme_Integration.md)
|
|
7
|
-
|
|
8
|
-
- Architecture
|
|
9
|
-
|
|
10
|
-
- [Design Overview](Architecture.md)
|
|
11
|
-
- [Data Model](Data_Model.md)
|
|
12
|
-
- [Event System](Event_System.md)
|
|
13
|
-
|
|
14
|
-
- Reference
|
|
15
|
-
|
|
16
|
-
- [Implementation Reference](Implementation_Reference.md)
|
|
17
|
-
- [Layout Persistence](Layout_Persistence.md)
|
|
18
|
-
|
|
19
|
-
- API -- Data Management
|
|
20
|
-
|
|
21
|
-
- [addNode](api/addNode.md)
|
|
22
|
-
- [removeNode](api/removeNode.md)
|
|
23
|
-
- [addConnection](api/addConnection.md)
|
|
24
|
-
- [removeConnection](api/removeConnection.md)
|
|
25
|
-
- [getFlowData / setFlowData](api/getFlowData.md)
|
|
26
|
-
- [marshalToView / marshalFromView](api/marshalToView.md)
|
|
27
|
-
|
|
28
|
-
- API -- Selection & Viewport
|
|
29
|
-
|
|
30
|
-
- [selectNode / deselectAll](api/selectNode.md)
|
|
31
|
-
- [setZoom / zoomToFit](api/setZoom.md)
|
|
32
|
-
- [autoLayout](api/autoLayout.md)
|
|
33
|
-
- [screenToSVGCoords](api/screenToSVGCoords.md)
|
|
34
|
-
- [toggleFullscreen](api/toggleFullscreen.md)
|
|
35
|
-
|
|
36
|
-
- API -- Panels
|
|
37
|
-
|
|
38
|
-
- [openPanel / closePanel / togglePanel](api/openPanel.md)
|
|
39
|
-
|
|
40
|
-
- API -- Theming & Events
|
|
41
|
-
|
|
42
|
-
- [setTheme / registerTheme](api/setTheme.md)
|
|
43
|
-
- [registerHandler / fireEvent](api/registerHandler.md)
|
|
44
|
-
|
|
45
|
-
- API -- Layout Persistence
|
|
46
|
-
|
|
47
|
-
- [saveLayout / restoreLayout](api/saveLayout.md)
|
|
48
|
-
|
|
49
|
-
- API -- Extension Points
|
|
50
|
-
|
|
51
|
-
- [PictFlowCard](api/PictFlowCard.md)
|
|
52
|
-
- [PictFlowCardPropertiesPanel](api/PictFlowCardPropertiesPanel.md)
|
|
53
|
-
- [registerNodeType](api/registerNodeType.md)
|
|
54
|
-
|
|
55
|
-
- Examples
|
|
56
|
-
|
|
57
|
-
- [Simple Cards](#/page/examples/simple_cards/README)
|
package/docs/_topbar.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Pict Section Flow
|
|
2
|
-
|
|
3
|
-
- [Overview](README.md)
|
|
4
|
-
- [Getting Started](Getting_Started.md)
|
|
5
|
-
- [Architecture](Architecture.md)
|
|
6
|
-
- [API Reference](Implementation_Reference.md)
|
|
7
|
-
- [Custom Styling](Custom-Styling.md)
|
|
8
|
-
- [GitHub](https://github.com/fable-retold/pict-section-flow)
|
package/docs/_version.json
DELETED
package/docs/api/PictFlowCard.md
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
# PictFlowCard
|
|
2
|
-
|
|
3
|
-
Base class for defining reusable flow diagram node types. Extend this class to create custom cards that appear in the toolbar palette. Each card declares its title, ports, category, appearance, and optional properties panel.
|
|
4
|
-
|
|
5
|
-
## Import
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Constructor
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
class MyCard extends libPictFlowCard
|
|
15
|
-
{
|
|
16
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
17
|
-
{
|
|
18
|
-
super(pFable, Object.assign({},
|
|
19
|
-
{
|
|
20
|
-
Title: 'My Card',
|
|
21
|
-
Code: 'MC',
|
|
22
|
-
// ... options
|
|
23
|
-
}, pOptions), pServiceHash);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Configuration Options
|
|
29
|
-
|
|
30
|
-
| Property | Type | Default | Description |
|
|
31
|
-
|----------|------|---------|-------------|
|
|
32
|
-
| `Title` | string | `'Card'` | Display name on the node title bar |
|
|
33
|
-
| `Name` | string | `false` | Longer descriptive name |
|
|
34
|
-
| `Code` | string | `''` | Short identifier used as the node type key |
|
|
35
|
-
| `Description` | string | `false` | Brief explanation of the card's purpose |
|
|
36
|
-
| `Icon` | string | `false` | Icon identifier or emoji |
|
|
37
|
-
| `PreviewImage` | string | `false` | URL to a preview thumbnail |
|
|
38
|
-
| `Documentation` | string | `false` | URL or inline documentation text |
|
|
39
|
-
| `Tooltip` | string | `false` | Hover tooltip text |
|
|
40
|
-
| `Help` | string | `false` | HTML help content for the Help tab |
|
|
41
|
-
| `Category` | string | `'General'` | Palette grouping category |
|
|
42
|
-
| `Enabled` | boolean | `true` | Whether the card appears in the palette |
|
|
43
|
-
| `TitleBarColor` | string | `'#2c3e50'` | Title bar background color |
|
|
44
|
-
| `BodyStyle` | object | `{}` | SVG style attributes for the node body |
|
|
45
|
-
| `Width` | number | `180` | Default node width in pixels |
|
|
46
|
-
| `Height` | number | `80` | Default node height in pixels |
|
|
47
|
-
|
|
48
|
-
### Port Options
|
|
49
|
-
|
|
50
|
-
| Property | Type | Default | Description |
|
|
51
|
-
|----------|------|---------|-------------|
|
|
52
|
-
| `Inputs` | array | `[]` | Input port definitions |
|
|
53
|
-
| `Outputs` | array | `[]` | Output port definitions |
|
|
54
|
-
|
|
55
|
-
Each port object:
|
|
56
|
-
|
|
57
|
-
| Property | Type | Default | Description |
|
|
58
|
-
|----------|------|---------|-------------|
|
|
59
|
-
| `Name` | string | Required | Port label |
|
|
60
|
-
| `Side` | string | `'left'`/`'right'` | Port side: `'left'`, `'right'`, `'top'`, `'bottom'` |
|
|
61
|
-
| `MinimumInputCount` | number | `0` | Minimum required connections (inputs only) |
|
|
62
|
-
| `MaximumInputCount` | number | `-1` | Maximum allowed connections (-1 = unlimited, inputs only) |
|
|
63
|
-
| `PortType` | string | -- | Type for styling: `'event'`, `'setting'`, `'value'`, `'error'` |
|
|
64
|
-
| `DataType` | string | -- | Semantic data type (for validation/display) |
|
|
65
|
-
|
|
66
|
-
### Label Display Options
|
|
67
|
-
|
|
68
|
-
| Property | Type | Default | Description |
|
|
69
|
-
|----------|------|---------|-------------|
|
|
70
|
-
| `ShowTypeLabel` | boolean | `true` | Show the type code badge on hover |
|
|
71
|
-
| `PortLabelsOnHover` | boolean | `false` | Only show port labels on hover |
|
|
72
|
-
| `PortLabelsVertical` | boolean | `false` | Render port labels vertically |
|
|
73
|
-
| `PortLabelPadding` | boolean | `false` | Extra spacing to avoid overlap |
|
|
74
|
-
| `PortLabelsOutside` | boolean | `false` | Render labels outside the node body |
|
|
75
|
-
| `LabelsInFront` | boolean | `true` | Labels render in front of body content |
|
|
76
|
-
|
|
77
|
-
### Properties Panel Configuration
|
|
78
|
-
|
|
79
|
-
| Property | Type | Description |
|
|
80
|
-
|----------|------|-------------|
|
|
81
|
-
| `PropertiesPanel.PanelType` | string | `'Template'`, `'Markdown'`, `'Form'`, or `'View'` |
|
|
82
|
-
| `PropertiesPanel.DefaultWidth` | number | Panel width in pixels |
|
|
83
|
-
| `PropertiesPanel.DefaultHeight` | number | Panel height in pixels |
|
|
84
|
-
| `PropertiesPanel.Title` | string | Panel title bar text |
|
|
85
|
-
| `PropertiesPanel.Configuration` | object | Panel-type-specific config |
|
|
86
|
-
|
|
87
|
-
### Body Content Configuration
|
|
88
|
-
|
|
89
|
-
| Property | Type | Description |
|
|
90
|
-
|----------|------|-------------|
|
|
91
|
-
| `BodyContent.ContentType` | string | `'svg'`, `'html'`, or `'canvas'` |
|
|
92
|
-
| `BodyContent.Template` | string | Pict template string |
|
|
93
|
-
| `BodyContent.TemplateHash` | string | Registered template hash (overrides Template) |
|
|
94
|
-
| `BodyContent.Templates` | array | Templates to auto-register: `[{ Hash, Template }]` |
|
|
95
|
-
| `BodyContent.RenderCallback` | function | Imperative render callback for canvas mode |
|
|
96
|
-
| `BodyContent.Padding` | number | Inner padding in pixels |
|
|
97
|
-
|
|
98
|
-
## Methods
|
|
99
|
-
|
|
100
|
-
### getNodeTypeConfiguration()
|
|
101
|
-
|
|
102
|
-
Generate the configuration object for the NodeTypes provider.
|
|
103
|
-
|
|
104
|
-
**Returns:** Node type configuration object.
|
|
105
|
-
|
|
106
|
-
### registerWithFlowView(pFlowView)
|
|
107
|
-
|
|
108
|
-
Register this card with a flow view's node type provider.
|
|
109
|
-
|
|
110
|
-
| Parameter | Type | Description |
|
|
111
|
-
|-----------|------|-------------|
|
|
112
|
-
| `pFlowView` | PictViewFlow | The flow view instance |
|
|
113
|
-
|
|
114
|
-
**Returns:** `boolean` -- whether registration succeeded.
|
|
115
|
-
|
|
116
|
-
## Examples
|
|
117
|
-
|
|
118
|
-
### Minimal card
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
class LogCard extends libPictFlowCard
|
|
122
|
-
{
|
|
123
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
124
|
-
{
|
|
125
|
-
super(pFable, Object.assign({},
|
|
126
|
-
{
|
|
127
|
-
Title: 'Log',
|
|
128
|
-
Code: 'LOG',
|
|
129
|
-
Inputs: [{ Name: 'Data', Side: 'left' }],
|
|
130
|
-
Outputs: [{ Name: 'Pass', Side: 'right' }]
|
|
131
|
-
}, pOptions), pServiceHash);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Card with typed ports and properties panel
|
|
137
|
-
|
|
138
|
-
```javascript
|
|
139
|
-
class IfThenElseCard extends libPictFlowCard
|
|
140
|
-
{
|
|
141
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
142
|
-
{
|
|
143
|
-
super(pFable, Object.assign({},
|
|
144
|
-
{
|
|
145
|
-
Title: 'If-Then-Else',
|
|
146
|
-
Code: 'ITE',
|
|
147
|
-
Category: 'Control Flow',
|
|
148
|
-
Description: 'Route flow based on a boolean condition',
|
|
149
|
-
TitleBarColor: '#e67e22',
|
|
150
|
-
Width: 160,
|
|
151
|
-
Height: 90,
|
|
152
|
-
Inputs:
|
|
153
|
-
[
|
|
154
|
-
{ Name: 'Condition', Side: 'left', PortType: 'value' }
|
|
155
|
-
],
|
|
156
|
-
Outputs:
|
|
157
|
-
[
|
|
158
|
-
{ Name: 'Then', Side: 'right', PortType: 'event' },
|
|
159
|
-
{ Name: 'Else', Side: 'bottom', PortType: 'error' }
|
|
160
|
-
],
|
|
161
|
-
PropertiesPanel:
|
|
162
|
-
{
|
|
163
|
-
PanelType: 'Markdown',
|
|
164
|
-
Title: 'If-Then-Else',
|
|
165
|
-
DefaultWidth: 280,
|
|
166
|
-
DefaultHeight: 150,
|
|
167
|
-
Configuration:
|
|
168
|
-
{
|
|
169
|
-
Markdown: '## Conditional Branch\nRoutes flow based on a boolean condition.'
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}, pOptions), pServiceHash);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Card with custom SVG body content
|
|
178
|
-
|
|
179
|
-
```javascript
|
|
180
|
-
class SparklineCard extends libPictFlowCard
|
|
181
|
-
{
|
|
182
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
183
|
-
{
|
|
184
|
-
super(pFable, Object.assign({},
|
|
185
|
-
{
|
|
186
|
-
Title: 'Sparkline',
|
|
187
|
-
Code: 'SPARK',
|
|
188
|
-
Category: 'Visualization',
|
|
189
|
-
Width: 200,
|
|
190
|
-
Height: 100,
|
|
191
|
-
Inputs: [{ Name: 'Values', Side: 'left', PortType: 'value' }],
|
|
192
|
-
BodyContent:
|
|
193
|
-
{
|
|
194
|
-
ContentType: 'svg',
|
|
195
|
-
Template: '<polyline points="0,50 20,30 40,45 60,10 80,35 100,20" fill="none" stroke="#3498db" stroke-width="2" />'
|
|
196
|
-
}
|
|
197
|
-
}, pOptions), pServiceHash);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### Registration
|
|
203
|
-
|
|
204
|
-
```javascript
|
|
205
|
-
let tmpCard = new IfThenElseCard(_Pict, {});
|
|
206
|
-
tmpCard.registerWithFlowView(flowView);
|
|
207
|
-
|
|
208
|
-
// The card now appears in the toolbar palette under "Control Flow"
|
|
209
|
-
// Users can drag it onto the canvas to create new ITE nodes
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
## See Also
|
|
213
|
-
|
|
214
|
-
- [registerNodeType](registerNodeType.md) -- Register types directly without PictFlowCard
|
|
215
|
-
- [PictFlowCardPropertiesPanel](PictFlowCardPropertiesPanel.md) -- Custom panel types
|
|
216
|
-
- [addNode](addNode.md) -- Create nodes from registered types
|