pict-section-flow 0.0.12 → 0.0.13
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/.claude/launch.json +1 -1
- package/README.md +19 -0
- package/docs/Data_Model.md +158 -0
- package/docs/Event_System.md +156 -0
- package/docs/_sidebar.md +9 -4
- package/docs/card-help/EACH.md +19 -0
- package/docs/card-help/FREAD.md +24 -0
- package/docs/card-help/FWRITE.md +24 -0
- package/docs/card-help/GET.md +22 -0
- package/docs/card-help/ITE.md +23 -0
- package/docs/card-help/LOG.md +23 -0
- package/docs/card-help/NOTE.md +17 -0
- package/docs/card-help/PREV.md +18 -0
- package/docs/card-help/SET.md +27 -0
- package/docs/card-help/SPKL.md +22 -0
- package/docs/card-help/STAT.md +23 -0
- package/docs/card-help/SW.md +25 -0
- package/docs/retold-catalog.json +24 -1
- package/docs/retold-keyword-index.json +6585 -2179
- package/example_applications/simple_cards/package.json +1 -0
- package/example_applications/simple_cards/source/card-help-content.js +16 -0
- package/example_applications/simple_cards/source/cards/FlowCard-Comment.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-DataPreview.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-Each.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-FileRead.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-FileWrite.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-GetValue.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-IfThenElse.js +2 -1
- package/example_applications/simple_cards/source/cards/FlowCard-LogValues.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-SetValue.js +2 -1
- package/example_applications/simple_cards/source/cards/FlowCard-Sparkline.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-StatusMonitor.js +2 -0
- package/example_applications/simple_cards/source/cards/FlowCard-Switch.js +2 -0
- package/package.json +4 -2
- package/scripts/generate-card-help.js +214 -0
- package/source/providers/PictProvider-Flow-CSS.js +3 -5
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"main": "source/Pict-Application-FlowExample.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node source/Pict-Application-FlowExample.js",
|
|
8
|
+
"prebuild": "node ../../scripts/generate-card-help.js",
|
|
8
9
|
"build": "npx quack build && npx quack copy",
|
|
9
10
|
"test": "echo \"Error: no test specified\" && exit 0"
|
|
10
11
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Auto-generated by scripts/generate-card-help.js — do not edit manually.
|
|
2
|
+
// Source markdown files are in docs/card-help/
|
|
3
|
+
module.exports = {
|
|
4
|
+
"EACH": "<h1>Each (Loop Iterator)</h1><p>The <b>Each</b> node iterates over a collection, executing connected downstream nodes once for each item. When iteration completes, the <b>Done</b> output fires.</p><h2>Ports</h2><ul><li><b>Collection</b> (input) — an array or iterable to loop over</li><li><b>Item</b> (output) — fires once per element with the current item</li><li><b>Done</b> (output) — fires after all items have been processed</li></ul><h2>Behavior</h2><p>When a collection arrives at the input port, the Each node processes items sequentially. For every element in the collection, the <b>Item</b> output is activated with the current element as the payload. After the final element is processed, the <b>Done</b> output fires to signal completion.</p><h2>Tips</h2><ul><li>Connect <b>Item</b> to a processing chain and <b>Done</b> to continuation logic</li><li>Nested loops are supported by chaining multiple Each nodes</li><li>Empty collections skip directly to the <b>Done</b> output</li></ul>",
|
|
5
|
+
"FREAD": "<h1>File Read</h1><p>The <b>File Read</b> node reads the contents of a file from the filesystem and outputs the data.</p><h2>Ports</h2><ul><li><b>Path</b> (input) — the filesystem path to read</li><li><b>Data</b> (output) — the file contents on success</li><li><b>Error</b> (output) — fires if the read operation fails</li></ul><h2>Properties</h2><ul><li><b>FilePath</b> — the path to the file to read</li><li><b>Encoding</b> — character encoding for text files (e.g. <code>utf8</code>, <code>ascii</code>)</li></ul><h2>Behavior</h2><p>When triggered, the node reads the file at the configured path. On success, the raw file contents are emitted from the <b>Data</b> output. If the file does not exist or cannot be read, the <b>Error</b> output fires with a descriptive error message.</p><h2>Tips</h2><ul><li>Use a Get Value node upstream to dynamically set the file path</li><li>Pair with a Data Preview node to inspect the file contents</li><li>Connect the <b>Error</b> output to logging or notification nodes for robust error handling</li></ul>",
|
|
6
|
+
"FWRITE": "<h1>File Write</h1><p>The <b>File Write</b> node writes data to a file on the filesystem.</p><h2>Ports</h2><ul><li><b>Path</b> (input) — the destination filesystem path</li><li><b>Data</b> (input) — the content to write</li><li><b>Done</b> (output) — fires after a successful write</li><li><b>Error</b> (output) — fires if the write operation fails</li></ul><h2>Behavior</h2><p>When both inputs are satisfied, the node writes the provided data to the specified file path. On success the <b>Done</b> output fires. If the write fails (for example due to permissions or a missing directory), the <b>Error</b> output fires with a descriptive error message.</p><h2>Properties Panel</h2><p>The properties panel shows a View-based info panel with details about the configured file path and write options.</p><h2>Tips</h2><ul><li>Directories in the path are not created automatically — ensure they exist before writing</li><li>Combine with a Set Value node to format data before writing</li><li>Connect the <b>Error</b> output to a Log Values node to capture write failures</li></ul>",
|
|
7
|
+
"GET": "<h1>Get Value</h1><p>The <b>Get Value</b> node retrieves a named variable from the flow context and emits its current value.</p><h2>Ports</h2><ul><li><b>In</b> (input) — trigger to read the value</li><li><b>Value</b> (output) — the retrieved value</li></ul><h2>Behavior</h2><p>When triggered, the node looks up a named key in the flow context and emits the stored value from the <b>Value</b> output. If the key does not exist, the output value is <code>undefined</code>.</p><h2>Usage</h2><p>Pair with a <b>Set Value</b> node to establish a read/write variable pattern. The Set Value node stores a value under a named key; the Get Value node retrieves it downstream.</p><h2>Tips</h2><ul><li>Variable names are case-sensitive</li><li>Use descriptive variable names to keep flows readable</li><li>Get Value is especially useful for accessing values set in a different branch of the flow</li></ul>",
|
|
8
|
+
"ITE": "<h1>If-Then-Else</h1><p>The <b>If-Then-Else</b> node evaluates a boolean condition expression and routes the flow to one of two outputs.</p><h2>Ports</h2><ul><li><b>In</b> (input) — trigger that starts the evaluation</li><li><b>Then</b> (output) — activated when the condition is <b>true</b></li><li><b>Else</b> (output) — activated when the condition is <b>false</b></li></ul><h2>Behavior</h2><p>When the input fires, the node evaluates the configured condition expression against the current flow context. If the expression resolves to a truthy value, the <b>Then</b> output is activated. Otherwise, the <b>Else</b> output is activated. Exactly one output fires per evaluation.</p><h2>Configuration</h2><p>Set the condition expression in the node's data properties. The expression is evaluated in the flow context, giving it access to any variables set by upstream Set Value nodes.</p><h2>Tips</h2><ul><li>Chain multiple If-Then-Else nodes for complex branching logic</li><li>Connect the <b>Else</b> output to another If-Then-Else to build else-if chains</li><li>Use descriptive condition expressions to keep the flow self-documenting</li></ul>",
|
|
9
|
+
"LOG": "<h1>Log Values</h1><p>The <b>Log Values</b> node writes incoming data to the console or log output for debugging purposes.</p><h2>Ports</h2><ul><li><b>Values</b> (input, multi) — accepts one or more connections carrying values to log</li><li><b>Pass</b> (output) — passes the last received value through unchanged</li></ul><h2>Properties</h2><ul><li><b>LogLevel</b> — the severity level for the log entry (e.g. <code>info</code>, <code>warn</code>, <code>error</code>, <code>trace</code>)</li><li><b>Format</b> — an optional format string controlling how values are serialized</li></ul><h2>Behavior</h2><p>When data arrives at any input connection, the node serializes the value and writes it to the configured log output at the specified log level. The data is then forwarded to the <b>Pass</b> output unchanged, so the Log Values node can be inserted inline without disrupting the flow.</p><h2>Tips</h2><ul><li>Use multiple input connections to aggregate log output from parallel branches</li><li>Set the log level to <code>trace</code> during development and <code>warn</code> in production flows</li><li>Insert between any two nodes for quick inline debugging</li></ul>",
|
|
10
|
+
"NOTE": "<h1>Comment</h1><p>The <b>Comment</b> node is a floating annotation for documenting flow logic. It has no input or output ports and does not participate in data flow execution.</p><h2>Usage</h2><p>Drop a Comment node anywhere on the canvas to add context, explain design decisions, or leave notes for collaborators. The note text is stored in the node's <code>Data.NoteText</code> property and displayed directly in the node body.</p><h2>Properties</h2><ul><li><b>NoteText</b> — the annotation content displayed in the node body</li></ul><h2>Tips</h2><ul><li>Use comments to explain complex branching logic or non-obvious configuration choices</li><li>Comment nodes can be freely repositioned without affecting connections</li><li>Group related comments near the nodes they describe</li></ul>",
|
|
11
|
+
"PREV": "<h1>Data Preview</h1><p>The <b>Data Preview</b> node displays a tabular summary of the data flowing through it. Use it as an inline debugger to inspect field names, types, and current values without interrupting the flow.</p><h2>Ports</h2><ul><li><b>Data</b> (input) — the data object to inspect</li><li><b>Pass</b> (output) — passes the data through unchanged</li></ul><h2>Behavior</h2><p>The preview renders a compact table inside the node body showing each field's name, inferred data type, and current value. The node is pass-through: data enters on the left and exits on the right without modification.</p><h2>Tips</h2><ul><li>Insert a Data Preview between two nodes to inspect intermediate state</li><li>The preview updates whenever new data arrives at the input port</li><li>Useful during development for verifying data transformations</li></ul>",
|
|
12
|
+
"SET": "<h1>Set Value</h1><p>The <b>Set Value</b> node assigns a value to a named variable in the flow context.</p><h2>Ports</h2><ul><li><b>In</b> (input) — trigger to perform the assignment</li><li><b>Out</b> (output) — fires after the value has been set</li></ul><h2>Properties</h2><ul><li><b>Variable Name</b> — the key under which the value will be stored</li><li><b>Value Expression</b> — the expression to evaluate and assign</li></ul><h2>Behavior</h2><p>When triggered, the node evaluates the <b>Value Expression</b> and stores the result under the configured <b>Variable Name</b> in the flow context. Downstream nodes can read this value using a <b>Get Value</b> node with the same variable name.</p><h2>Configuration</h2><p>Open the properties panel to configure the variable name and value expression using the built-in form editor.</p><h2>Tips</h2><ul><li>Variable names are case-sensitive — use consistent naming conventions</li><li>Value expressions have access to the current flow context</li><li>Use Set Value at the beginning of a flow to initialize default variables</li></ul>",
|
|
13
|
+
"SPKL": "<h1>Sparkline</h1><p>The <b>Sparkline</b> node renders a live sparkline chart visualizing numeric throughput data directly in the node body.</p><h2>Ports</h2><ul><li><b>Values</b> (input) — a numeric array or stream of values to plot</li><li><b>Stats</b> (output) — emits computed statistics (min, max, mean) for the data set</li></ul><h2>Behavior</h2><p>The node draws a compact line chart inside the node body using a canvas renderer. As new numeric data arrives at the input, the chart updates to reflect the latest values. The filled area under the line and an endpoint dot provide visual emphasis on the current value.</p><h2>Appearance</h2><p>The chart uses the node's theme color for the line and fill area. The last data point is highlighted with a dot. The sparkline scales automatically to fit the available body area.</p><h2>Tips</h2><ul><li>Connect to any node that produces a numeric array for instant visualization</li><li>Use alongside a Data Preview node for combined visual and tabular inspection</li><li>The Stats output is useful for feeding threshold values into an If-Then-Else node</li></ul>",
|
|
14
|
+
"STAT": "<h1>Status Monitor</h1><p>The <b>Status Monitor</b> node monitors the health status of upstream services and reports availability.</p><h2>Ports</h2><ul><li><b>Check</b> (input, multi) — accepts connections from one or more services to monitor</li><li><b>Healthy</b> (output) — fires when all monitored services report healthy</li><li><b>Degraded</b> (output) — fires when one or more services report degraded status</li></ul><h2>Behavior</h2><p>The node body displays a visual health grid showing the status of each monitored service with colored indicators. Green indicates a healthy service; yellow indicates degraded performance. When all services are healthy, the <b>Healthy</b> output is activated. If any service reports degraded status, the <b>Degraded</b> output fires instead.</p><h2>Appearance</h2><p>The node body renders SVG status circles labeled with service names (e.g. API, DB, Cache, Queue). Port labels appear on hover for a cleaner default appearance.</p><h2>Tips</h2><ul><li>Connect multiple services to the <b>Check</b> input to build a comprehensive health dashboard</li><li>Route the <b>Degraded</b> output to notification or alerting nodes</li><li>Combine with an Each node to check a dynamic list of service endpoints</li></ul>",
|
|
15
|
+
"SW": "<h1>Switch</h1><p>The <b>Switch</b> node routes execution to one of multiple outputs based on a matching value, similar to a switch/case statement in programming.</p><h2>Ports</h2><ul><li><b>In</b> (input) — the value to match against cases</li><li><b>Case A</b> (output) — fires when the input matches case A</li><li><b>Case B</b> (output) — fires when the input matches case B</li><li><b>Default</b> (output) — fires when the input does not match any defined case</li></ul><h2>Behavior</h2><p>When a value arrives at the input, the node compares it against each configured case. The first matching case's output is activated. If no case matches, the <b>Default</b> output fires. Only one output is activated per evaluation.</p><h2>Configuration</h2><p>Define case match values in the node's data properties. Each case corresponds to one of the named outputs.</p><h2>Tips</h2><ul><li>Add more output ports by extending the card definition for additional cases</li><li>Use the <b>Default</b> output as a catch-all for unexpected values</li><li>Chain a Switch after an If-Then-Else for multi-level routing logic</li><li>Case matching is based on strict equality</li></ul>"
|
|
16
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardComment extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardComment extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Comment',
|
|
12
|
+
Help: libCardHelp['NOTE'] || false,
|
|
11
13
|
Name: 'Annotation',
|
|
12
14
|
Code: 'NOTE',
|
|
13
15
|
Description: 'A floating annotation or comment node for documenting flow logic.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardDataPreview extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardDataPreview extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Data Preview',
|
|
12
|
+
Help: libCardHelp['PREV'] || false,
|
|
11
13
|
Name: 'Inspect Data',
|
|
12
14
|
Code: 'PREV',
|
|
13
15
|
Description: 'Displays a preview of the data flowing through this node.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardEach extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardEach extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Each',
|
|
12
|
+
Help: libCardHelp['EACH'] || false,
|
|
11
13
|
Name: 'Loop Iterator',
|
|
12
14
|
Code: 'EACH',
|
|
13
15
|
Description: 'Iterates over a collection, executing the body for each item.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardFileRead extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardFileRead extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'File Read',
|
|
12
|
+
Help: libCardHelp['FREAD'] || false,
|
|
11
13
|
Name: 'Read File',
|
|
12
14
|
Code: 'FREAD',
|
|
13
15
|
Description: 'Reads the contents of a file from the filesystem.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardFileWrite extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardFileWrite extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'File Write',
|
|
12
|
+
Help: libCardHelp['FWRITE'] || false,
|
|
11
13
|
Name: 'Write File',
|
|
12
14
|
Code: 'FWRITE',
|
|
13
15
|
Description: 'Writes data to a file on the filesystem.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardGetValue extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardGetValue extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Get Value',
|
|
12
|
+
Help: libCardHelp['GET'] || false,
|
|
11
13
|
Name: 'Read Value',
|
|
12
14
|
Code: 'GET',
|
|
13
15
|
Description: 'Retrieves a named value from the flow context.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardIfThenElse extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -11,7 +12,7 @@ class FlowCardIfThenElse extends libPictFlowCard
|
|
|
11
12
|
Name: 'Conditional Branch',
|
|
12
13
|
Code: 'ITE',
|
|
13
14
|
Description: 'Evaluates a condition and routes to the Then or Else branch.',
|
|
14
|
-
Help: '
|
|
15
|
+
Help: libCardHelp['ITE'] || false,
|
|
15
16
|
Icon: 'ITE',
|
|
16
17
|
Tooltip: 'If-Then-Else: Routes flow based on a boolean condition',
|
|
17
18
|
Category: 'Control Flow',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardLogValues extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardLogValues extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Log Values',
|
|
12
|
+
Help: libCardHelp['LOG'] || false,
|
|
11
13
|
Name: 'Log to Console',
|
|
12
14
|
Code: 'LOG',
|
|
13
15
|
Description: 'Logs input values to the console or log output.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardSetValue extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -11,7 +12,7 @@ class FlowCardSetValue extends libPictFlowCard
|
|
|
11
12
|
Name: 'Assign Value',
|
|
12
13
|
Code: 'SET',
|
|
13
14
|
Description: 'Sets a named value in the flow context.',
|
|
14
|
-
Help: '
|
|
15
|
+
Help: libCardHelp['SET'] || false,
|
|
15
16
|
Icon: 'SET',
|
|
16
17
|
Tooltip: 'Set Value: Assign a value in the context',
|
|
17
18
|
Category: 'Data',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardSparkline extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardSparkline extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Sparkline',
|
|
12
|
+
Help: libCardHelp['SPKL'] || false,
|
|
11
13
|
Name: 'Metric Chart',
|
|
12
14
|
Code: 'SPKL',
|
|
13
15
|
Description: 'Renders a live sparkline visualization of numeric throughput data.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardStatusMonitor extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardStatusMonitor extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Status Monitor',
|
|
12
|
+
Help: libCardHelp['STAT'] || false,
|
|
11
13
|
Name: 'Health Check',
|
|
12
14
|
Code: 'STAT',
|
|
13
15
|
Description: 'Monitors the health status of upstream services and reports availability.',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const libPictFlowCard = require('pict-section-flow').PictFlowCard;
|
|
2
|
+
const libCardHelp = require('../card-help-content');
|
|
2
3
|
|
|
3
4
|
class FlowCardSwitch extends libPictFlowCard
|
|
4
5
|
{
|
|
@@ -8,6 +9,7 @@ class FlowCardSwitch extends libPictFlowCard
|
|
|
8
9
|
{},
|
|
9
10
|
{
|
|
10
11
|
Title: 'Switch',
|
|
12
|
+
Help: libCardHelp['SW'] || false,
|
|
11
13
|
Name: 'Multi-way Branch',
|
|
12
14
|
Code: 'SW',
|
|
13
15
|
Description: 'Routes flow to one of multiple cases based on a value.',
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Pict Section Flow Diagram",
|
|
5
5
|
"main": "source/Pict-Section-Flow.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "npx mocha -u tdd -R spec --exit test/*_tests.js",
|
|
8
8
|
"start": "node source/Pict-Section-Flow.js",
|
|
9
|
-
"
|
|
9
|
+
"generate-help": "node scripts/generate-card-help.js",
|
|
10
|
+
"build": "node scripts/generate-card-help.js && npx quack build && cd example_applications/simple_cards && npx quack build && npx quack copy",
|
|
11
|
+
"docs": "npx quack prepare-docs ./docs"
|
|
10
12
|
},
|
|
11
13
|
"author": "steven velozo <steven@velozo.com>",
|
|
12
14
|
"license": "MIT",
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* generate-card-help.js
|
|
4
|
+
*
|
|
5
|
+
* Reads markdown files from docs/card-help/ and generates a CommonJS module
|
|
6
|
+
* that exports an object mapping card codes to rendered HTML strings.
|
|
7
|
+
*
|
|
8
|
+
* Each markdown file is named by its card code (e.g. ITE.md, SET.md).
|
|
9
|
+
* The file content is converted from markdown to HTML and embedded as a
|
|
10
|
+
* string in the generated module.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* node scripts/generate-card-help.js [source_dir] [output_file]
|
|
14
|
+
*
|
|
15
|
+
* Defaults:
|
|
16
|
+
* source_dir = docs/card-help
|
|
17
|
+
* output_file = example_applications/simple_cards/source/card-help-content.js
|
|
18
|
+
*
|
|
19
|
+
* If the source directory does not exist or contains no markdown files the
|
|
20
|
+
* script writes an empty map and exits cleanly — the build never fails due
|
|
21
|
+
* to missing documentation.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const libFS = require('fs');
|
|
25
|
+
const libPath = require('path');
|
|
26
|
+
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Minimal markdown-to-HTML converter
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Handles the subset of markdown used in card help documentation:
|
|
31
|
+
// headings (#, ##, ###), bold (**), italic (*), inline code (`),
|
|
32
|
+
// unordered lists (- or *), ordered lists (1.), paragraphs, line breaks,
|
|
33
|
+
// and horizontal rules (---).
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
function convertMarkdownToHTML(pMarkdown)
|
|
37
|
+
{
|
|
38
|
+
let tmpLines = pMarkdown.split('\n');
|
|
39
|
+
let tmpHTML = [];
|
|
40
|
+
let tmpInList = false;
|
|
41
|
+
let tmpListType = '';
|
|
42
|
+
let tmpParagraph = [];
|
|
43
|
+
|
|
44
|
+
function flushParagraph()
|
|
45
|
+
{
|
|
46
|
+
if (tmpParagraph.length > 0)
|
|
47
|
+
{
|
|
48
|
+
tmpHTML.push('<p>' + tmpParagraph.join(' ') + '</p>');
|
|
49
|
+
tmpParagraph = [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function closeList()
|
|
54
|
+
{
|
|
55
|
+
if (tmpInList)
|
|
56
|
+
{
|
|
57
|
+
tmpHTML.push(tmpListType === 'ul' ? '</ul>' : '</ol>');
|
|
58
|
+
tmpInList = false;
|
|
59
|
+
tmpListType = '';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function inlineFormat(pText)
|
|
64
|
+
{
|
|
65
|
+
// Inline code
|
|
66
|
+
pText = pText.replace(/`([^`]+)`/g, '<code>$1</code>');
|
|
67
|
+
// Bold (** or __)
|
|
68
|
+
pText = pText.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');
|
|
69
|
+
pText = pText.replace(/__([^_]+)__/g, '<b>$1</b>');
|
|
70
|
+
// Italic (* or _)
|
|
71
|
+
pText = pText.replace(/\*([^*]+)\*/g, '<i>$1</i>');
|
|
72
|
+
pText = pText.replace(/(?<!\w)_([^_]+)_(?!\w)/g, '<i>$1</i>');
|
|
73
|
+
// Links
|
|
74
|
+
pText = pText.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
75
|
+
return pText;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
for (let i = 0; i < tmpLines.length; i++)
|
|
79
|
+
{
|
|
80
|
+
let tmpLine = tmpLines[i];
|
|
81
|
+
let tmpTrimmed = tmpLine.trim();
|
|
82
|
+
|
|
83
|
+
// Empty line — flush paragraph
|
|
84
|
+
if (tmpTrimmed === '')
|
|
85
|
+
{
|
|
86
|
+
flushParagraph();
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Horizontal rule
|
|
91
|
+
if (/^-{3,}$/.test(tmpTrimmed) || /^\*{3,}$/.test(tmpTrimmed))
|
|
92
|
+
{
|
|
93
|
+
flushParagraph();
|
|
94
|
+
closeList();
|
|
95
|
+
tmpHTML.push('<hr>');
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Headings
|
|
100
|
+
let tmpHeadingMatch = tmpTrimmed.match(/^(#{1,6})\s+(.*)$/);
|
|
101
|
+
if (tmpHeadingMatch)
|
|
102
|
+
{
|
|
103
|
+
flushParagraph();
|
|
104
|
+
closeList();
|
|
105
|
+
let tmpLevel = tmpHeadingMatch[1].length;
|
|
106
|
+
tmpHTML.push('<h' + tmpLevel + '>' + inlineFormat(tmpHeadingMatch[2]) + '</h' + tmpLevel + '>');
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Unordered list item (- or *)
|
|
111
|
+
let tmpULMatch = tmpTrimmed.match(/^[-*]\s+(.*)$/);
|
|
112
|
+
if (tmpULMatch)
|
|
113
|
+
{
|
|
114
|
+
flushParagraph();
|
|
115
|
+
if (!tmpInList || tmpListType !== 'ul')
|
|
116
|
+
{
|
|
117
|
+
closeList();
|
|
118
|
+
tmpHTML.push('<ul>');
|
|
119
|
+
tmpInList = true;
|
|
120
|
+
tmpListType = 'ul';
|
|
121
|
+
}
|
|
122
|
+
tmpHTML.push('<li>' + inlineFormat(tmpULMatch[1]) + '</li>');
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Ordered list item (1. 2. etc)
|
|
127
|
+
let tmpOLMatch = tmpTrimmed.match(/^\d+\.\s+(.*)$/);
|
|
128
|
+
if (tmpOLMatch)
|
|
129
|
+
{
|
|
130
|
+
flushParagraph();
|
|
131
|
+
if (!tmpInList || tmpListType !== 'ol')
|
|
132
|
+
{
|
|
133
|
+
closeList();
|
|
134
|
+
tmpHTML.push('<ol>');
|
|
135
|
+
tmpInList = true;
|
|
136
|
+
tmpListType = 'ol';
|
|
137
|
+
}
|
|
138
|
+
tmpHTML.push('<li>' + inlineFormat(tmpOLMatch[1]) + '</li>');
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Regular text — accumulate into paragraph
|
|
143
|
+
closeList();
|
|
144
|
+
tmpParagraph.push(inlineFormat(tmpTrimmed));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
flushParagraph();
|
|
148
|
+
closeList();
|
|
149
|
+
|
|
150
|
+
return tmpHTML.join('');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
// Main
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
|
|
157
|
+
let tmpModuleRoot = libPath.resolve(__dirname, '..');
|
|
158
|
+
let tmpSourceDir = process.argv[2]
|
|
159
|
+
? libPath.resolve(process.argv[2])
|
|
160
|
+
: libPath.join(tmpModuleRoot, 'docs', 'card-help');
|
|
161
|
+
let tmpOutputFile = process.argv[3]
|
|
162
|
+
? libPath.resolve(process.argv[3])
|
|
163
|
+
: libPath.join(tmpModuleRoot, 'example_applications', 'simple_cards', 'source', 'card-help-content.js');
|
|
164
|
+
|
|
165
|
+
let tmpHelpMap = {};
|
|
166
|
+
|
|
167
|
+
// Gracefully handle missing source directory
|
|
168
|
+
if (libFS.existsSync(tmpSourceDir))
|
|
169
|
+
{
|
|
170
|
+
let tmpFiles = libFS.readdirSync(tmpSourceDir).filter(
|
|
171
|
+
(pFile) => { return pFile.endsWith('.md'); }
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
for (let i = 0; i < tmpFiles.length; i++)
|
|
175
|
+
{
|
|
176
|
+
let tmpFile = tmpFiles[i];
|
|
177
|
+
let tmpCode = libPath.basename(tmpFile, '.md');
|
|
178
|
+
try
|
|
179
|
+
{
|
|
180
|
+
let tmpContent = libFS.readFileSync(libPath.join(tmpSourceDir, tmpFile), 'utf8');
|
|
181
|
+
let tmpHTML = convertMarkdownToHTML(tmpContent);
|
|
182
|
+
if (tmpHTML.length > 0)
|
|
183
|
+
{
|
|
184
|
+
tmpHelpMap[tmpCode] = tmpHTML;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (pError)
|
|
188
|
+
{
|
|
189
|
+
// Skip files that cannot be read — never fail the build
|
|
190
|
+
console.warn('generate-card-help: skipping ' + tmpFile + ' (' + pError.message + ')');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
console.log('generate-card-help: processed ' + Object.keys(tmpHelpMap).length + ' card help files from ' + tmpSourceDir);
|
|
195
|
+
}
|
|
196
|
+
else
|
|
197
|
+
{
|
|
198
|
+
console.log('generate-card-help: no docs/card-help directory found — generating empty map');
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Ensure output directory exists
|
|
202
|
+
let tmpOutputDir = libPath.dirname(tmpOutputFile);
|
|
203
|
+
if (!libFS.existsSync(tmpOutputDir))
|
|
204
|
+
{
|
|
205
|
+
libFS.mkdirSync(tmpOutputDir, { recursive: true });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Write the generated module
|
|
209
|
+
let tmpOutput = '// Auto-generated by scripts/generate-card-help.js — do not edit manually.\n';
|
|
210
|
+
tmpOutput += '// Source markdown files are in docs/card-help/\n';
|
|
211
|
+
tmpOutput += 'module.exports = ' + JSON.stringify(tmpHelpMap, null, '\t') + ';\n';
|
|
212
|
+
|
|
213
|
+
libFS.writeFileSync(tmpOutputFile, tmpOutput, 'utf8');
|
|
214
|
+
console.log('generate-card-help: wrote ' + tmpOutputFile);
|
|
@@ -805,14 +805,12 @@ class PictProviderFlowCSS extends libFableServiceProviderBase
|
|
|
805
805
|
flex-shrink: 0;
|
|
806
806
|
transition: background-color 0.15s;
|
|
807
807
|
border-top: 1px solid var(--pf-panel-titlebar-border);
|
|
808
|
-
|
|
808
|
+
display: flex;
|
|
809
|
+
align-items: center;
|
|
810
|
+
justify-content: center;
|
|
809
811
|
}
|
|
810
812
|
.pict-flow-panel-resize-handle::after {
|
|
811
813
|
content: '';
|
|
812
|
-
position: absolute;
|
|
813
|
-
left: 50%;
|
|
814
|
-
top: 50%;
|
|
815
|
-
transform: translate(-50%, -50%);
|
|
816
814
|
width: 24px;
|
|
817
815
|
height: 2px;
|
|
818
816
|
border-radius: 1px;
|