Skip to content

Commit 2e80146

Browse files
committed
feat(flow-builder): add reusable field components for form customization
- Introduced various field components (text, editor, picker, array, file/grid, choice, async options, tabs) to support flexible form input rendering in Flow Builder. - Added `FieldWrapper` for consistent layout and labeling across fields. - Implemented custom `BuilderEdge` and `BuilderConnectionLine` for enhanced edge handling on the canvas.
0 parents  commit 2e80146

126 files changed

Lines changed: 21175 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended', 'plugin:prettier/recommended'],
4+
settings: {
5+
react: {
6+
version: 'detect'
7+
}
8+
},
9+
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
ecmaFeatures: { jsx: true }
12+
},
13+
env: {
14+
browser: true,
15+
node: true,
16+
es2020: true,
17+
jest: true
18+
},
19+
ignorePatterns: ['**/node_modules', '**/dist', '**/build', '**/coverage', '**/package-lock.json'],
20+
plugins: ['unused-imports'],
21+
rules: {
22+
'@typescript-eslint/explicit-module-boundary-types': 'off',
23+
'no-unused-vars': 'off',
24+
'unused-imports/no-unused-imports': 'warn',
25+
'unused-imports/no-unused-vars': ['warn', { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }],
26+
'no-undef': 'off',
27+
'no-console': [process.env.CI ? 'error' : 'warn', { allow: ['warn', 'error', 'info'] }],
28+
'prettier/prettier': 'error',
29+
'react/prop-types': 'off'
30+
}
31+
}

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# editor
2+
.idea
3+
.vscode
4+
5+
# dependencies
6+
**/node_modules
7+
**/package-lock.json
8+
**/yarn.lock
9+
10+
## logs
11+
**/logs
12+
**/*.log
13+
14+
## pnpm
15+
.pnpm-store/
16+
17+
## build
18+
**/dist
19+
**/build
20+
21+
## temp
22+
**/tmp
23+
**/temp
24+
25+
## test
26+
**/coverage
27+
28+
# misc
29+
.DS_Store

.npmrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
auto-install-peers = true
2+
strict-peer-dependencies = false
3+
prefer-workspace-packages = true
4+
link-workspace-packages = deep
5+
hoist = true
6+
shamefully-hoist = true
7+
engine-strict = false

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.15.0

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# flowkit
2+
3+
A **common, abstract, portable, configurable visual-builder UI kit** for React —
4+
the canvas UX extracted from [Flowise](https://github.com/FlowiseAI/Flowise)'s
5+
Agentflow builder and generalized so other products (BPMN builders, data-pipeline
6+
studios, automation designers, …) can stand up the same polished node-editor
7+
experience with a single config object.
8+
9+
## Layers
10+
11+
```
12+
┌──────────────────────────────────────────────────────────────┐
13+
│ Your app — supplies ONE config object: │
14+
│ registry, rules, renderers, persistence, slots │
15+
├──────────────────────────────────────────────────────────────┤
16+
│ @flowkit/flow-builder — the canvas kit │
17+
│ FlowBuilderCanvas · NodePalette · SchemaFields │
18+
│ PropertyInspectorDialog · BuilderNode/Edge · GroupNode │
19+
│ FlowBuilderProvider (graph CRUD, dirty state, selection) │
20+
├──────────────────────────────────────────────────────────────┤
21+
│ @flowkit/ui-foundation — the design system │
22+
│ theme factory (light/dark) · MainCard · buttons · inputs │
23+
│ Dropdown/AsyncDropdown · CodeEditor · JsonEditor · DataGrid │
24+
│ ConfirmDialog · Loader · hooks · utils │
25+
└──────────────────────────────────────────────────────────────┘
26+
```
27+
28+
The kit never imports an API client, a store, or a domain constant — everything
29+
domain-specific is injected through `FlowBuilderConfig`.
30+
31+
## Quick start
32+
33+
```tsx
34+
import { FlowBuilderProvider, FlowBuilderCanvas, typedPortsIsValidConnection } from '@flowkit/flow-builder'
35+
import { FlowkitThemeProvider } from '@flowkit/ui-foundation'
36+
import '@flowkit/flow-builder/styles.css'
37+
38+
const operators = [
39+
{
40+
name: 'httpSource',
41+
label: 'HTTP Source',
42+
category: 'Sources',
43+
color: '#7C3AED',
44+
baseClasses: ['Record[]'],
45+
inputs: [{ label: 'URL', name: 'url', type: 'string' }]
46+
}
47+
// …transforms and sinks
48+
]
49+
50+
const config = {
51+
registry: { list: async () => operators },
52+
isValidConnection: typedPortsIsValidConnection, // typed ports
53+
outputStrategy: 'standard',
54+
onSave: (doc) => localStorage.setItem('my-flow', JSON.stringify(doc))
55+
}
56+
57+
export const Studio = () => (
58+
<FlowkitThemeProvider>
59+
<FlowBuilderProvider config={config}>
60+
<FlowBuilderCanvas />
61+
</FlowBuilderProvider>
62+
</FlowkitThemeProvider>
63+
)
64+
```
65+
66+
A complete data-pipeline studio (typed ports, schema-driven property forms,
67+
palette search, minimap, dark mode, save/load) is ~100 lines of config.
68+
69+
## What's configurable
70+
71+
| Area | Config hook | Default |
72+
| --- | --- | --- |
73+
| Node source | `registry: NodeRegistryAdapter` | — (required) |
74+
| Form fields | `fieldRenderers` (by type or `node:param`) | 17 built-in renderers |
75+
| Node/edge look | `nodeRenderers`, `edgeRenderers` | v2-Agentflow-style cards & gradient edges |
76+
| Connection rules | `isValidConnection` | no self-loops, no cycles |
77+
| Typed ports || compose `typedPortsIsValidConnection` |
78+
| Drop rules | `validateDrop` (singletons, group rules) | allow all |
79+
| On-connect side effects | `onConnectInput` (e.g. Flowise `{{ref}}`) | none |
80+
| Serialization | `serialize` / `deserialize` | React Flow `toObject()` |
81+
| Persistence | `onSave`, `initialFlow` ||
82+
| Colors | `resolveNodeColor`, `connectionLineColor` | `data.color`, theme primary |
83+
| Node extras | `renderNodeSummary`, `onNodeInfo`, `resolveNodeWarning`, `canDuplicateNode` | off |
84+
| Features | `features.{minimap,stickyNote,groupNodes,snapping,backgroundDots,palette,readOnly}` | on |
85+
| Slots | `slots.{header,floatingActions}` ||
86+
87+
## Documentation
88+
89+
Full technical docs in [`docs/`](docs) (AsciiDoc):
90+
91+
- [Architecture & mental model](docs/architecture.adoc) — layers, data flow, state ownership, the three core conventions
92+
- [Graph node model spec](docs/node-model.adoc) — schemas, params, anchors, handle-id grammar, visibility engine, edges, FlowDocument
93+
- [Backend API spec](docs/backend-api-spec.adoc) — node registry, icons, async options, persistence, concurrency
94+
- [Configuration reference](docs/configuration.adoc)`FlowBuilderConfig`, features, slots, theming, context API
95+
- [Extending flowkit](docs/extending.adoc) — registries, field/node/edge renderers, connection rules, serializers, walkthroughs
96+
97+
## Repo layout
98+
99+
```
100+
packages/
101+
ui-foundation/ @flowkit/ui-foundation — theme, generic components, hooks, utils
102+
flow-builder/ @flowkit/flow-builder — the visual builder kit
103+
examples/
104+
playground/ two demos on one kit: data-pipeline studio + BPMN builder
105+
```
106+
107+
## Develop
108+
109+
```bash
110+
pnpm install
111+
pnpm -r build # build packages (topological order)
112+
pnpm -r test # unit tests (utils, search, visibility, graph, handles)
113+
pnpm --filter flowkit-playground dev # run the demos on :5174
114+
```
115+
116+
## Status & roadmap
117+
118+
- [x] ui-foundation: theme factory + controlled/uncontrolled dark mode
119+
- [x] flow-builder: canvas, palette, schema-driven forms, group nodes, sticky notes
120+
- [x] playground demos (data-pipeline, BPMN)
121+
- [ ] Flowise v2 Agentflow canvas running on the kit (adapter in the Flowise repo)
122+
- [ ] v1 chatflow-style inline params on node bodies (`nodeEditMode: 'inline'`)
123+
- [ ] Undo/redo, multi-select sub-graph copy/paste, alignment guides
124+
125+
License: Apache-2.0. Extracted with care from Flowise (Apache-2.0).

0 commit comments

Comments
 (0)