@cascivo/flow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/flow.css +2 -0
- package/dist/index.d.ts +706 -0
- package/dist/index.js +1137 -0
- package/package.json +74 -0
- package/readme.body.md +65 -0
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cascivo/flow",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Flow & diagram components — CSS-native, signal-driven node/edge graphs with pan/zoom, draggable nodes, animated edges, and scripted storylines, zero dependencies",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"cascivo",
|
|
8
|
+
"css",
|
|
9
|
+
"design-system",
|
|
10
|
+
"diagram",
|
|
11
|
+
"flow",
|
|
12
|
+
"flowchart",
|
|
13
|
+
"graph",
|
|
14
|
+
"react",
|
|
15
|
+
"signals",
|
|
16
|
+
"svg"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/cascivo/cascivo/tree/main/packages/flow#readme",
|
|
19
|
+
"bugs": "https://github.com/cascivo/cascivo/issues",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "urbanisierung",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/cascivo/cascivo.git",
|
|
25
|
+
"directory": "packages/flow"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"sideEffects": [
|
|
32
|
+
"**/*.css"
|
|
33
|
+
],
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./styles.css": "./dist/flow.css"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"provenance": true
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "vp build && node scripts/flatten-types.mjs && node scripts/check-types-flat.mjs",
|
|
49
|
+
"check": "tsc --noEmit",
|
|
50
|
+
"test": "vp test"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@cascivo/core": "workspace:^",
|
|
54
|
+
"@cascivo/i18n": "workspace:^"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@testing-library/jest-dom": "catalog:",
|
|
58
|
+
"@testing-library/react": "catalog:",
|
|
59
|
+
"@testing-library/user-event": "catalog:",
|
|
60
|
+
"@types/react": "catalog:",
|
|
61
|
+
"@types/react-dom": "catalog:",
|
|
62
|
+
"fast-check": "catalog:",
|
|
63
|
+
"jsdom": "catalog:",
|
|
64
|
+
"react": "catalog:",
|
|
65
|
+
"react-dom": "catalog:",
|
|
66
|
+
"typescript": "catalog:",
|
|
67
|
+
"vite-plus": "catalog:"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"@preact/signals-react": ">=2.0.0",
|
|
71
|
+
"react": ">=18.0.0",
|
|
72
|
+
"react-dom": ">=18.0.0"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/readme.body.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
CSS-native, signal-driven flow & diagram library for cascivo — render node/edge graphs (flowcharts, DAGs, pipelines, mind-maps) with pan/zoom, draggable nodes, connection handles, animated edges, controls, a minimap, and scripted `FlowStory` storylines. HTML nodes (themed cascivo content for free), SVG edges, one CSS-transform viewport. Zero runtime dependencies beyond `@cascivo/core` + `@cascivo/i18n`.
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @cascivo/flow @preact/signals-react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`react`, `react-dom`, and `@preact/signals-react` are peer dependencies — install them in your app.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The headline API is a single declarative `<Flow nodes edges />` that takes plain
|
|
14
|
+
serializable data (an agent can emit it as JSON):
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Flow } from '@cascivo/flow'
|
|
18
|
+
import '@cascivo/flow/styles.css' // required — maps to the dist `flow.css`
|
|
19
|
+
import '@cascivo/themes/dark.css' // any cascivo theme drives the flow colors
|
|
20
|
+
|
|
21
|
+
const nodes = [
|
|
22
|
+
{ id: 'a', position: { x: 0, y: 0 }, data: { label: 'Client' } },
|
|
23
|
+
{ id: 'b', position: { x: 240, y: 0 }, data: { label: 'Gateway' } },
|
|
24
|
+
{ id: 'c', position: { x: 480, y: 0 }, data: { label: 'Service' } },
|
|
25
|
+
]
|
|
26
|
+
const edges = [
|
|
27
|
+
{ id: 'ab', source: 'a', target: 'b', animated: true },
|
|
28
|
+
{ id: 'bc', source: 'b', target: 'c' },
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
export function Pipeline() {
|
|
32
|
+
return <Flow nodes={nodes} edges={edges} background controls />
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Scripted storylines
|
|
37
|
+
|
|
38
|
+
`<FlowStory>` walks the viewer through a graph step by step with fade-in
|
|
39
|
+
captions — driven by a serializable `script`:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { FlowStory } from '@cascivo/flow'
|
|
43
|
+
;<FlowStory
|
|
44
|
+
nodes={nodes}
|
|
45
|
+
edges={edges}
|
|
46
|
+
script={[
|
|
47
|
+
{ from: 'a', to: 'b', label: 'Request sent' },
|
|
48
|
+
{ from: 'b', to: 'a', label: 'Acknowledged' },
|
|
49
|
+
{ from: 'a', to: 'b', label: 'Payload streamed' },
|
|
50
|
+
{ from: 'b', to: 'c', label: 'Forwarded to Service' },
|
|
51
|
+
]}
|
|
52
|
+
loop
|
|
53
|
+
/>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Scope
|
|
57
|
+
|
|
58
|
+
Covers the basic set both [React Flow](https://reactflow.dev) and
|
|
59
|
+
[AntV X6](https://x6.antv.antgroup.com/) share — render, pan/zoom, drag,
|
|
60
|
+
handles, edges (bezier/straight/smoothstep), selection, interactive connect,
|
|
61
|
+
background, controls, minimap, animated edges — plus the `FlowStory` storyline.
|
|
62
|
+
It deliberately does **not** ship heavy editor surfaces (auto-layout engines,
|
|
63
|
+
undo/redo, clipboard, resize/rotate, snaplines, lasso/whiteboard, sub-flows,
|
|
64
|
+
multiplayer). A tiny optional dependency-free `gridLayout`/`layeredLayout`
|
|
65
|
+
helper covers the common "just arrange these for me" case.
|