@xpressai/xircuits-viewer-react 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +75 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @xpressai/xircuits-viewer-react
2
+
3
+ React components for rendering `.xircuits` workflow files. Built on [`@xpressai/xircuits-viewer`](https://www.npmjs.com/package/@xpressai/xircuits-viewer).
4
+
5
+ ![HelloXircuits rendered](https://raw.githubusercontent.com/XpressAI/xircuits/master/xircuits-graph-viewer/xircuits-hello.png)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @xpressai/xircuits-viewer @xpressai/xircuits-viewer-react
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Interactive (with pan/zoom)
16
+
17
+ ```tsx
18
+ import { XircuitsGraph } from '@xpressai/xircuits-viewer-react';
19
+
20
+ // Point it at a .xircuits file — that's it
21
+ <XircuitsGraph src="/workflows/MyWorkflow.xircuits" />
22
+ ```
23
+
24
+ With options:
25
+
26
+ ```tsx
27
+ <XircuitsGraph
28
+ src="/workflows/MyWorkflow.xircuits"
29
+ theme="dark"
30
+ height={500}
31
+ interactive
32
+ onNodeClick={(node) => console.log(node.name)}
33
+ />
34
+ ```
35
+
36
+ ### Static (SSR-safe)
37
+
38
+ ```tsx
39
+ import { XircuitsGraphStatic } from '@xpressai/xircuits-viewer-react';
40
+
41
+ <XircuitsGraphStatic src="/workflows/MyWorkflow.xircuits" theme="dark" />
42
+ ```
43
+
44
+ ### Pre-loaded data
45
+
46
+ ```tsx
47
+ import workflow from './MyWorkflow.xircuits';
48
+
49
+ <XircuitsGraph data={workflow} />
50
+ ```
51
+
52
+ ## Props
53
+
54
+ ### XircuitsGraph
55
+
56
+ | Prop | Type | Default | Description |
57
+ |------|------|---------|-------------|
58
+ | `src` | `string` | — | URL to a `.xircuits` file |
59
+ | `data` | `object` | — | Pre-loaded JSON (takes precedence over `src`) |
60
+ | `theme` | `'dark' \| 'light'` | `'dark'` | Color theme |
61
+ | `interactive` | `boolean` | `true` | Enable pan/zoom |
62
+ | `height` | `number \| string` | `400` | Container height |
63
+ | `width` | `number \| string` | `'100%'` | Container width |
64
+ | `padding` | `number` | `40` | Viewport padding |
65
+ | `onNodeClick` | `(node) => void` | — | Node click handler |
66
+ | `onEdgeClick` | `(edge) => void` | — | Edge click handler |
67
+ | `onError` | `(error) => void` | — | Error handler |
68
+
69
+ ### XircuitsGraphStatic
70
+
71
+ Same props as above, minus `interactive`, `onNodeClick`, `onEdgeClick`.
72
+
73
+ ## License
74
+
75
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpressai/xircuits-viewer-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "react": ">=18"
20
20
  },
21
21
  "dependencies": {
22
- "@xpressai/xircuits-viewer": "^0.1.0"
22
+ "@xpressai/xircuits-viewer": "^0.1.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "react": "^18.3.1",