@knotx/plugins-drag 0.4.12 → 0.4.14

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.en.md ADDED
@@ -0,0 +1,372 @@
1
+ # @knotx/plugins-drag
2
+
3
+ Drag plugin that provides node dragging functionality for KnotX.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @knotx/plugins-drag
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ The Drag plugin provides powerful node dragging functionality for KnotX, supporting inertia dragging, boundary restrictions, edge scrolling, and other advanced features. This plugin is built on the `interactjs` library and offers flexible drag configuration and smooth dragging experience.
14
+
15
+ ## Implementation Principle
16
+
17
+ The core implementation principles of the Drag plugin:
18
+
19
+ 1. **InteractJS Integration**: Uses the `interactjs` library to handle drag interactions
20
+ 2. **Drag Transformers**: Supports transformer system for dynamically modifying drag configurations
21
+ 3. **Edge Scrolling**: Automatically scrolls the canvas when dragging to canvas edges
22
+ 4. **Inertia Dragging**: Supports inertia drag effects for more natural interaction experience
23
+
24
+ ## Dependencies
25
+
26
+ ### Core Dependencies
27
+ - `@knotx/core`: Provides base plugin architecture
28
+ - `@knotx/decorators`: Provides decorator support
29
+ - `interactjs`: Provides drag interaction functionality
30
+ - `rxjs`: Provides reactive programming support
31
+
32
+ ### Plugin Dependencies
33
+ - `@knotx/plugins-canvas`: Retrieves canvas transform state and edge scroll configuration (optional)
34
+
35
+ ## API Documentation
36
+
37
+ ### Main Classes
38
+
39
+ #### Drag
40
+
41
+ The main class of the Drag plugin, extending `BasePlugin`.
42
+
43
+ ```typescript
44
+ export class Drag extends BasePlugin {
45
+ name = 'drag' as const
46
+ }
47
+ ```
48
+
49
+ ### Configuration Options
50
+
51
+ #### DraggableOptions
52
+
53
+ ```typescript
54
+ export type DraggableOptions = Omit<InteractDraggableOptions, 'listeners'>
55
+
56
+ interface DraggableOptions {
57
+ /** Inertia configuration */
58
+ inertia?: {
59
+ enabled?: boolean
60
+ resistance?: number
61
+ minSpeed?: number
62
+ endSpeed?: number
63
+ smoothEndDuration?: number
64
+ }
65
+ /** Modifier configuration */
66
+ modifiers?: Modifier[]
67
+ /** Other InteractJS configurations */
68
+ [key: string]: any
69
+ }
70
+ ```
71
+
72
+ ### Plugin Data (PluginData)
73
+
74
+ The Drag plugin provides the following data:
75
+
76
+ ```typescript
77
+ interface PluginData {
78
+ drag: {
79
+ options: DraggableOptions
80
+ registerOptionsTransformer: (transformer: DragOptionsTransformer) => () => void
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Type Definitions
86
+
87
+ #### DragOptionsTransformer
88
+
89
+ ```typescript
90
+ export interface DragTransformerContext {
91
+ nodeId: string
92
+ node: Node
93
+ defaultOptions: DraggableOptions
94
+ currentOptions: DraggableOptions
95
+ }
96
+
97
+ export type DragOptionsTransformer = (context: DragTransformerContext) => DraggableOptions | undefined
98
+ ```
99
+
100
+ ## Usage Examples
101
+
102
+ ### Basic Usage
103
+
104
+ ```typescript
105
+ import { Drag } from '@knotx/plugins-drag'
106
+
107
+ const engine = new Engine({
108
+ plugins: [Drag],
109
+ })
110
+ ```
111
+
112
+ ### Custom Drag Configuration
113
+
114
+ ```typescript
115
+ const engine = new Engine({
116
+ plugins: [Drag],
117
+ })
118
+
119
+ // Get plugin data
120
+ const dragData = engine.getPluginData('drag')
121
+
122
+ // Modify default configuration
123
+ dragData.options = {
124
+ inertia: {
125
+ enabled: true,
126
+ resistance: 30,
127
+ minSpeed: 200,
128
+ endSpeed: 10,
129
+ },
130
+ modifiers: [
131
+ interact.modifiers.restrictRect({
132
+ restriction: 'parent',
133
+ endOnly: true,
134
+ }),
135
+ ],
136
+ }
137
+ ```
138
+
139
+ ### Using Drag Transformers
140
+
141
+ ```typescript
142
+ const engine = new Engine({
143
+ plugins: [Drag],
144
+ })
145
+
146
+ const dragData = engine.getPluginData('drag')
147
+
148
+ // Register drag transformer
149
+ const unregister = dragData.registerOptionsTransformer((context) => {
150
+ const { nodeId, node, defaultOptions, currentOptions } = context
151
+
152
+ // Modify drag configuration based on node type or state
153
+ if (node.type === 'locked') {
154
+ return {
155
+ ...currentOptions,
156
+ enabled: false, // Disable dragging
157
+ }
158
+ }
159
+
160
+ if (node.type === 'slow') {
161
+ return {
162
+ ...currentOptions,
163
+ inertia: {
164
+ ...currentOptions.inertia,
165
+ resistance: 100, // Increase resistance
166
+ },
167
+ }
168
+ }
169
+
170
+ return currentOptions
171
+ })
172
+
173
+ // Unregister
174
+ unregister()
175
+ ```
176
+
177
+ ### Boundary Restrictions
178
+
179
+ ```typescript
180
+ const engine = new Engine({
181
+ plugins: [Drag],
182
+ })
183
+
184
+ const dragData = engine.getPluginData('drag')
185
+
186
+ // Restrict drag area
187
+ dragData.options = {
188
+ modifiers: [
189
+ interact.modifiers.restrictRect({
190
+ restriction: '.canvas-container',
191
+ endOnly: true,
192
+ }),
193
+ ],
194
+ }
195
+ ```
196
+
197
+ ### Grid Snapping
198
+
199
+ ```typescript
200
+ const engine = new Engine({
201
+ plugins: [Drag],
202
+ })
203
+
204
+ const dragData = engine.getPluginData('drag')
205
+
206
+ // Grid snapping
207
+ dragData.options = {
208
+ modifiers: [
209
+ interact.modifiers.snap({
210
+ targets: [
211
+ interact.snappers.grid({ x: 20, y: 20 }),
212
+ ],
213
+ range: Infinity,
214
+ relativePoints: [{ x: 0, y: 0 }],
215
+ }),
216
+ ],
217
+ }
218
+ ```
219
+
220
+ ### Integration with Canvas Plugin
221
+
222
+ ```typescript
223
+ import { Canvas } from '@knotx/plugins-canvas'
224
+ import { Drag } from '@knotx/plugins-drag'
225
+
226
+ const engine = new Engine({
227
+ plugins: [Canvas, Drag],
228
+ pluginConfig: {
229
+ canvas: {
230
+ minScale: 0.1,
231
+ maxScale: 3,
232
+ },
233
+ },
234
+ })
235
+
236
+ // Enable edge scrolling
237
+ const canvasData = engine.getPluginData('canvas')
238
+ canvasData.edgeScroll.setConfig({
239
+ enabled: true,
240
+ edgeSize: 100,
241
+ maxSpeed: 10,
242
+ })
243
+ ```
244
+
245
+ ## Advanced Features
246
+
247
+ ### Dynamic Drag Configuration
248
+
249
+ ```typescript
250
+ class DynamicDragPlugin extends BasePlugin {
251
+ @inject.drag.registerOptionsTransformer()
252
+ registerOptionsTransformer!: (transformer: DragOptionsTransformer) => () => void
253
+
254
+ @inject.selection.selected()
255
+ selected!: SelectionSelectedItem[]
256
+
257
+ @OnInit
258
+ init() {
259
+ this.registerOptionsTransformer((context) => {
260
+ const { nodeId, currentOptions } = context
261
+
262
+ // Special configuration for multi-selection dragging
263
+ const isMultiSelected = this.selected.length > 1
264
+ && this.selected.some(item => item.id === nodeId)
265
+
266
+ if (isMultiSelected) {
267
+ return {
268
+ ...currentOptions,
269
+ inertia: {
270
+ ...currentOptions.inertia,
271
+ enabled: false, // Disable inertia for multi-selection
272
+ },
273
+ }
274
+ }
275
+
276
+ return currentOptions
277
+ })
278
+ }
279
+ }
280
+ ```
281
+
282
+ ### Custom Drag Modifiers
283
+
284
+ ```typescript
285
+ const engine = new Engine({
286
+ plugins: [Drag],
287
+ })
288
+
289
+ const dragData = engine.getPluginData('drag')
290
+
291
+ // Create custom modifier
292
+ const customModifier = {
293
+ set(coords: any) {
294
+ // Custom position calculation logic
295
+ coords.x = Math.round(coords.x / 10) * 10 // 10px grid alignment
296
+ coords.y = Math.round(coords.y / 10) * 10
297
+ return coords
298
+ },
299
+ }
300
+
301
+ dragData.options = {
302
+ modifiers: [customModifier],
303
+ }
304
+ ```
305
+
306
+ ### Drag Status Monitoring
307
+
308
+ ```typescript
309
+ class DragStatusPlugin extends BasePlugin {
310
+ @inject.canvas.edgeScroll()
311
+ edgeScroll!: PluginData['canvas']['edgeScroll']
312
+
313
+ @subscribe.drag.isDragging()
314
+ onDragStatusChange(isDragging: boolean) {
315
+ if (isDragging) {
316
+ console.log('Start dragging')
317
+ // Enable edge scrolling when dragging starts
318
+ this.edgeScroll.setConfig({ enabled: true })
319
+ }
320
+ else {
321
+ console.log('End dragging')
322
+ // Disable edge scrolling when dragging ends
323
+ this.edgeScroll.setConfig({ enabled: false })
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
329
+ ## File Directory Structure
330
+
331
+ ```
332
+ packages/plugins-drag/
333
+ ├── src/
334
+ │ ├── drag.tsx # Main implementation file
335
+ │ └── index.ts # Export file
336
+ ├── dist/ # Build output directory
337
+ ├── package.json # Package configuration
338
+ ├── build.config.ts # Build configuration
339
+ ├── tsconfig.json # TypeScript configuration
340
+ ├── eslint.config.mjs # ESLint configuration
341
+ └── CHANGELOG.md # Changelog
342
+ ```
343
+
344
+ ### Core Files Description
345
+
346
+ - **drag.tsx**: Contains the main implementation of the Drag plugin, including InteractJS integration, drag transformer system, and edge scrolling handling
347
+ - **index.ts**: Exports the Drag class and related type definitions
348
+
349
+ ## Best Practices
350
+
351
+ ### Performance Optimization
352
+
353
+ 1. **Reasonable Use of Inertia**: Inertia effects provide better user experience but may impact performance with many nodes
354
+ 2. **Restrict Drag Area**: Use `restrictRect` modifier to limit drag area and prevent nodes from being dragged to unreasonable positions
355
+ 3. **Batch Operations**: Combine with `@knotx/plugins-batch` plugin to optimize batch drag operations
356
+
357
+ ### User Experience
358
+
359
+ 1. **Visual Feedback**: Provide clear visual feedback during dragging, such as shadows, transparency changes, etc.
360
+ 2. **Grid Alignment**: Enable grid alignment in scenarios requiring precise positioning
361
+ 3. **Edge Scrolling**: Enable edge scrolling functionality to improve drag experience in large canvases
362
+
363
+ ## Notes
364
+
365
+ 1. **Event Conflicts**: May have event conflicts with other interaction plugins (like selection); pay attention to event priority
366
+ 2. **Memory Management**: Clean up unnecessary drag transformers promptly to avoid memory leaks
367
+ 3. **Performance Considerations**: With many nodes, drag operations may impact performance; consider using virtualization
368
+ 4. **Mobile Adaptation**: Consider touch event handling on mobile devices
369
+
370
+ ## License
371
+
372
+ MIT
package/README.md ADDED
@@ -0,0 +1,372 @@
1
+ # @knotx/plugins-drag
2
+
3
+ 拖拽插件,为 KnotX 提供节点拖拽功能。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @knotx/plugins-drag
9
+ ```
10
+
11
+ ## 概述
12
+
13
+ Drag 插件为 KnotX 提供了强大的节点拖拽功能,支持惯性拖拽、边界限制、边缘滚动等高级特性。该插件基于 `interactjs` 库实现,提供了灵活的拖拽配置和流畅的拖拽体验。
14
+
15
+ ## 实现原理
16
+
17
+ Drag 插件的核心实现原理:
18
+
19
+ 1. **InteractJS 集成**:使用 `interactjs` 库处理拖拽交互
20
+ 2. **拖拽变换器**:支持动态修改拖拽配置的变换器系统
21
+ 3. **边缘滚动**:拖拽到画布边缘时自动滚动画布
22
+ 4. **惯性拖拽**:支持惯性拖拽效果,提供更自然的交互体验
23
+
24
+ ## 依赖关系
25
+
26
+ ### 核心依赖
27
+ - `@knotx/core`:提供基础插件架构
28
+ - `@knotx/decorators`:提供装饰器支持
29
+ - `interactjs`:提供拖拽交互功能
30
+ - `rxjs`:提供响应式编程支持
31
+
32
+ ### 插件依赖
33
+ - `@knotx/plugins-canvas`:获取画布变换状态和边缘滚动配置(可选)
34
+
35
+ ## API 文档
36
+
37
+ ### 主要类
38
+
39
+ #### Drag
40
+
41
+ 拖拽插件的主要类,继承自 `BasePlugin`。
42
+
43
+ ```typescript
44
+ export class Drag extends BasePlugin {
45
+ name = 'drag' as const
46
+ }
47
+ ```
48
+
49
+ ### 配置选项
50
+
51
+ #### DraggableOptions
52
+
53
+ ```typescript
54
+ export type DraggableOptions = Omit<InteractDraggableOptions, 'listeners'>
55
+
56
+ interface DraggableOptions {
57
+ /** 惯性配置 */
58
+ inertia?: {
59
+ enabled?: boolean
60
+ resistance?: number
61
+ minSpeed?: number
62
+ endSpeed?: number
63
+ smoothEndDuration?: number
64
+ }
65
+ /** 修饰器配置 */
66
+ modifiers?: Modifier[]
67
+ /** 其他 InteractJS 配置 */
68
+ [key: string]: any
69
+ }
70
+ ```
71
+
72
+ ### 插件数据 (PluginData)
73
+
74
+ Drag 插件提供以下数据:
75
+
76
+ ```typescript
77
+ interface PluginData {
78
+ drag: {
79
+ options: DraggableOptions
80
+ registerOptionsTransformer: (transformer: DragOptionsTransformer) => () => void
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### 类型定义
86
+
87
+ #### DragOptionsTransformer
88
+
89
+ ```typescript
90
+ export interface DragTransformerContext {
91
+ nodeId: string
92
+ node: Node
93
+ defaultOptions: DraggableOptions
94
+ currentOptions: DraggableOptions
95
+ }
96
+
97
+ export type DragOptionsTransformer = (context: DragTransformerContext) => DraggableOptions | undefined
98
+ ```
99
+
100
+ ## 使用示例
101
+
102
+ ### 基本用法
103
+
104
+ ```typescript
105
+ import { Drag } from '@knotx/plugins-drag'
106
+
107
+ const engine = new Engine({
108
+ plugins: [Drag],
109
+ })
110
+ ```
111
+
112
+ ### 自定义拖拽配置
113
+
114
+ ```typescript
115
+ const engine = new Engine({
116
+ plugins: [Drag],
117
+ })
118
+
119
+ // 获取插件数据
120
+ const dragData = engine.getPluginData('drag')
121
+
122
+ // 修改默认配置
123
+ dragData.options = {
124
+ inertia: {
125
+ enabled: true,
126
+ resistance: 30,
127
+ minSpeed: 200,
128
+ endSpeed: 10,
129
+ },
130
+ modifiers: [
131
+ interact.modifiers.restrictRect({
132
+ restriction: 'parent',
133
+ endOnly: true,
134
+ }),
135
+ ],
136
+ }
137
+ ```
138
+
139
+ ### 使用拖拽变换器
140
+
141
+ ```typescript
142
+ const engine = new Engine({
143
+ plugins: [Drag],
144
+ })
145
+
146
+ const dragData = engine.getPluginData('drag')
147
+
148
+ // 注册拖拽变换器
149
+ const unregister = dragData.registerOptionsTransformer((context) => {
150
+ const { nodeId, node, defaultOptions, currentOptions } = context
151
+
152
+ // 根据节点类型或状态修改拖拽配置
153
+ if (node.type === 'locked') {
154
+ return {
155
+ ...currentOptions,
156
+ enabled: false, // 禁用拖拽
157
+ }
158
+ }
159
+
160
+ if (node.type === 'slow') {
161
+ return {
162
+ ...currentOptions,
163
+ inertia: {
164
+ ...currentOptions.inertia,
165
+ resistance: 100, // 增加阻力
166
+ },
167
+ }
168
+ }
169
+
170
+ return currentOptions
171
+ })
172
+
173
+ // 取消注册
174
+ unregister()
175
+ ```
176
+
177
+ ### 边界限制
178
+
179
+ ```typescript
180
+ const engine = new Engine({
181
+ plugins: [Drag],
182
+ })
183
+
184
+ const dragData = engine.getPluginData('drag')
185
+
186
+ // 限制拖拽范围
187
+ dragData.options = {
188
+ modifiers: [
189
+ interact.modifiers.restrictRect({
190
+ restriction: '.canvas-container',
191
+ endOnly: true,
192
+ }),
193
+ ],
194
+ }
195
+ ```
196
+
197
+ ### 网格对齐
198
+
199
+ ```typescript
200
+ const engine = new Engine({
201
+ plugins: [Drag],
202
+ })
203
+
204
+ const dragData = engine.getPluginData('drag')
205
+
206
+ // 网格对齐
207
+ dragData.options = {
208
+ modifiers: [
209
+ interact.modifiers.snap({
210
+ targets: [
211
+ interact.snappers.grid({ x: 20, y: 20 }),
212
+ ],
213
+ range: Infinity,
214
+ relativePoints: [{ x: 0, y: 0 }],
215
+ }),
216
+ ],
217
+ }
218
+ ```
219
+
220
+ ### 与 Canvas 插件集成
221
+
222
+ ```typescript
223
+ import { Canvas } from '@knotx/plugins-canvas'
224
+ import { Drag } from '@knotx/plugins-drag'
225
+
226
+ const engine = new Engine({
227
+ plugins: [Canvas, Drag],
228
+ pluginConfig: {
229
+ canvas: {
230
+ minScale: 0.1,
231
+ maxScale: 3,
232
+ },
233
+ },
234
+ })
235
+
236
+ // 启用边缘滚动
237
+ const canvasData = engine.getPluginData('canvas')
238
+ canvasData.edgeScroll.setConfig({
239
+ enabled: true,
240
+ edgeSize: 100,
241
+ maxSpeed: 10,
242
+ })
243
+ ```
244
+
245
+ ## 高级功能
246
+
247
+ ### 动态拖拽配置
248
+
249
+ ```typescript
250
+ class DynamicDragPlugin extends BasePlugin {
251
+ @inject.drag.registerOptionsTransformer()
252
+ registerOptionsTransformer!: (transformer: DragOptionsTransformer) => () => void
253
+
254
+ @inject.selection.selected()
255
+ selected!: SelectionSelectedItem[]
256
+
257
+ @OnInit
258
+ init() {
259
+ this.registerOptionsTransformer((context) => {
260
+ const { nodeId, currentOptions } = context
261
+
262
+ // 多选拖拽时的特殊配置
263
+ const isMultiSelected = this.selected.length > 1
264
+ && this.selected.some(item => item.id === nodeId)
265
+
266
+ if (isMultiSelected) {
267
+ return {
268
+ ...currentOptions,
269
+ inertia: {
270
+ ...currentOptions.inertia,
271
+ enabled: false, // 多选时禁用惯性
272
+ },
273
+ }
274
+ }
275
+
276
+ return currentOptions
277
+ })
278
+ }
279
+ }
280
+ ```
281
+
282
+ ### 自定义拖拽修饰器
283
+
284
+ ```typescript
285
+ const engine = new Engine({
286
+ plugins: [Drag],
287
+ })
288
+
289
+ const dragData = engine.getPluginData('drag')
290
+
291
+ // 创建自定义修饰器
292
+ const customModifier = {
293
+ set(coords: any) {
294
+ // 自定义位置计算逻辑
295
+ coords.x = Math.round(coords.x / 10) * 10 // 10px 网格对齐
296
+ coords.y = Math.round(coords.y / 10) * 10
297
+ return coords
298
+ },
299
+ }
300
+
301
+ dragData.options = {
302
+ modifiers: [customModifier],
303
+ }
304
+ ```
305
+
306
+ ### 拖拽状态监听
307
+
308
+ ```typescript
309
+ class DragStatusPlugin extends BasePlugin {
310
+ @inject.canvas.edgeScroll()
311
+ edgeScroll!: PluginData['canvas']['edgeScroll']
312
+
313
+ @subscribe.drag.isDragging()
314
+ onDragStatusChange(isDragging: boolean) {
315
+ if (isDragging) {
316
+ console.log('开始拖拽')
317
+ // 拖拽开始时启用边缘滚动
318
+ this.edgeScroll.setConfig({ enabled: true })
319
+ }
320
+ else {
321
+ console.log('结束拖拽')
322
+ // 拖拽结束时禁用边缘滚动
323
+ this.edgeScroll.setConfig({ enabled: false })
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
329
+ ## 文件目录结构
330
+
331
+ ```
332
+ packages/plugins-drag/
333
+ ├── src/
334
+ │ ├── drag.tsx # 主要实现文件
335
+ │ └── index.ts # 导出文件
336
+ ├── dist/ # 构建输出目录
337
+ ├── package.json # 包配置文件
338
+ ├── build.config.ts # 构建配置
339
+ ├── tsconfig.json # TypeScript 配置
340
+ ├── eslint.config.mjs # ESLint 配置
341
+ └── CHANGELOG.md # 更新日志
342
+ ```
343
+
344
+ ### 核心文件说明
345
+
346
+ - **drag.tsx**:包含 Drag 插件的主要实现,包括 InteractJS 集成、拖拽变换器系统和边缘滚动处理
347
+ - **index.ts**:导出 Drag 类和相关类型定义
348
+
349
+ ## 最佳实践
350
+
351
+ ### 性能优化
352
+
353
+ 1. **合理使用惯性**:惯性效果虽然提供更好的用户体验,但在大量节点时可能影响性能
354
+ 2. **限制拖拽范围**:使用 `restrictRect` 修饰器限制拖拽范围,避免节点拖拽到不合理的位置
355
+ 3. **批量操作**:结合 `@knotx/plugins-batch` 插件优化批量拖拽操作
356
+
357
+ ### 用户体验
358
+
359
+ 1. **视觉反馈**:拖拽时提供清晰的视觉反馈,如阴影、透明度变化等
360
+ 2. **网格对齐**:在需要精确定位的场景中启用网格对齐
361
+ 3. **边缘滚动**:启用边缘滚动功能,改善大画布中的拖拽体验
362
+
363
+ ## 注意事项
364
+
365
+ 1. **事件冲突**:与其他交互插件(如选择)可能存在事件冲突,注意事件优先级
366
+ 2. **内存管理**:及时清理不需要的拖拽变换器,避免内存泄漏
367
+ 3. **性能考虑**:大量节点时,拖拽操作可能影响性能,考虑使用虚拟化
368
+ 4. **移动端适配**:在移动端需要考虑触摸事件的处理
369
+
370
+ ## 许可证
371
+
372
+ MIT
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
1
  import { Node, BasePlugin, Engine, PluginData } from '@knotx/core';
3
2
 
4
- type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
3
+ type DraggableOptions = Omit<Interact.Options['drag'], 'listeners'>;
5
4
  interface DragTransformerContext {
6
5
  nodeId: string;
7
6
  node: Node;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
- import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
1
  import { Node, BasePlugin, Engine, PluginData } from '@knotx/core';
3
2
 
4
- type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
3
+ type DraggableOptions = Omit<Interact.Options['drag'], 'listeners'>;
5
4
  interface DragTransformerContext {
6
5
  nodeId: string;
7
6
  node: Node;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
1
  import { Node, BasePlugin, Engine, PluginData } from '@knotx/core';
3
2
 
4
- type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
3
+ type DraggableOptions = Omit<Interact.Options['drag'], 'listeners'>;
5
4
  interface DragTransformerContext {
6
5
  nodeId: string;
7
6
  node: Node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-drag",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "Drag Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -28,25 +28,21 @@
28
28
  "dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@knotx/jsx": "0.4.12",
32
- "@knotx/plugins-canvas": "0.4.12"
31
+ "@knotx/jsx": "0.4.14",
32
+ "@knotx/plugins-canvas": "0.4.14"
33
33
  },
34
34
  "dependencies": {
35
- "@interactjs/actions": "^1.10.27",
36
- "@interactjs/core": "^1.10.27",
37
- "@interactjs/modifiers": "^1.10.27",
38
- "@interactjs/types": "^1.10.27",
39
35
  "interactjs": "^1.10.27",
40
36
  "rxjs": "^7.8.1",
41
- "@knotx/core": "0.4.12",
42
- "@knotx/decorators": "0.4.12"
37
+ "@knotx/core": "0.4.14",
38
+ "@knotx/decorators": "0.4.14"
43
39
  },
44
40
  "devDependencies": {
45
- "@knotx/build-config": "0.4.12",
46
- "@knotx/eslint-config": "0.4.12",
47
- "@knotx/jsx": "0.4.12",
48
- "@knotx/plugins-canvas": "0.4.12",
49
- "@knotx/typescript-config": "0.4.12"
41
+ "@knotx/build-config": "0.4.14",
42
+ "@knotx/eslint-config": "0.4.14",
43
+ "@knotx/jsx": "0.4.14",
44
+ "@knotx/plugins-canvas": "0.4.14",
45
+ "@knotx/typescript-config": "0.4.14"
50
46
  },
51
47
  "scripts": {
52
48
  "build": "unbuild",