@flowscape-ui/core-sdk 1.0.2 → 1.0.3

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
@@ -3,22 +3,44 @@
3
3
  **Powerful 2D canvas engine built on Konva.js**
4
4
 
5
5
  [![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)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@flowscape-ui/core-sdk)](https://bundlephobia.com/package/@flowscape-ui/core-sdk)
7
8
 
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
+ [![Documentation](https://img.shields.io/badge/📚_Documentation-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](https://flowscape-ui.github.io/core-sdk/)
10
+ [![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)
11
+ [![Changelog](https://img.shields.io/badge/📝_Changelog-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](./CHANGELOG.md)
12
+
13
+ </div>
9
14
 
10
15
  ---
11
16
 
17
+ ## 📖 Documentation
18
+
19
+ ### What's New in 1.0.3
20
+
21
+ - ✨ **History System** — Full undo/redo support (Ctrl+Z / Ctrl+Shift+Z)
22
+ - 📏 **Alignment Guides** — Smart guides appear during movement and resizing
23
+ - ✏️ **Inline Text Editing** — Double-click text nodes to edit directly
24
+ - 🔧 **Addons API** — Attach custom functionality to any component
25
+ - 📐 **Canvas Auto-Resize** — Automatically adjusts to window size changes
26
+ - ⚡ **Performance** — Optimized to handle 1000+ nodes smoothly
27
+ - 🎨 **New Layer Shortcuts** — Ctrl+Shift+[ / ] for send to back/bring to front
28
+ - 📦 **Full TypeScript** — Complete type coverage across all components
29
+ - 🎮 **Storybook Demo** — Interactive playground to test all features
30
+
12
31
  ## ✨ Features
13
32
 
14
33
  - 🎯 **Framework-agnostic** — works with React, Vue, Svelte, Angular or vanilla JS
15
34
  - 🧩 **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
35
+ - 📐 **Complete toolset** — grid, rulers, guides, area selection, alignment guides
36
+ - ⌨️ **Hotkeys** — Ctrl+C/V/X, Delete, Ctrl+G for grouping, Ctrl+Z/Shift+Z for undo/redo
18
37
  - 🎨 **Rich shapes** — rectangles, circles, text, images, arrows, stars
19
38
  - 🔄 **Transformations** — rotation, scaling, movement with aspect ratio lock
39
+ - ✏️ **Inline editing** — double-click text nodes to edit directly on canvas
40
+ - 🕐 **History system** — full undo/redo support with Ctrl+Z
20
41
  - 📦 **TypeScript-first** — full typing out of the box
21
- - 🚀 **Optimized** — tree-shaking, ESM + CJS, source maps
42
+ - 🚀 **High performance** — handles 1000+ nodes without FPS drops
43
+ - 🎨 **Addons API** — extend any component with custom functionality
22
44
 
23
45
  ---
24
46
 
@@ -37,16 +59,11 @@ bun add @flowscape-ui/core-sdk
37
59
  ## 🚀 Quick Start
38
60
 
39
61
  ```typescript
40
- import {
41
- CoreEngine,
42
- GridPlugin,
43
- SelectionPlugin,
44
- NodeHotkeysPlugin,
45
- } from "@flowscape-ui/core-sdk";
62
+ import { CoreEngine, GridPlugin, SelectionPlugin, NodeHotkeysPlugin } from '@flowscape-ui/core-sdk';
46
63
 
47
64
  // Create engine with plugins
48
65
  const engine = new CoreEngine({
49
- container: document.getElementById("canvas-container")!,
66
+ container: document.getElementById('canvas-container')!,
50
67
  width: 1200,
51
68
  height: 800,
52
69
  plugins: [
@@ -62,16 +79,16 @@ const rect = engine.nodes.addShape({
62
79
  y: 100,
63
80
  width: 200,
64
81
  height: 150,
65
- fill: "#3b82f6",
82
+ fill: '#3b82f6',
66
83
  cornerRadius: 8,
67
84
  });
68
85
 
69
86
  const text = engine.nodes.addText({
70
87
  x: 120,
71
88
  y: 140,
72
- text: "Hello Flowscape!",
89
+ text: 'Hello Flowscape!',
73
90
  fontSize: 24,
74
- fill: "white",
91
+ fill: 'white',
75
92
  });
76
93
 
77
94
  // Grouping
@@ -83,7 +100,11 @@ rect.getNode().moveTo(group.getNode());
83
100
  text.getNode().moveTo(group.getNode());
84
101
  ```
85
102
 
86
- ---
103
+ ## 🔒 Public API Policy
104
+
105
+ - All supported entities are exported only through the root package `@flowscape-ui/core-sdk`.
106
+ - 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.
107
+ - Do not import files directly via `@flowscape-ui/core-sdk/src/...` — such imports are not supported and may break during updates.
87
108
 
88
109
  ## 🏗️ Architecture
89
110
 
@@ -118,19 +139,19 @@ text.getNode().moveTo(group.getNode());
118
139
  Plugins extend engine functionality without modifying the core:
119
140
 
120
141
  ```typescript
121
- import { Plugin, CoreEngine } from "@flowscape-ui/core-sdk";
142
+ import { Plugin, CoreEngine } from '@flowscape-ui/core-sdk';
122
143
 
123
144
  class CustomPlugin extends Plugin {
124
145
  protected onAttach(core: CoreEngine): void {
125
146
  // Initialize on attach
126
- core.eventBus.on("node:created", (node) => {
127
- console.log("Node created:", node);
147
+ core.eventBus.on('node:created', (node) => {
148
+ console.log('Node created:', node);
128
149
  });
129
150
  }
130
151
 
131
152
  protected onDetach(core: CoreEngine): void {
132
153
  // Cleanup on detach
133
- core.eventBus.off("node:created");
154
+ core.eventBus.off('node:created');
134
155
  }
135
156
  }
136
157
 
@@ -143,7 +164,20 @@ const engine = new CoreEngine({
143
164
 
144
165
  ---
145
166
 
146
- ## 🧩 Built-in Plugins
167
+ | Plugin | Description |
168
+ | ---------------------- | ------------------------------------------------ |
169
+ | `GridPlugin` | Adaptive grid with automatic scaling |
170
+ | `SelectionPlugin` | Selection, transformation, drag & drop, grouping |
171
+ | `NodeHotkeysPlugin` | Copy/paste/cut nodes, delete, z-index management |
172
+ | `CameraHotkeysPlugin` | Zoom and pan controls with keyboard |
173
+ | `RulerPlugin` | Rulers with measurement units |
174
+ | `RulerGuidesPlugin` | Draggable guide lines from rulers |
175
+ | `RulerHighlightPlugin` | Ruler highlighting on hover |
176
+ | `RulerManagerPlugin` | Toggle rulers and manage guides |
177
+ | `AreaSelectionPlugin` | Area selection with frame (Shift+Drag) |
178
+ | `VisualGuidesPlugin` | Smart alignment guides during movement/resize |
179
+ | `HistoryPlugin` | Undo/redo functionality with Ctrl+Z |
180
+ | `LogoPlugin` | Watermark/logo on canvas |
147
181
 
148
182
  | Plugin | Description |
149
183
  | ------------------------ | ----------------------------------------------------- |
@@ -164,14 +198,16 @@ const engine = new CoreEngine({
164
198
 
165
199
  ### Node Operations (NodeHotkeysPlugin)
166
200
 
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) |
201
+ | Shortcut | Action |
202
+ | ---------------------- | ---------------------------- |
203
+ | `Ctrl+C` | Copy selected nodes |
204
+ | `Ctrl+X` | Cut selected nodes |
205
+ | `Ctrl+V` | Paste nodes |
206
+ | `Delete` / `Backspace` | Delete selected nodes |
207
+ | `Ctrl+]` | Move node forward (z-index) |
208
+ | `Ctrl+[` | Move node backward (z-index) |
209
+ | `Ctrl+Shift+]` | Bring to front |
210
+ | `Ctrl+Shift+[` | Send to back |
175
211
 
176
212
  ### Grouping (SelectionPlugin)
177
213
 
@@ -182,7 +218,14 @@ const engine = new CoreEngine({
182
218
  | `Shift+Click` | Add/remove node to/from selection |
183
219
  | `Shift` (during resize) | Lock aspect ratio |
184
220
 
185
- ### Camera Controls (CameraHotkeysPlugin)
221
+ #### History (HistoryPlugin)
222
+
223
+ | Shortcut | Action |
224
+ | -------------- | ------ |
225
+ | `Ctrl+Z` | Undo |
226
+ | `Ctrl+Shift+Z` | Redo |
227
+
228
+ #### Camera Controls (CameraHotkeysPlugin)
186
229
 
187
230
  | Shortcut | Action |
188
231
  | ------------------- | ----------- |
@@ -214,7 +257,7 @@ const rect = engine.nodes.addShape({
214
257
  y: 50,
215
258
  width: 200,
216
259
  height: 100,
217
- fill: "#10b981",
260
+ fill: '#10b981',
218
261
  cornerRadius: 12,
219
262
  });
220
263
 
@@ -223,8 +266,8 @@ const circle = engine.nodes.addCircle({
223
266
  x: 300,
224
267
  y: 100,
225
268
  radius: 50,
226
- fill: "#f59e0b",
227
- stroke: "#d97706",
269
+ fill: '#f59e0b',
270
+ stroke: '#d97706',
228
271
  strokeWidth: 3,
229
272
  });
230
273
 
@@ -232,10 +275,10 @@ const circle = engine.nodes.addCircle({
232
275
  const text = engine.nodes.addText({
233
276
  x: 400,
234
277
  y: 50,
235
- text: "Flowscape UI",
278
+ text: 'Flowscape UI',
236
279
  fontSize: 32,
237
- fontFamily: "Inter",
238
- fill: "#1f2937",
280
+ fontFamily: 'Inter',
281
+ fill: '#1f2937',
239
282
  });
240
283
 
241
284
  // Image
@@ -244,7 +287,7 @@ const image = engine.nodes.addImage({
244
287
  y: 200,
245
288
  width: 200,
246
289
  height: 150,
247
- src: "/path/to/image.jpg",
290
+ src: '/path/to/image.jpg',
248
291
  });
249
292
  ```
250
293
 
@@ -252,22 +295,22 @@ const image = engine.nodes.addImage({
252
295
 
253
296
  ```typescript
254
297
  // Subscribe to events
255
- engine.eventBus.on("node:created", (node) => {
256
- console.log("Node created:", node);
298
+ engine.eventBus.on('node:created', (node) => {
299
+ console.log('Node created:', node);
257
300
  });
258
301
 
259
- engine.eventBus.on("node:selected", (node) => {
260
- console.log("Node selected:", node);
302
+ engine.eventBus.on('node:selected', (node) => {
303
+ console.log('Node selected:', node);
261
304
  });
262
305
 
263
- engine.eventBus.on("camera:zoom", ({ scale }) => {
264
- console.log("Zoom changed:", scale);
306
+ engine.eventBus.on('camera:zoom', ({ scale }) => {
307
+ console.log('Zoom changed:', scale);
265
308
  });
266
309
 
267
310
  // Unsubscribe
268
311
  const handler = (node) => console.log(node);
269
- engine.eventBus.on("node:created", handler);
270
- engine.eventBus.off("node:created", handler);
312
+ engine.eventBus.on('node:created', handler);
313
+ engine.eventBus.off('node:created', handler);
271
314
  ```
272
315
 
273
316
  ### Grouping and Management
@@ -333,20 +376,6 @@ bun run lint:ts # TypeScript check
333
376
  bun run lint:fix # Auto-fix
334
377
  ```
335
378
 
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
379
  ## 📄 License
351
380
 
352
381
  MIT © Flowscape UI Team