@flowdrop/flowdrop 2.0.0-beta.5 → 2.0.0-beta.6
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/CHANGELOG.md +24 -2
- package/dist/components/App.svelte +1 -10
- package/dist/components/ConfigForm.svelte +6 -505
- package/dist/components/ConfigForm.svelte.d.ts +4 -6
- package/dist/components/ConfigModal.svelte +0 -1
- package/dist/components/form/FormField.svelte +15 -0
- package/dist/components/form/FormFieldLight.svelte +14 -0
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/nodes/AtomNode.svelte +13 -39
- package/dist/components/nodes/GatewayNode.svelte +20 -56
- package/dist/components/nodes/SimpleNode.svelte +23 -49
- package/dist/components/nodes/SquareNode.svelte +23 -49
- package/dist/components/nodes/TerminalNode.svelte +25 -31
- package/dist/components/nodes/WorkflowNode.svelte +37 -84
- package/dist/core/index.d.ts +1 -1
- package/dist/openapi/v1/openapi.yaml +33 -21
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/stores/workflowStore.svelte.d.ts +1 -1
- package/dist/stores/workflowStore.svelte.js +1 -1
- package/dist/types/index.d.ts +45 -20
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/package.json +1 -1
|
@@ -250,7 +250,7 @@ paths:
|
|
|
250
250
|
value:
|
|
251
251
|
success: true
|
|
252
252
|
data:
|
|
253
|
-
-
|
|
253
|
+
- node_type_id: openai_chat_executor
|
|
254
254
|
name: OpenAI Chat
|
|
255
255
|
description: Chat completion using OpenAI's GPT models
|
|
256
256
|
category: ai
|
|
@@ -563,7 +563,7 @@ paths:
|
|
|
563
563
|
config:
|
|
564
564
|
placeholder: Enter your question
|
|
565
565
|
metadata:
|
|
566
|
-
|
|
566
|
+
node_type_id: text_input
|
|
567
567
|
name: Text Input
|
|
568
568
|
description: Text input field for user data
|
|
569
569
|
category: inputs
|
|
@@ -2550,10 +2550,12 @@ components:
|
|
|
2550
2550
|
for user-defined input/output handles
|
|
2551
2551
|
- **gateway**: Supports `config.branches` for conditional branching paths
|
|
2552
2552
|
|
|
2553
|
-
##
|
|
2553
|
+
## Port order + exposure
|
|
2554
2554
|
|
|
2555
|
-
|
|
2556
|
-
|
|
2555
|
+
Render order and exposure are controlled per instance via `config.ports`
|
|
2556
|
+
(a per-direction ordered list of `{id, exposed?}`), over each port's metadata
|
|
2557
|
+
`displayOrder` / `exposedByDefault` defaults. Order is cosmetic; a not-exposed
|
|
2558
|
+
port is hidden, not wireable, and not runtime-overridable.
|
|
2557
2559
|
NodeExecutionStatus:
|
|
2558
2560
|
type: string
|
|
2559
2561
|
enum:
|
|
@@ -3213,6 +3215,26 @@ components:
|
|
|
3213
3215
|
example: Parsed JSON response from the HTTP request
|
|
3214
3216
|
defaultValue:
|
|
3215
3217
|
description: Default value used when no connection provides data
|
|
3218
|
+
exposedByDefault:
|
|
3219
|
+
type: boolean
|
|
3220
|
+
default: true
|
|
3221
|
+
description: |
|
|
3222
|
+
Whether the port is exposed when the instance sets no explicit exposure
|
|
3223
|
+
for it (in `data.config.ports`). Defaults to true — a missing override
|
|
3224
|
+
reads as exposed. Reserved ports that ship hidden until an author opts in
|
|
3225
|
+
(e.g. the `error` output) carry false. In v2 exposure is semantic: a
|
|
3226
|
+
not-exposed port is hidden on the canvas, not wireable, and not
|
|
3227
|
+
runtime-overridable.
|
|
3228
|
+
displayOrder:
|
|
3229
|
+
type: integer
|
|
3230
|
+
default: 0
|
|
3231
|
+
description: |
|
|
3232
|
+
Default sort weight for the port's render position, ascending; ties
|
|
3233
|
+
break on declaration order. Author-declared ports default to 0. Reserved
|
|
3234
|
+
ports (the `error` output and `trigger`/`tool` control ports) need no
|
|
3235
|
+
value — the renderer sinks them to the bottom automatically; set this
|
|
3236
|
+
only to override that. Cosmetic only. The instance's `config.ports`
|
|
3237
|
+
order overrides this when present.
|
|
3216
3238
|
schema:
|
|
3217
3239
|
$ref: '#/components/schemas/PortDataSchema'
|
|
3218
3240
|
description: |
|
|
@@ -3449,13 +3471,6 @@ components:
|
|
|
3449
3471
|
|
|
3450
3472
|
Instance-level settings take precedence over type-level defaults.
|
|
3451
3473
|
properties:
|
|
3452
|
-
hideUnconnectedHandles:
|
|
3453
|
-
type: boolean
|
|
3454
|
-
description: |
|
|
3455
|
-
Show/hide unconnected handles (ports) to reduce visual noise.
|
|
3456
|
-
When true, only ports with active connections are displayed.
|
|
3457
|
-
Useful for nodes with many optional ports.
|
|
3458
|
-
example: true
|
|
3459
3474
|
atom:
|
|
3460
3475
|
$ref: '#/components/schemas/AtomUIConfig'
|
|
3461
3476
|
style:
|
|
@@ -3492,7 +3507,6 @@ components:
|
|
|
3492
3507
|
additionalProperties: true
|
|
3493
3508
|
example:
|
|
3494
3509
|
ui:
|
|
3495
|
-
hideUnconnectedHandles: true
|
|
3496
3510
|
style:
|
|
3497
3511
|
opacity: 0.8
|
|
3498
3512
|
agentspec:component_type: llm_node
|
|
@@ -3514,10 +3528,11 @@ components:
|
|
|
3514
3528
|
## Extensions Support
|
|
3515
3529
|
|
|
3516
3530
|
The `extensions` property allows storing UI settings and 3rd party data:
|
|
3517
|
-
- Use `extensions.ui.
|
|
3531
|
+
- Use `extensions.ui.style` for custom per-node styling
|
|
3518
3532
|
- Use namespaced keys for custom integrations (e.g., "myapp:settings")
|
|
3533
|
+
(Port order + exposure live in `config.ports`, not here.)
|
|
3519
3534
|
properties:
|
|
3520
|
-
|
|
3535
|
+
node_type_id:
|
|
3521
3536
|
type: string
|
|
3522
3537
|
description: Node type unique identifier
|
|
3523
3538
|
example: calculator
|
|
@@ -3607,7 +3622,7 @@ components:
|
|
|
3607
3622
|
Default extension properties for all instances of this node type.
|
|
3608
3623
|
Can be overridden at the instance level via WorkflowNode.data.extensions.
|
|
3609
3624
|
required:
|
|
3610
|
-
-
|
|
3625
|
+
- node_type_id
|
|
3611
3626
|
- name
|
|
3612
3627
|
- description
|
|
3613
3628
|
- category
|
|
@@ -3801,7 +3816,7 @@ components:
|
|
|
3801
3816
|
description: Node instance UUID
|
|
3802
3817
|
type:
|
|
3803
3818
|
type: string
|
|
3804
|
-
description: Node type ID (references NodeMetadata.
|
|
3819
|
+
description: Node type ID (references NodeMetadata.node_type_id)
|
|
3805
3820
|
example: calculator
|
|
3806
3821
|
position:
|
|
3807
3822
|
$ref: '#/components/schemas/Position'
|
|
@@ -3825,9 +3840,6 @@ components:
|
|
|
3825
3840
|
error:
|
|
3826
3841
|
type: string
|
|
3827
3842
|
description: Error message if node execution failed
|
|
3828
|
-
nodeId:
|
|
3829
|
-
type: string
|
|
3830
|
-
description: Alternative node ID
|
|
3831
3843
|
executionInfo:
|
|
3832
3844
|
$ref: '#/components/schemas/NodeExecutionInfo'
|
|
3833
3845
|
extensions:
|
|
@@ -3838,8 +3850,8 @@ components:
|
|
|
3838
3850
|
Use for instance-specific UI states or custom data.
|
|
3839
3851
|
|
|
3840
3852
|
Common use cases:
|
|
3841
|
-
- `extensions.ui.hideUnconnectedHandles`: Hide ports without connections
|
|
3842
3853
|
- `extensions.ui.style`: Custom styling for this node instance
|
|
3854
|
+
(Port order + exposure live in `config.ports`, not here.)
|
|
3843
3855
|
required:
|
|
3844
3856
|
- label
|
|
3845
3857
|
- config
|
|
@@ -560,9 +560,9 @@
|
|
|
560
560
|
},
|
|
561
561
|
"NodeMetadata": {
|
|
562
562
|
"type": "object",
|
|
563
|
-
"description": "Complete metadata for a node type including ports, configuration schema, and extensions.\n\n## Dynamic Port Support\n\nNodes can support user-defined dynamic ports through their configSchema:\n- Add `dynamicInputs` array property to allow custom input handles\n- Add `dynamicOutputs` array property to allow custom output handles\n- Add `branches` array property for gateway nodes with conditional paths\n\n## Extensions Support\n\nThe `extensions` property allows storing UI settings and 3rd party data:\n- Use `extensions.ui.
|
|
563
|
+
"description": "Complete metadata for a node type including ports, configuration schema, and extensions.\n\n## Dynamic Port Support\n\nNodes can support user-defined dynamic ports through their configSchema:\n- Add `dynamicInputs` array property to allow custom input handles\n- Add `dynamicOutputs` array property to allow custom output handles\n- Add `branches` array property for gateway nodes with conditional paths\n\n## Extensions Support\n\nThe `extensions` property allows storing UI settings and 3rd party data:\n- Use `extensions.ui.style` for custom per-node styling\n- Use namespaced keys for custom integrations (e.g., \"myapp:settings\")\n(Port order + exposure live in `config.ports`, not here.)\n",
|
|
564
564
|
"properties": {
|
|
565
|
-
"
|
|
565
|
+
"node_type_id": {
|
|
566
566
|
"type": "string",
|
|
567
567
|
"description": "Node type unique identifier"
|
|
568
568
|
},
|
|
@@ -650,7 +650,7 @@
|
|
|
650
650
|
}
|
|
651
651
|
},
|
|
652
652
|
"required": [
|
|
653
|
-
"
|
|
653
|
+
"node_type_id",
|
|
654
654
|
"name",
|
|
655
655
|
"description",
|
|
656
656
|
"category",
|
|
@@ -695,6 +695,16 @@
|
|
|
695
695
|
"defaultValue": {
|
|
696
696
|
"description": "Default value used when no connection provides data"
|
|
697
697
|
},
|
|
698
|
+
"exposedByDefault": {
|
|
699
|
+
"type": "boolean",
|
|
700
|
+
"default": true,
|
|
701
|
+
"description": "Whether the port is exposed when the instance sets no explicit exposure\nfor it (in `data.config.ports`). Defaults to true — a missing override\nreads as exposed. Reserved ports that ship hidden until an author opts in\n(e.g. the `error` output) carry false. In v2 exposure is semantic: a\nnot-exposed port is hidden on the canvas, not wireable, and not\nruntime-overridable.\n"
|
|
702
|
+
},
|
|
703
|
+
"displayOrder": {
|
|
704
|
+
"type": "integer",
|
|
705
|
+
"default": 0,
|
|
706
|
+
"description": "Default sort weight for the port's render position, ascending; ties\nbreak on declaration order. Author-declared ports default to 0. Reserved\nports (the `error` output and `trigger`/`tool` control ports) need no\nvalue — the renderer sinks them to the bottom automatically; set this\nonly to override that. Cosmetic only. The instance's `config.ports`\norder overrides this when present.\n"
|
|
707
|
+
},
|
|
698
708
|
"schema": {
|
|
699
709
|
"allOf": [
|
|
700
710
|
{
|
|
@@ -726,16 +736,12 @@
|
|
|
726
736
|
"idea",
|
|
727
737
|
"default"
|
|
728
738
|
],
|
|
729
|
-
"description": "Visual rendering type for the node.\n\nBuilt-in types:\n- `note` - Sticky note with markdown support\n- `simple` - Compact layout with header and description\n- `square` - Minimal square node with centered icon\n- `atom` - Minimal label-only pill/rectangle for value/transform nodes (uses extensions.ui.atom)\n- `tool` - Specialized node for agent tools\n- `gateway` - Branching control flow with dynamic branches (uses config.branches)\n- `terminal` - Circular node for workflow start/end/exit points\n- `idea` - Conceptual idea node for BPMN-like flow diagrams\n- `default` - Full-featured workflow node with dynamic port support\n\n## Dynamic Port Support\n\nThe `default` and `gateway` node types support dynamic ports:\n\n- **default**: Supports `config.dynamicInputs` and `config.dynamicOutputs`\n for user-defined input/output handles\n- **gateway**: Supports `config.branches` for conditional branching paths\n\n##
|
|
739
|
+
"description": "Visual rendering type for the node.\n\nBuilt-in types:\n- `note` - Sticky note with markdown support\n- `simple` - Compact layout with header and description\n- `square` - Minimal square node with centered icon\n- `atom` - Minimal label-only pill/rectangle for value/transform nodes (uses extensions.ui.atom)\n- `tool` - Specialized node for agent tools\n- `gateway` - Branching control flow with dynamic branches (uses config.branches)\n- `terminal` - Circular node for workflow start/end/exit points\n- `idea` - Conceptual idea node for BPMN-like flow diagrams\n- `default` - Full-featured workflow node with dynamic port support\n\n## Dynamic Port Support\n\nThe `default` and `gateway` node types support dynamic ports:\n\n- **default**: Supports `config.dynamicInputs` and `config.dynamicOutputs`\n for user-defined input/output handles\n- **gateway**: Supports `config.branches` for conditional branching paths\n\n## Port order + exposure\n\nRender order and exposure are controlled per instance via `config.ports`\n(a per-direction ordered list of `{id, exposed?}`), over each port's metadata\n`displayOrder` / `exposedByDefault` defaults. Order is cosmetic; a not-exposed\nport is hidden, not wireable, and not runtime-overridable.\n"
|
|
730
740
|
},
|
|
731
741
|
"NodeUIExtensions": {
|
|
732
742
|
"type": "object",
|
|
733
743
|
"description": "UI-related extension settings for nodes.\nUsed to control visual behavior in the workflow editor.\n\nThese settings can be defined at two levels:\n1. **Node Type Level** (`metadata.extensions.ui`): Default settings for all instances\n2. **Instance Level** (`data.extensions.ui`): Override for specific node instances\n\nInstance-level settings take precedence over type-level defaults.\n",
|
|
734
744
|
"properties": {
|
|
735
|
-
"hideUnconnectedHandles": {
|
|
736
|
-
"type": "boolean",
|
|
737
|
-
"description": "Show/hide unconnected handles (ports) to reduce visual noise.\nWhen true, only ports with active connections are displayed.\nUseful for nodes with many optional ports.\n"
|
|
738
|
-
},
|
|
739
745
|
"atom": {
|
|
740
746
|
"$ref": "#/$defs/AtomUIConfig"
|
|
741
747
|
},
|
|
@@ -1109,7 +1115,7 @@
|
|
|
1109
1115
|
},
|
|
1110
1116
|
"type": {
|
|
1111
1117
|
"type": "string",
|
|
1112
|
-
"description": "Node type ID (references NodeMetadata.
|
|
1118
|
+
"description": "Node type ID (references NodeMetadata.node_type_id)"
|
|
1113
1119
|
},
|
|
1114
1120
|
"position": {
|
|
1115
1121
|
"$ref": "#/$defs/Position"
|
|
@@ -1139,10 +1145,6 @@
|
|
|
1139
1145
|
"type": "string",
|
|
1140
1146
|
"description": "Error message if node execution failed"
|
|
1141
1147
|
},
|
|
1142
|
-
"nodeId": {
|
|
1143
|
-
"type": "string",
|
|
1144
|
-
"description": "Alternative node ID"
|
|
1145
|
-
},
|
|
1146
1148
|
"executionInfo": {
|
|
1147
1149
|
"$ref": "#/$defs/NodeExecutionInfo"
|
|
1148
1150
|
},
|
|
@@ -1152,7 +1154,7 @@
|
|
|
1152
1154
|
"$ref": "#/$defs/NodeExtensions"
|
|
1153
1155
|
},
|
|
1154
1156
|
{
|
|
1155
|
-
"description": "Per-instance extension properties for 3rd party integrations.\nOverrides or extends the node type extensions defined in metadata.extensions.\nUse for instance-specific UI states or custom data.\n\nCommon use cases:\n- `extensions.ui.
|
|
1157
|
+
"description": "Per-instance extension properties for 3rd party integrations.\nOverrides or extends the node type extensions defined in metadata.extensions.\nUse for instance-specific UI states or custom data.\n\nCommon use cases:\n- `extensions.ui.style`: Custom styling for this node instance\n(Port order + exposure live in `config.ports`, not here.)\n"
|
|
1156
1158
|
}
|
|
1157
1159
|
]
|
|
1158
1160
|
}
|
|
@@ -129,7 +129,7 @@ export declare class WorkflowStore {
|
|
|
129
129
|
/**
|
|
130
130
|
* Set of all handle IDs currently connected to edges.
|
|
131
131
|
*
|
|
132
|
-
*
|
|
132
|
+
* Handle IDs are formatted `{nodeId}-{direction}-{portId}`.
|
|
133
133
|
*/
|
|
134
134
|
get connectedHandles(): Set<string>;
|
|
135
135
|
/**
|
|
@@ -237,7 +237,7 @@ export class WorkflowStore {
|
|
|
237
237
|
/**
|
|
238
238
|
* Set of all handle IDs currently connected to edges.
|
|
239
239
|
*
|
|
240
|
-
*
|
|
240
|
+
* Handle IDs are formatted `{nodeId}-{direction}-{portId}`.
|
|
241
241
|
*/
|
|
242
242
|
get connectedHandles() {
|
|
243
243
|
const handles = new Set();
|
package/dist/types/index.d.ts
CHANGED
|
@@ -117,12 +117,57 @@ export interface NodePort {
|
|
|
117
117
|
required?: boolean;
|
|
118
118
|
description?: string;
|
|
119
119
|
defaultValue?: unknown;
|
|
120
|
+
/**
|
|
121
|
+
* Whether this port is exposed when the instance sets no explicit exposure
|
|
122
|
+
* for it. Defaults to `true` (a missing flag reads as exposed). Reserved ports
|
|
123
|
+
* that ship hidden until an author opts in (e.g. the `error` output) carry
|
|
124
|
+
* `false`. The instance's `ports` config can override it per port. See
|
|
125
|
+
* `.claude/plans/exposed-ports.md`.
|
|
126
|
+
*/
|
|
127
|
+
exposedByDefault?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Default sort weight for the port's render position, ascending; ties break
|
|
130
|
+
* on declaration order. Author-declared ports default to `0`. Reserved ports
|
|
131
|
+
* (the `error` output and `trigger`/`tool` control ports) need no value — the
|
|
132
|
+
* library sinks them to the bottom automatically (see
|
|
133
|
+
* `RESERVED_PORT_DISPLAY_ORDER`); set this only to override that. Cosmetic
|
|
134
|
+
* only. The instance's `ports` config order overrides it.
|
|
135
|
+
*/
|
|
136
|
+
displayOrder?: number;
|
|
120
137
|
/**
|
|
121
138
|
* Optional JSON Schema describing the structure of data on this port.
|
|
122
139
|
* Used for template variable autocomplete to drill into nested properties.
|
|
123
140
|
*/
|
|
124
141
|
schema?: OutputSchema | InputSchema;
|
|
125
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* One entry in a {@link PortsConfig} direction list: a port id, with display
|
|
145
|
+
* order encoded by its position and an optional exposure override.
|
|
146
|
+
*/
|
|
147
|
+
export interface PortConfigEntry {
|
|
148
|
+
id: string;
|
|
149
|
+
/**
|
|
150
|
+
* Explicit exposure for this port. Stored only when it diverges from the
|
|
151
|
+
* port's metadata `exposedByDefault`. In v2 exposure is semantic: a
|
|
152
|
+
* not-exposed port is hidden on the canvas, not wireable, and not
|
|
153
|
+
* runtime-overridable.
|
|
154
|
+
*/
|
|
155
|
+
exposed?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Per-instance port order + exposure, stored in `data.config.ports`.
|
|
159
|
+
*
|
|
160
|
+
* A per-direction ordered list of the node's ports: array index encodes display
|
|
161
|
+
* order relative to the metadata default, and the optional `exposed` flag
|
|
162
|
+
* overrides the port's `exposedByDefault`. A port the author never touched is
|
|
163
|
+
* absent from the list; an untouched node stores no `ports` key at all. Order
|
|
164
|
+
* is cosmetic (the engine ignores it); exposure is semantic. See
|
|
165
|
+
* `.claude/plans/exposed-ports.md`.
|
|
166
|
+
*/
|
|
167
|
+
export interface PortsConfig {
|
|
168
|
+
inputs?: PortConfigEntry[];
|
|
169
|
+
outputs?: PortConfigEntry[];
|
|
170
|
+
}
|
|
126
171
|
/**
|
|
127
172
|
* Absolute position of a port handle in canvas space.
|
|
128
173
|
* Used by proximity connect and other features that need port positions.
|
|
@@ -529,27 +574,8 @@ export interface AtomUIConfig {
|
|
|
529
574
|
maxWidth?: number;
|
|
530
575
|
}
|
|
531
576
|
export interface NodeUIExtensions {
|
|
532
|
-
/** Show/hide unconnected handles (ports) to reduce visual noise */
|
|
533
|
-
hideUnconnectedHandles?: boolean;
|
|
534
577
|
/** Display/behavior config for minimalist atom nodes (Constant, Cast, …) */
|
|
535
578
|
atom?: AtomUIConfig;
|
|
536
|
-
/**
|
|
537
|
-
* Visual-only port display order (no effect on execution).
|
|
538
|
-
* Arrays of port IDs in the desired render order.
|
|
539
|
-
* Ports not listed appear at the end in metadata order.
|
|
540
|
-
*/
|
|
541
|
-
portOrder?: {
|
|
542
|
-
inputs?: string[];
|
|
543
|
-
outputs?: string[];
|
|
544
|
-
};
|
|
545
|
-
/**
|
|
546
|
-
* Manually hidden ports (visual only, no effect on execution).
|
|
547
|
-
* Required ports cannot be added here — enforced in the UI.
|
|
548
|
-
*/
|
|
549
|
-
hiddenPorts?: {
|
|
550
|
-
inputs?: string[];
|
|
551
|
-
outputs?: string[];
|
|
552
|
-
};
|
|
553
579
|
/** Custom styles or theme overrides */
|
|
554
580
|
style?: Record<string, unknown>;
|
|
555
581
|
/** Any other UI-specific settings */
|
|
@@ -563,7 +589,6 @@ export interface NodeUIExtensions {
|
|
|
563
589
|
* ```typescript
|
|
564
590
|
* const extensions: NodeExtensions = {
|
|
565
591
|
* ui: {
|
|
566
|
-
* hideUnconnectedHandles: true,
|
|
567
592
|
* style: { opacity: 0.8 }
|
|
568
593
|
* },
|
|
569
594
|
* "myapp:analytics": {
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -241,6 +241,33 @@ export declare function getPortBackgroundColor(checker: PortCompatibilityChecker
|
|
|
241
241
|
* @returns CSS color value for the port border
|
|
242
242
|
*/
|
|
243
243
|
export declare function getPortBorderColor(checker: PortCompatibilityChecker, dataType: string): string;
|
|
244
|
+
/**
|
|
245
|
+
* Whether a port is the reserved `error` output port.
|
|
246
|
+
*
|
|
247
|
+
* The reserved error output carries an arbitrary data type (json) but should
|
|
248
|
+
* read as an error affordance (red) wherever it surfaces. See
|
|
249
|
+
* `.claude/plans/exposed-ports.md`.
|
|
250
|
+
*/
|
|
251
|
+
export declare function isErrorPort(port: {
|
|
252
|
+
id: string;
|
|
253
|
+
type?: string;
|
|
254
|
+
}): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Port colour token: red for the reserved error output, else its data type.
|
|
257
|
+
*/
|
|
258
|
+
export declare function getPortColorToken(checker: PortCompatibilityChecker, port: {
|
|
259
|
+
id: string;
|
|
260
|
+
type?: string;
|
|
261
|
+
dataType: string;
|
|
262
|
+
}): string;
|
|
263
|
+
/**
|
|
264
|
+
* Port background tint, honouring the reserved error port's red affordance.
|
|
265
|
+
*/
|
|
266
|
+
export declare function getPortBackgroundColorForPort(checker: PortCompatibilityChecker, port: {
|
|
267
|
+
id: string;
|
|
268
|
+
type?: string;
|
|
269
|
+
dataType: string;
|
|
270
|
+
}, opacity?: number): string;
|
|
244
271
|
/**
|
|
245
272
|
* Convert RGB components to hex color string
|
|
246
273
|
* @param r - Red component (0-255)
|
package/dist/utils/colors.js
CHANGED
|
@@ -429,6 +429,29 @@ export function getPortBackgroundColor(checker, dataType, opacity = 25) {
|
|
|
429
429
|
export function getPortBorderColor(checker, dataType) {
|
|
430
430
|
return getDataTypeColorToken(checker, dataType);
|
|
431
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Whether a port is the reserved `error` output port.
|
|
434
|
+
*
|
|
435
|
+
* The reserved error output carries an arbitrary data type (json) but should
|
|
436
|
+
* read as an error affordance (red) wherever it surfaces. See
|
|
437
|
+
* `.claude/plans/exposed-ports.md`.
|
|
438
|
+
*/
|
|
439
|
+
export function isErrorPort(port) {
|
|
440
|
+
return port.id === 'error' && port.type !== 'input';
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Port colour token: red for the reserved error output, else its data type.
|
|
444
|
+
*/
|
|
445
|
+
export function getPortColorToken(checker, port) {
|
|
446
|
+
return isErrorPort(port) ? 'var(--fd-node-red)' : getDataTypeColorToken(checker, port.dataType);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Port background tint, honouring the reserved error port's red affordance.
|
|
450
|
+
*/
|
|
451
|
+
export function getPortBackgroundColorForPort(checker, port, opacity = 25) {
|
|
452
|
+
const colorToken = getPortColorToken(checker, port);
|
|
453
|
+
return `color-mix(in srgb, ${colorToken} ${opacity}%, transparent)`;
|
|
454
|
+
}
|
|
432
455
|
/**
|
|
433
456
|
* Convert RGB components to hex color string
|
|
434
457
|
* @param r - Red component (0-255)
|
|
@@ -1,9 +1,46 @@
|
|
|
1
|
-
import type { NodePort } from '../types/index.js';
|
|
1
|
+
import type { NodePort, PortConfigEntry, PortsConfig } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default sort weight applied to reserved ports (the `error` output and the
|
|
4
|
+
* `trigger`/`tool` control-flow ports) that don't set an explicit
|
|
5
|
+
* `displayOrder`. High enough to sink them below author-declared ports, which
|
|
6
|
+
* default to `0`. The single home for the "high weight" the docs refer to — an
|
|
7
|
+
* explicit `displayOrder` on the port still overrides it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RESERVED_PORT_DISPLAY_ORDER = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a port is a reserved one that should default to the bottom of its
|
|
12
|
+
* direction: the reserved `error` output, or a `trigger`/`tool` control-flow
|
|
13
|
+
* port (identified by data type, mirroring the port config's control types).
|
|
14
|
+
*/
|
|
15
|
+
export declare function isReservedPort(port: {
|
|
16
|
+
id: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
dataType?: string;
|
|
19
|
+
}): boolean;
|
|
2
20
|
/**
|
|
3
21
|
* Sort ports by an ordered array of port IDs.
|
|
4
22
|
* Ports not listed appear at the end in their original order.
|
|
5
23
|
*/
|
|
6
24
|
export declare function applyPortOrder(ports: NodePort[], orderedIds: string[] | undefined): NodePort[];
|
|
25
|
+
/**
|
|
26
|
+
* Sort ports by their effective `displayOrder` weight (ascending), breaking ties
|
|
27
|
+
* on declaration order (stable). This is the default order before any
|
|
28
|
+
* instance-level reordering — reserved ports (trigger/tool/error) carry a high
|
|
29
|
+
* default weight so they land at the bottom without authors hand-setting it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function byDefaultOrder(ports: NodePort[]): NodePort[];
|
|
32
|
+
/**
|
|
33
|
+
* Effective render order for a direction: the metadata default order, then the
|
|
34
|
+
* instance's `ports` config override (listed ports first in their stored order,
|
|
35
|
+
* the rest following in default order).
|
|
36
|
+
*/
|
|
37
|
+
export declare function orderPortsFor(ports: NodePort[], entries: PortConfigEntry[] | undefined): NodePort[];
|
|
38
|
+
/**
|
|
39
|
+
* Effective exposure for a port: the instance's explicit `exposed` override if
|
|
40
|
+
* present, else the port's metadata `exposedByDefault` (which itself defaults to
|
|
41
|
+
* exposed).
|
|
42
|
+
*/
|
|
43
|
+
export declare function isPortExposed(port: NodePort, entries: PortConfigEntry[] | undefined): boolean;
|
|
7
44
|
/**
|
|
8
45
|
* Compute the CSS `top` offset (px) for a port handle.
|
|
9
46
|
* - 1 port: centered at 40px
|
|
@@ -11,14 +48,13 @@ export declare function applyPortOrder(ports: NodePort[], orderedIds: string[] |
|
|
|
11
48
|
*/
|
|
12
49
|
export declare function getPortTop(index: number, count: number): number;
|
|
13
50
|
/**
|
|
14
|
-
*
|
|
51
|
+
* Whether a port is exposed, and so rendered on the canvas.
|
|
52
|
+
*
|
|
53
|
+
* In v2 exposure is semantic, not cosmetic: a not-exposed port is hidden, not
|
|
54
|
+
* wireable, and not runtime-overridable. Effective exposure is the instance's
|
|
55
|
+
* explicit `data.config.ports` override for the port, falling back to the port's
|
|
56
|
+
* metadata `exposedByDefault` (which itself defaults to exposed).
|
|
15
57
|
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* 3. Default — visible
|
|
20
|
-
*/
|
|
21
|
-
export declare function isPortVisible(port: NodePort, direction: 'input' | 'output', hiddenPorts: {
|
|
22
|
-
inputs?: string[];
|
|
23
|
-
outputs?: string[];
|
|
24
|
-
}, hideUnconnectedHandles: boolean, connectedHandles: Set<string>, nodeId: string | undefined): boolean;
|
|
58
|
+
* @see .claude/plans/exposed-ports.md
|
|
59
|
+
*/
|
|
60
|
+
export declare function isPortVisible(port: NodePort, direction: 'input' | 'output', ports: PortsConfig | undefined): boolean;
|
package/dist/utils/portUtils.js
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
import { isErrorPort } from './colors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default sort weight applied to reserved ports (the `error` output and the
|
|
4
|
+
* `trigger`/`tool` control-flow ports) that don't set an explicit
|
|
5
|
+
* `displayOrder`. High enough to sink them below author-declared ports, which
|
|
6
|
+
* default to `0`. The single home for the "high weight" the docs refer to — an
|
|
7
|
+
* explicit `displayOrder` on the port still overrides it.
|
|
8
|
+
*/
|
|
9
|
+
export const RESERVED_PORT_DISPLAY_ORDER = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a port is a reserved one that should default to the bottom of its
|
|
12
|
+
* direction: the reserved `error` output, or a `trigger`/`tool` control-flow
|
|
13
|
+
* port (identified by data type, mirroring the port config's control types).
|
|
14
|
+
*/
|
|
15
|
+
export function isReservedPort(port) {
|
|
16
|
+
return isErrorPort(port) || port.dataType === 'trigger' || port.dataType === 'tool';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The port's effective default sort weight: its explicit `displayOrder` if set,
|
|
20
|
+
* else a high weight for reserved ports, else `0`.
|
|
21
|
+
*/
|
|
22
|
+
function defaultWeight(port) {
|
|
23
|
+
return port.displayOrder ?? (isReservedPort(port) ? RESERVED_PORT_DISPLAY_ORDER : 0);
|
|
24
|
+
}
|
|
1
25
|
/**
|
|
2
26
|
* Sort ports by an ordered array of port IDs.
|
|
3
27
|
* Ports not listed appear at the end in their original order.
|
|
@@ -13,6 +37,38 @@ export function applyPortOrder(ports, orderedIds) {
|
|
|
13
37
|
return aIdx === bIdx ? 0 : aIdx - bIdx;
|
|
14
38
|
});
|
|
15
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Sort ports by their effective `displayOrder` weight (ascending), breaking ties
|
|
42
|
+
* on declaration order (stable). This is the default order before any
|
|
43
|
+
* instance-level reordering — reserved ports (trigger/tool/error) carry a high
|
|
44
|
+
* default weight so they land at the bottom without authors hand-setting it.
|
|
45
|
+
*/
|
|
46
|
+
export function byDefaultOrder(ports) {
|
|
47
|
+
return ports
|
|
48
|
+
.map((port, index) => ({ port, index }))
|
|
49
|
+
.sort((a, b) => defaultWeight(a.port) - defaultWeight(b.port) || a.index - b.index)
|
|
50
|
+
.map(({ port }) => port);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Effective render order for a direction: the metadata default order, then the
|
|
54
|
+
* instance's `ports` config override (listed ports first in their stored order,
|
|
55
|
+
* the rest following in default order).
|
|
56
|
+
*/
|
|
57
|
+
export function orderPortsFor(ports, entries) {
|
|
58
|
+
const base = byDefaultOrder(ports);
|
|
59
|
+
return applyPortOrder(base, entries?.map((entry) => entry.id));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Effective exposure for a port: the instance's explicit `exposed` override if
|
|
63
|
+
* present, else the port's metadata `exposedByDefault` (which itself defaults to
|
|
64
|
+
* exposed).
|
|
65
|
+
*/
|
|
66
|
+
export function isPortExposed(port, entries) {
|
|
67
|
+
const entry = entries?.find((candidate) => candidate.id === port.id);
|
|
68
|
+
if (entry && entry.exposed !== undefined)
|
|
69
|
+
return entry.exposed;
|
|
70
|
+
return port.exposedByDefault ?? true;
|
|
71
|
+
}
|
|
16
72
|
/**
|
|
17
73
|
* Compute the CSS `top` offset (px) for a port handle.
|
|
18
74
|
* - 1 port: centered at 40px
|
|
@@ -24,19 +80,16 @@ export function getPortTop(index, count) {
|
|
|
24
80
|
return 20 + index * 40;
|
|
25
81
|
}
|
|
26
82
|
/**
|
|
27
|
-
*
|
|
83
|
+
* Whether a port is exposed, and so rendered on the canvas.
|
|
28
84
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return connectedHandles.has(`${nodeId}-${direction}-${port.id}`);
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
85
|
+
* In v2 exposure is semantic, not cosmetic: a not-exposed port is hidden, not
|
|
86
|
+
* wireable, and not runtime-overridable. Effective exposure is the instance's
|
|
87
|
+
* explicit `data.config.ports` override for the port, falling back to the port's
|
|
88
|
+
* metadata `exposedByDefault` (which itself defaults to exposed).
|
|
89
|
+
*
|
|
90
|
+
* @see .claude/plans/exposed-ports.md
|
|
91
|
+
*/
|
|
92
|
+
export function isPortVisible(port, direction, ports) {
|
|
93
|
+
const entries = direction === 'input' ? ports?.inputs : ports?.outputs;
|
|
94
|
+
return isPortExposed(port, entries);
|
|
42
95
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.0.0-beta.
|
|
6
|
+
"version": "2.0.0-beta.6",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|