@flowscape-ui/core-sdk 1.0.1 → 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
@@ -1,29 +1,48 @@
1
- <div align="center">
2
-
3
1
  # 🎨 @flowscape-ui/core-sdk
4
2
 
5
- **Powerful 2D canvas engine built on Konva**
3
+ **Powerful 2D canvas engine built on Konva.js**
6
4
 
7
5
  [![npm version](https://img.shields.io/npm/v/@flowscape-ui/core-sdk.svg)](https://www.npmjs.com/package/@flowscape-ui/core-sdk)
8
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
- [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/flowscape)
10
- [Documentation](https://github.com/Flowscape-UI/core-sdk#readme) • [Examples](https://github.com/Flowscape-UI/core-sdk/tree/main/playground) • [Changelog](./CHANGELOG.md)
11
7
  [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@flowscape-ui/core-sdk)](https://bundlephobia.com/package/@flowscape-ui/core-sdk)
12
8
 
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
13
  </div>
14
14
 
15
15
  ---
16
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
+
17
31
  ## ✨ Features
18
32
 
19
33
  - 🎯 **Framework-agnostic** — works with React, Vue, Svelte, Angular or vanilla JS
20
34
  - 🧩 **Plugin system** — extensible architecture with ready-to-use plugins
21
- - 📐 **Complete toolset** — grid, rulers, guides, area selection
22
- - ⌨️ **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
23
37
  - 🎨 **Rich shapes** — rectangles, circles, text, images, arrows, stars
24
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
25
41
  - 📦 **TypeScript-first** — full typing out of the box
26
- - 🚀 **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
44
+
45
+ ---
27
46
 
28
47
  ## 📦 Installation
29
48
 
@@ -35,13 +54,15 @@ yarn add @flowscape-ui/core-sdk
35
54
  bun add @flowscape-ui/core-sdk
36
55
  ```
37
56
 
57
+ ---
58
+
38
59
  ## 🚀 Quick Start
39
60
 
40
61
  ```typescript
41
62
  import { CoreEngine, GridPlugin, SelectionPlugin, NodeHotkeysPlugin } from '@flowscape-ui/core-sdk';
42
63
 
43
64
  // Create engine with plugins
44
- const core = new CoreEngine({
65
+ const engine = new CoreEngine({
45
66
  container: document.getElementById('canvas-container')!,
46
67
  width: 1200,
47
68
  height: 800,
@@ -53,7 +74,7 @@ const core = new CoreEngine({
53
74
  });
54
75
 
55
76
  // Add shapes
56
- const rect = core.nodes.addShape({
77
+ const rect = engine.nodes.addShape({
57
78
  x: 100,
58
79
  y: 100,
59
80
  width: 200,
@@ -62,7 +83,7 @@ const rect = core.nodes.addShape({
62
83
  cornerRadius: 8,
63
84
  });
64
85
 
65
- const text = core.nodes.addText({
86
+ const text = engine.nodes.addText({
66
87
  x: 120,
67
88
  y: 140,
68
89
  text: 'Hello Flowscape!',
@@ -71,7 +92,7 @@ const text = core.nodes.addText({
71
92
  });
72
93
 
73
94
  // Grouping
74
- const group = core.nodes.addGroup({
95
+ const group = engine.nodes.addGroup({
75
96
  x: 400,
76
97
  y: 200,
77
98
  });
@@ -79,6 +100,12 @@ rect.getNode().moveTo(group.getNode());
79
100
  text.getNode().moveTo(group.getNode());
80
101
  ```
81
102
 
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.
108
+
82
109
  ## 🏗️ Architecture
83
110
 
84
111
  ### Core Components
@@ -103,7 +130,6 @@ text.getNode().moveTo(group.getNode());
103
130
  │ ┌──────────────────────────────┐ │
104
131
  │ │ Camera Manager │ │
105
132
  │ │ - Zoom (Ctrl+Wheel) │ │
106
- │ │ - Pan (Space+Drag) │ │
107
133
  │ └──────────────────────────────┘ │
108
134
  └─────────────────────────────────────┘
109
135
  ```
@@ -113,7 +139,7 @@ text.getNode().moveTo(group.getNode());
113
139
  Plugins extend engine functionality without modifying the core:
114
140
 
115
141
  ```typescript
116
- import { Plugin } from '@flowscape-ui/core-sdk';
142
+ import { Plugin, CoreEngine } from '@flowscape-ui/core-sdk';
117
143
 
118
144
  class CustomPlugin extends Plugin {
119
145
  protected onAttach(core: CoreEngine): void {
@@ -130,13 +156,13 @@ class CustomPlugin extends Plugin {
130
156
  }
131
157
 
132
158
  // Usage
133
- const core = new CoreEngine({
159
+ const engine = new CoreEngine({
134
160
  container: element,
135
161
  plugins: [new CustomPlugin()],
136
162
  });
137
163
  ```
138
164
 
139
- ### Built-in Plugins
165
+ ---
140
166
 
141
167
  | Plugin | Description |
142
168
  | ---------------------- | ------------------------------------------------ |
@@ -149,49 +175,76 @@ const core = new CoreEngine({
149
175
  | `RulerHighlightPlugin` | Ruler highlighting on hover |
150
176
  | `RulerManagerPlugin` | Toggle rulers and manage guides |
151
177
  | `AreaSelectionPlugin` | Area selection with frame (Shift+Drag) |
178
+ | `VisualGuidesPlugin` | Smart alignment guides during movement/resize |
179
+ | `HistoryPlugin` | Undo/redo functionality with Ctrl+Z |
152
180
  | `LogoPlugin` | Watermark/logo on canvas |
153
181
 
154
- ### ⌨️ Keyboard Shortcuts
182
+ | Plugin | Description |
183
+ | ------------------------ | ----------------------------------------------------- |
184
+ | **GridPlugin** | Adaptive grid with automatic scaling and snap-to-grid |
185
+ | **SelectionPlugin** | Selection, transformation, drag & drop, grouping |
186
+ | **AreaSelectionPlugin** | Area selection with frame (Shift+Drag) |
187
+ | **NodeHotkeysPlugin** | Copy/paste/cut nodes, delete, z-index management |
188
+ | **CameraHotkeysPlugin** | Zoom and pan controls with keyboard |
189
+ | **RulerPlugin** | Rulers with measurement units |
190
+ | **RulerGuidesPlugin** | Draggable guide lines from rulers |
191
+ | **RulerHighlightPlugin** | Ruler highlighting on hover |
192
+ | **RulerManagerPlugin** | Toggle rulers and manage guides |
193
+ | **LogoPlugin** | Watermark/logo on canvas |
194
+
195
+ ---
155
196
 
156
- #### Node Operations (NodeHotkeysPlugin)
197
+ ## ⌨️ Keyboard Shortcuts
157
198
 
158
- | Shortcut | Action |
159
- | ---------------------- | ------------------------ |
160
- | `Ctrl+C` | Copy selected nodes |
161
- | `Ctrl+X` | Cut selected nodes |
162
- | `Ctrl+V` | Paste nodes |
163
- | `Delete` / `Backspace` | Delete selected nodes |
164
- | `Ctrl+]` | Move node up (z-index) |
165
- | `Ctrl+[` | Move node down (z-index) |
166
-
167
- #### Grouping (SelectionPlugin)
168
-
169
- | Shortcut | Action |
170
- | -------------- | --------------------------------- |
171
- | `Ctrl+G` | Group selected nodes |
172
- | `Ctrl+Shift+G` | Ungroup selected group |
173
- | `Shift+Click` | Add/remove node to/from selection |
174
- | `Shift` | Lock aspect ratio during resize |
199
+ ### Node Operations (NodeHotkeysPlugin)
200
+
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 |
211
+
212
+ ### Grouping (SelectionPlugin)
213
+
214
+ | Shortcut | Action |
215
+ | ----------------------- | --------------------------------- |
216
+ | `Ctrl+G` | Group selected nodes |
217
+ | `Ctrl+Shift+G` | Ungroup selected group |
218
+ | `Shift+Click` | Add/remove node to/from selection |
219
+ | `Shift` (during resize) | Lock aspect ratio |
220
+
221
+ #### History (HistoryPlugin)
222
+
223
+ | Shortcut | Action |
224
+ | -------------- | ------ |
225
+ | `Ctrl+Z` | Undo |
226
+ | `Ctrl+Shift+Z` | Redo |
175
227
 
176
228
  #### Camera Controls (CameraHotkeysPlugin)
177
229
 
178
- | Shortcut | Action |
179
- | ------------------- | ------------------ |
180
- | `Ctrl+Wheel` | Zoom in/out |
181
- | `+` / `=` | Zoom in |
182
- | `-` | Zoom out |
183
- | `Arrow Keys` | Pan camera |
184
- | `Space+Drag` | Pan camera (mouse) |
185
- | `Middle Mouse+Drag` | Pan camera |
186
- | `Right Mouse+Drag` | Pan camera |
230
+ | Shortcut | Action |
231
+ | ------------------- | ----------- |
232
+ | `Ctrl+Wheel` | Zoom in/out |
233
+ | `+` / `=` | Zoom in |
234
+ | `-` | Zoom out |
235
+ | `Arrow Keys` | Pan camera |
236
+ | `Middle Mouse+Drag` | Pan camera |
237
+ | `Right Mouse+Drag` | Pan camera |
187
238
 
188
- #### Ruler Controls (RulerManagerPlugin)
239
+ ### Ruler Controls (RulerManagerPlugin)
189
240
 
190
241
  | Shortcut | Action |
191
242
  | ---------------------- | ------------------------ |
192
243
  | `Shift+R` | Toggle rulers visibility |
193
244
  | `Delete` / `Backspace` | Delete active guide |
194
- | `Drag from ruler` | Create guide line |
245
+ | Drag from ruler | Create guide line |
246
+
247
+ ---
195
248
 
196
249
  ## 📚 Usage Examples
197
250
 
@@ -199,7 +252,7 @@ const core = new CoreEngine({
199
252
 
200
253
  ```typescript
201
254
  // Rectangle with rounded corners
202
- const rect = core.nodes.addShape({
255
+ const rect = engine.nodes.addShape({
203
256
  x: 50,
204
257
  y: 50,
205
258
  width: 200,
@@ -209,7 +262,7 @@ const rect = core.nodes.addShape({
209
262
  });
210
263
 
211
264
  // Circle
212
- const circle = core.nodes.addCircle({
265
+ const circle = engine.nodes.addCircle({
213
266
  x: 300,
214
267
  y: 100,
215
268
  radius: 50,
@@ -219,7 +272,7 @@ const circle = core.nodes.addCircle({
219
272
  });
220
273
 
221
274
  // Text
222
- const text = core.nodes.addText({
275
+ const text = engine.nodes.addText({
223
276
  x: 400,
224
277
  y: 50,
225
278
  text: 'Flowscape UI',
@@ -229,7 +282,7 @@ const text = core.nodes.addText({
229
282
  });
230
283
 
231
284
  // Image
232
- const image = core.nodes.addImage({
285
+ const image = engine.nodes.addImage({
233
286
  x: 100,
234
287
  y: 200,
235
288
  width: 200,
@@ -242,33 +295,33 @@ const image = core.nodes.addImage({
242
295
 
243
296
  ```typescript
244
297
  // Subscribe to events
245
- core.eventBus.on('node:created', (node) => {
298
+ engine.eventBus.on('node:created', (node) => {
246
299
  console.log('Node created:', node);
247
300
  });
248
301
 
249
- core.eventBus.on('node:selected', (node) => {
302
+ engine.eventBus.on('node:selected', (node) => {
250
303
  console.log('Node selected:', node);
251
304
  });
252
305
 
253
- core.eventBus.on('camera:zoom', ({ scale }) => {
306
+ engine.eventBus.on('camera:zoom', ({ scale }) => {
254
307
  console.log('Zoom changed:', scale);
255
308
  });
256
309
 
257
310
  // Unsubscribe
258
311
  const handler = (node) => console.log(node);
259
- core.eventBus.on('node:created', handler);
260
- core.eventBus.off('node:created', handler);
312
+ engine.eventBus.on('node:created', handler);
313
+ engine.eventBus.off('node:created', handler);
261
314
  ```
262
315
 
263
316
  ### Grouping and Management
264
317
 
265
318
  ```typescript
266
319
  // Create group
267
- const group = core.nodes.addGroup({ x: 0, y: 0 });
320
+ const group = engine.nodes.addGroup({ x: 0, y: 0 });
268
321
 
269
322
  // Add nodes to group
270
- const rect1 = core.nodes.addShape({ x: 10, y: 10, width: 50, height: 50 });
271
- const rect2 = core.nodes.addShape({ x: 70, y: 10, width: 50, height: 50 });
323
+ const rect1 = engine.nodes.addShape({ x: 10, y: 10, width: 50, height: 50 });
324
+ const rect2 = engine.nodes.addShape({ x: 70, y: 10, width: 50, height: 50 });
272
325
 
273
326
  rect1.getNode().moveTo(group.getNode());
274
327
  rect2.getNode().moveTo(group.getNode());
@@ -283,21 +336,23 @@ rect1.getNode().moveToTop(); // Move to top
283
336
 
284
337
  ```typescript
285
338
  // Programmatic zoom
286
- core.camera.zoomIn(); // Zoom in
287
- core.camera.zoomOut(); // Zoom out
288
- core.camera.setZoom(1.5); // Set specific scale
339
+ engine.camera.zoomIn(); // Zoom in
340
+ engine.camera.zoomOut(); // Zoom out
341
+ engine.camera.setZoom(1.5); // Set specific scale
289
342
 
290
343
  // Panning
291
- core.camera.pan(100, 50); // Pan by dx, dy
344
+ engine.camera.pan(100, 50); // Pan by dx, dy
292
345
 
293
346
  // Center on node
294
- const node = core.nodes.addShape({ x: 500, y: 500, width: 100, height: 100 });
295
- core.camera.centerOn(node);
347
+ const node = engine.nodes.addShape({ x: 500, y: 500, width: 100, height: 100 });
348
+ engine.camera.centerOn(node);
296
349
 
297
350
  // Reset camera
298
- core.camera.reset();
351
+ engine.camera.reset();
299
352
  ```
300
353
 
354
+ ---
355
+
301
356
  ## 🔧 Development
302
357
 
303
358
  ```bash
@@ -321,18 +376,14 @@ bun run lint:ts # TypeScript check
321
376
  bun run lint:fix # Auto-fix
322
377
  ```
323
378
 
324
- ## 📖 Documentation
325
-
326
- Coming soon
327
-
328
379
  ## 📄 License
329
380
 
330
- MIT © [Flowscape UI Team](https://github.com/Flowscape-UI)
381
+ MIT © Flowscape UI Team
331
382
 
332
383
  ---
333
384
 
334
385
  <div align="center">
335
386
 
336
- **[⭐ Star on GitHub](https://github.com/Flowscape-UI/core-sdk)****[🐛 Report Bug](https://github.com/Flowscape-UI/core-sdk/issues)****[💡 Request Feature](https://github.com/Flowscape-UI/core-sdk/issues/new)**
387
+ [Star on GitHub](https://github.com/Flowscape-UI/core-sdk) • 🐛 [Report Bug](https://github.com/Flowscape-UI/core-sdk/issues) • 💡 [Request Feature](https://github.com/Flowscape-UI/core-sdk/issues)
337
388
 
338
389
  </div>