@flowscape-ui/core-sdk 1.0.2 → 1.0.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 CHANGED
@@ -1,24 +1,30 @@
1
+ <div align="center">
2
+
1
3
  # 🎨 @flowscape-ui/core-sdk
2
4
 
3
- **Powerful 2D canvas engine built on Konva.js**
5
+ **Powerful 2D canvas engine built on Konva**
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/@flowscape-ui/core-sdk.svg)](https://www.npmjs.com/package/@flowscape-ui/core-sdk)
6
- [![Buy Me a Coffee](https://img.shields.io/badge/Donate-Buy%20Me%20a%20Coffee-FFDD00?logo=buymeacoffee&logoColor=000)](https://buymeacoffee.com/flowscape)
7
-
8
- [📖 Documentation](https://flowscape-ui.github.io/core-sdk-doc/) • [💡 Examples](https://flowscape-ui.github.io/core-sdk-doc/docs/guides/interactive-demo) • [📝 Changelog](#)
9
-
10
- ---
11
-
12
- ## ✨ Features
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@flowscape-ui/core-sdk)](https://bundlephobia.com/package/@flowscape-ui/core-sdk)
10
+ [![X (Twitter)](https://img.shields.io/badge/X-@FlowscapeUI-000000?logo=x&logoColor=white)](https://x.com/FlowscapeUI)
11
+
12
+ [![Documentation](https://img.shields.io/badge/📚_Documentation-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](https://flowscape-ui.github.io/core-sdk/)
13
+ [![Interactive Demo](https://img.shields.io/badge/🎮_Interactive_Demo-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](https://flowscape-ui.github.io/core-sdk/?path=/story/interactive-playground--interactive-playground)
14
+ [![Changelog](https://img.shields.io/badge/📝_Changelog-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](./CHANGELOG.md)
15
+
16
+ <img
17
+ src="./assets/readme/cover-image.png"
18
+ alt="Flowscape Canvas Demo"
19
+ width="900"
20
+ />
21
+ <img
22
+ src="./assets/readme/preview.gif"
23
+ alt="Flowscape Canvas Demo"
24
+ width="900"
25
+ />
13
26
 
14
- - 🎯 **Framework-agnostic** — works with React, Vue, Svelte, Angular or vanilla JS
15
- - 🧩 **Plugin system** — extensible architecture with ready-to-use plugins
16
- - 📐 **Complete toolset** — grid, rulers, guides, area selection
17
- - ⌨️ **Hotkeys** — Ctrl+C/V/X, Delete, Ctrl+G for grouping
18
- - 🎨 **Rich shapes** — rectangles, circles, text, images, arrows, stars
19
- - 🔄 **Transformations** — rotation, scaling, movement with aspect ratio lock
20
- - 📦 **TypeScript-first** — full typing out of the box
21
- - 🚀 **Optimized** — tree-shaking, ESM + CJS, source maps
27
+ </div>
22
28
 
23
29
  ---
24
30
 
@@ -27,26 +33,35 @@
27
33
  ```bash
28
34
  npm install @flowscape-ui/core-sdk
29
35
  # or
36
+ pnpm add @flowscape-ui/core-sdk
37
+ # or
30
38
  yarn add @flowscape-ui/core-sdk
31
39
  # or
32
40
  bun add @flowscape-ui/core-sdk
33
41
  ```
34
42
 
35
- ---
43
+ ## ✨ Features
44
+
45
+ - 🎯 **Framework-agnostic** - works with React, Vue, Svelte, Angular or vanilla JS
46
+ - 🧩 **Plugin system** - extensible architecture with ready-to-use plugins
47
+ - 📐 **Complete toolset** - grid, rulers, guides, area selection, alignment guides
48
+ - ⌨️ **Hotkeys** - Ctrl+C/V/X, Delete, Ctrl+G for grouping, Ctrl+Z/Shift+Z for undo/redo
49
+ - 🎨 **Rich shapes** - rectangles, circles, text, images, arrows, stars
50
+ - 🔄 **Transformations** - rotation, scaling, movement with aspect ratio lock
51
+ - ✏️ **Inline editing** - double-click text nodes to edit directly on canvas
52
+ - 🕐 **History system** - full undo/redo support with Ctrl+Z
53
+ - 📦 **TypeScript-first** - full typing out of the box
54
+ - 🚀 **High performance** - handles 1000+ nodes without FPS drops
55
+ - 🎨 **Addons API** - extend any component with custom functionality
36
56
 
37
57
  ## 🚀 Quick Start
38
58
 
39
59
  ```typescript
40
- import {
41
- CoreEngine,
42
- GridPlugin,
43
- SelectionPlugin,
44
- NodeHotkeysPlugin,
45
- } from "@flowscape-ui/core-sdk";
60
+ import { CoreEngine, GridPlugin, SelectionPlugin, NodeHotkeysPlugin } from '@flowscape-ui/core-sdk';
46
61
 
47
62
  // Create engine with plugins
48
63
  const engine = new CoreEngine({
49
- container: document.getElementById("canvas-container")!,
64
+ container: document.getElementById('canvas-container')!,
50
65
  width: 1200,
51
66
  height: 800,
52
67
  plugins: [
@@ -62,16 +77,16 @@ const rect = engine.nodes.addShape({
62
77
  y: 100,
63
78
  width: 200,
64
79
  height: 150,
65
- fill: "#3b82f6",
80
+ fill: '#3b82f6',
66
81
  cornerRadius: 8,
67
82
  });
68
83
 
69
84
  const text = engine.nodes.addText({
70
85
  x: 120,
71
86
  y: 140,
72
- text: "Hello Flowscape!",
87
+ text: 'Hello Flowscape!',
73
88
  fontSize: 24,
74
- fill: "white",
89
+ fill: 'white',
75
90
  });
76
91
 
77
92
  // Grouping
@@ -83,7 +98,11 @@ rect.getNode().moveTo(group.getNode());
83
98
  text.getNode().moveTo(group.getNode());
84
99
  ```
85
100
 
86
- ---
101
+ ## 🔒 Public API Policy
102
+
103
+ - All supported entities are exported only through the root package `@flowscape-ui/core-sdk`.
104
+ - The `src/public-api.ts` file contains the complete list of stable exports; anything outside this file is considered internal API and may change without notice.
105
+ - Do not import files directly via `@flowscape-ui/core-sdk/src/...` — such imports are not supported and may break during updates.
87
106
 
88
107
  ## 🏗️ Architecture
89
108
 
@@ -118,19 +137,19 @@ text.getNode().moveTo(group.getNode());
118
137
  Plugins extend engine functionality without modifying the core:
119
138
 
120
139
  ```typescript
121
- import { Plugin, CoreEngine } from "@flowscape-ui/core-sdk";
140
+ import { Plugin, CoreEngine } from '@flowscape-ui/core-sdk';
122
141
 
123
142
  class CustomPlugin extends Plugin {
124
143
  protected onAttach(core: CoreEngine): void {
125
144
  // Initialize on attach
126
- core.eventBus.on("node:created", (node) => {
127
- console.log("Node created:", node);
145
+ core.eventBus.on('node:created', (node) => {
146
+ console.log('Node created:', node);
128
147
  });
129
148
  }
130
149
 
131
150
  protected onDetach(core: CoreEngine): void {
132
151
  // Cleanup on detach
133
- core.eventBus.off("node:created");
152
+ core.eventBus.off('node:created');
134
153
  }
135
154
  }
136
155
 
@@ -143,7 +162,20 @@ const engine = new CoreEngine({
143
162
 
144
163
  ---
145
164
 
146
- ## 🧩 Built-in Plugins
165
+ | Plugin | Description |
166
+ | ---------------------- | ------------------------------------------------ |
167
+ | `GridPlugin` | Adaptive grid with automatic scaling |
168
+ | `SelectionPlugin` | Selection, transformation, drag & drop, grouping |
169
+ | `NodeHotkeysPlugin` | Copy/paste/cut nodes, delete, z-index management |
170
+ | `CameraHotkeysPlugin` | Zoom and pan controls with keyboard |
171
+ | `RulerPlugin` | Rulers with measurement units |
172
+ | `RulerGuidesPlugin` | Draggable guide lines from rulers |
173
+ | `RulerHighlightPlugin` | Ruler highlighting on hover |
174
+ | `RulerManagerPlugin` | Toggle rulers and manage guides |
175
+ | `AreaSelectionPlugin` | Area selection with frame (Shift+Drag) |
176
+ | `VisualGuidesPlugin` | Smart alignment guides during movement/resize |
177
+ | `HistoryPlugin` | Undo/redo functionality with Ctrl+Z |
178
+ | `LogoPlugin` | Watermark/logo on canvas |
147
179
 
148
180
  | Plugin | Description |
149
181
  | ------------------------ | ----------------------------------------------------- |
@@ -164,14 +196,16 @@ const engine = new CoreEngine({
164
196
 
165
197
  ### Node Operations (NodeHotkeysPlugin)
166
198
 
167
- | Shortcut | Action |
168
- | ---------------------- | ------------------------ |
169
- | `Ctrl+C` | Copy selected nodes |
170
- | `Ctrl+X` | Cut selected nodes |
171
- | `Ctrl+V` | Paste nodes |
172
- | `Delete` / `Backspace` | Delete selected nodes |
173
- | `Ctrl+]` | Move node up (z-index) |
174
- | `Ctrl+[` | Move node down (z-index) |
199
+ | Shortcut | Action |
200
+ | ---------------------- | ---------------------------- |
201
+ | `Ctrl+C` | Copy selected nodes |
202
+ | `Ctrl+X` | Cut selected nodes |
203
+ | `Ctrl+V` | Paste nodes |
204
+ | `Delete` / `Backspace` | Delete selected nodes |
205
+ | `Ctrl+]` | Move node forward (z-index) |
206
+ | `Ctrl+[` | Move node backward (z-index) |
207
+ | `Ctrl+Shift+]` | Bring to front |
208
+ | `Ctrl+Shift+[` | Send to back |
175
209
 
176
210
  ### Grouping (SelectionPlugin)
177
211
 
@@ -182,7 +216,14 @@ const engine = new CoreEngine({
182
216
  | `Shift+Click` | Add/remove node to/from selection |
183
217
  | `Shift` (during resize) | Lock aspect ratio |
184
218
 
185
- ### Camera Controls (CameraHotkeysPlugin)
219
+ #### History (HistoryPlugin)
220
+
221
+ | Shortcut | Action |
222
+ | -------------- | ------ |
223
+ | `Ctrl+Z` | Undo |
224
+ | `Ctrl+Shift+Z` | Redo |
225
+
226
+ #### Camera Controls (CameraHotkeysPlugin)
186
227
 
187
228
  | Shortcut | Action |
188
229
  | ------------------- | ----------- |
@@ -214,7 +255,7 @@ const rect = engine.nodes.addShape({
214
255
  y: 50,
215
256
  width: 200,
216
257
  height: 100,
217
- fill: "#10b981",
258
+ fill: '#10b981',
218
259
  cornerRadius: 12,
219
260
  });
220
261
 
@@ -223,8 +264,8 @@ const circle = engine.nodes.addCircle({
223
264
  x: 300,
224
265
  y: 100,
225
266
  radius: 50,
226
- fill: "#f59e0b",
227
- stroke: "#d97706",
267
+ fill: '#f59e0b',
268
+ stroke: '#d97706',
228
269
  strokeWidth: 3,
229
270
  });
230
271
 
@@ -232,10 +273,10 @@ const circle = engine.nodes.addCircle({
232
273
  const text = engine.nodes.addText({
233
274
  x: 400,
234
275
  y: 50,
235
- text: "Flowscape UI",
276
+ text: 'Flowscape UI',
236
277
  fontSize: 32,
237
- fontFamily: "Inter",
238
- fill: "#1f2937",
278
+ fontFamily: 'Inter',
279
+ fill: '#1f2937',
239
280
  });
240
281
 
241
282
  // Image
@@ -244,7 +285,7 @@ const image = engine.nodes.addImage({
244
285
  y: 200,
245
286
  width: 200,
246
287
  height: 150,
247
- src: "/path/to/image.jpg",
288
+ src: '/path/to/image.jpg',
248
289
  });
249
290
  ```
250
291
 
@@ -252,22 +293,22 @@ const image = engine.nodes.addImage({
252
293
 
253
294
  ```typescript
254
295
  // Subscribe to events
255
- engine.eventBus.on("node:created", (node) => {
256
- console.log("Node created:", node);
296
+ engine.eventBus.on('node:created', (node) => {
297
+ console.log('Node created:', node);
257
298
  });
258
299
 
259
- engine.eventBus.on("node:selected", (node) => {
260
- console.log("Node selected:", node);
300
+ engine.eventBus.on('node:selected', (node) => {
301
+ console.log('Node selected:', node);
261
302
  });
262
303
 
263
- engine.eventBus.on("camera:zoom", ({ scale }) => {
264
- console.log("Zoom changed:", scale);
304
+ engine.eventBus.on('camera:zoom', ({ scale }) => {
305
+ console.log('Zoom changed:', scale);
265
306
  });
266
307
 
267
308
  // Unsubscribe
268
309
  const handler = (node) => console.log(node);
269
- engine.eventBus.on("node:created", handler);
270
- engine.eventBus.off("node:created", handler);
310
+ engine.eventBus.on('node:created', handler);
311
+ engine.eventBus.off('node:created', handler);
271
312
  ```
272
313
 
273
314
  ### Grouping and Management
@@ -333,20 +374,6 @@ bun run lint:ts # TypeScript check
333
374
  bun run lint:fix # Auto-fix
334
375
  ```
335
376
 
336
- ---
337
-
338
- ## 📖 Documentation
339
-
340
- Full documentation is available at [flowscape-ui.github.io/core-sdk-doc/](https://flowscape-ui.github.io/core-sdk-doc/)
341
-
342
- - [Getting Started](https://flowscape-ui.github.io/core-sdk-doc/docs/getting-started/installation)
343
- - [Core Concepts](https://flowscape-ui.github.io/core-sdk-doc/docs/core-concepts/architecture)
344
- - [Plugins](https://flowscape-ui.github.io/core-sdk-doc/docs/plugins/overview)
345
- - [API Reference](https://flowscape-ui.github.io/core-sdk-doc/docs/api/reference)
346
- - [Interactive Demo](https://flowscape-ui.github.io/core-sdk-doc/docs/guides/interactive-demo)
347
-
348
- ---
349
-
350
377
  ## 📄 License
351
378
 
352
379
  MIT © Flowscape UI Team