f1ow 0.1.3 β 0.1.4
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 +32 -8
- package/dist/f1ow.js +4327 -3447
- package/dist/f1ow.umd.cjs +252 -7
- package/package.json +99 -94
package/README.md
CHANGED
|
@@ -37,14 +37,25 @@
|
|
|
37
37
|
## π¦ Installation
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
|
|
40
|
+
# npm
|
|
41
|
+
npm install f1ow konva react-konva zustand
|
|
42
|
+
|
|
43
|
+
# pnpm
|
|
44
|
+
pnpm add f1ow konva react-konva zustand
|
|
45
|
+
|
|
46
|
+
# yarn
|
|
47
|
+
yarn add f1ow konva react-konva zustand
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
>
|
|
50
|
+
> `react` and `react-dom` are assumed to already be in your project. If not, add them too:
|
|
51
|
+
> ```bash
|
|
52
|
+
> npm install react react-dom
|
|
53
|
+
> ```
|
|
54
|
+
|
|
55
|
+
> **Optional β Collaboration only:** install these when using the `collaboration` prop:
|
|
56
|
+
> ```bash
|
|
57
|
+
> npm install yjs y-websocket
|
|
58
|
+
> ```
|
|
48
59
|
|
|
49
60
|
### Next.js / Non-Vite Bundlers
|
|
50
61
|
|
|
@@ -98,6 +109,7 @@ That's it β you get a full-featured canvas editor with a toolbar, style panel,
|
|
|
98
109
|
| `width` / `height` | `number \| string` | `'100%'` | Canvas dimensions |
|
|
99
110
|
| `tools` | `ToolType[]` | all | Visible tools in toolbar |
|
|
100
111
|
| `defaultTool` | `ToolType` | `'select'` | Default active tool on mount |
|
|
112
|
+
| `defaultStyle` | `Partial<ElementStyle>` | β | Default drawing style for new elements |
|
|
101
113
|
| `toolbarPosition` | `'top' \| 'bottom' \| 'hidden'` | `'bottom'` | Position of the main toolbar |
|
|
102
114
|
| `showToolbar` | `boolean` | `true` | Show toolbar (legacy, use `toolbarPosition`) |
|
|
103
115
|
| `showStylePanel` | `boolean` | `true` | Show style panel |
|
|
@@ -135,6 +147,7 @@ const ref = useRef<FlowCanvasRef>(null);
|
|
|
135
147
|
| `setSelectedIds(ids)` | β | Set selection |
|
|
136
148
|
| `clearSelection()` | β | Deselect all |
|
|
137
149
|
| `setActiveTool(tool)` | β | Switch tool |
|
|
150
|
+
| `getActiveTool()` | `ToolType` | Get current active tool |
|
|
138
151
|
| `undo()` / `redo()` | β | History navigation |
|
|
139
152
|
| `zoomTo(scale)` | β | Set zoom level |
|
|
140
153
|
| `resetView()` | β | Reset pan & zoom |
|
|
@@ -199,12 +212,23 @@ Append custom items or fully replace the built-in menu:
|
|
|
199
212
|
|
|
200
213
|
## π€ Collaboration (Experimental)
|
|
201
214
|
|
|
215
|
+
First install the optional peer dependencies:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npm install yjs y-websocket
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Then pass a `CollaborationConfig` to the `collaboration` prop:
|
|
222
|
+
|
|
202
223
|
```tsx
|
|
203
224
|
<FlowCanvas
|
|
204
225
|
collaboration={{
|
|
205
|
-
|
|
206
|
-
|
|
226
|
+
serverUrl: "wss://my-yjs-server.example.com",
|
|
227
|
+
roomName: "my-room",
|
|
207
228
|
user: { id: "user-1", name: "Alice", color: "#e03131" },
|
|
229
|
+
// authToken: "...", // optional auth token
|
|
230
|
+
// syncDebounceMs: 50, // localβremote debounce (ms)
|
|
231
|
+
// awarenessThrottleMs: 100 // cursor sharing throttle (ms)
|
|
208
232
|
}}
|
|
209
233
|
/>
|
|
210
234
|
```
|