@knotx/plugins-drag 0.2.14 → 0.3.0

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/dist/index.cjs CHANGED
@@ -123,7 +123,7 @@ class Drag extends (_a = core.BasePlugin, _getNode_dec = [decorators.inject.getN
123
123
  * 应用所有转换器,生成最终的配置
124
124
  */
125
125
  applyTransformers(nodeId) {
126
- const node = this.getNode(nodeId);
126
+ const node = this.getNode({ id: nodeId });
127
127
  if (!node)
128
128
  return this.options;
129
129
  const context = {
@@ -199,7 +199,7 @@ class Drag extends (_a = core.BasePlugin, _getNode_dec = [decorators.inject.getN
199
199
  var _a2;
200
200
  const draftId = `${this.pluginId}-${startEvent.nodeId}`;
201
201
  const { nodeId } = startEvent;
202
- const startPosition = (_a2 = this.getNode(nodeId)) == null ? void 0 : _a2.position;
202
+ const startPosition = (_a2 = this.getNode({ id: nodeId })) == null ? void 0 : _a2.position;
203
203
  const currentPosition = { x: (startPosition == null ? void 0 : startPosition.x) || 0, y: (startPosition == null ? void 0 : startPosition.y) || 0 };
204
204
  this.dispatchNodeOperation({
205
205
  type: "startDraft",
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
- import { Node, BasePlugin, NodeOperation, InteractionPriority } from '@knotx/core';
2
+ import { Node, BasePlugin, Engine } from '@knotx/core';
3
3
 
4
4
  type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
5
5
  interface DragTransformerContext {
@@ -19,11 +19,11 @@ declare module '@knotx/core' {
19
19
  }
20
20
  declare class Drag extends BasePlugin {
21
21
  name: "drag";
22
- getNode: (id: string) => Node | undefined;
23
- dispatchNodeOperation: (operation: NodeOperation) => void;
24
- startInteraction: (pluginId: string, type: string, priority: InteractionPriority) => void;
25
- endInteraction: (pluginId: string, type: string) => void;
26
- canInteract: (pluginId: string, type: string, autoStartPriority?: InteractionPriority) => boolean;
22
+ getNode: Engine['getNode'];
23
+ dispatchNodeOperation: Engine['dispatchNodeOperation'];
24
+ startInteraction: Engine['startInteraction'];
25
+ endInteraction: Engine['endInteraction'];
26
+ canInteract: Engine['canInteract'];
27
27
  canvasScale: number;
28
28
  private subscription?;
29
29
  private transformers$;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
- import { Node, BasePlugin, NodeOperation, InteractionPriority } from '@knotx/core';
2
+ import { Node, BasePlugin, Engine } from '@knotx/core';
3
3
 
4
4
  type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
5
5
  interface DragTransformerContext {
@@ -19,11 +19,11 @@ declare module '@knotx/core' {
19
19
  }
20
20
  declare class Drag extends BasePlugin {
21
21
  name: "drag";
22
- getNode: (id: string) => Node | undefined;
23
- dispatchNodeOperation: (operation: NodeOperation) => void;
24
- startInteraction: (pluginId: string, type: string, priority: InteractionPriority) => void;
25
- endInteraction: (pluginId: string, type: string) => void;
26
- canInteract: (pluginId: string, type: string, autoStartPriority?: InteractionPriority) => boolean;
22
+ getNode: Engine['getNode'];
23
+ dispatchNodeOperation: Engine['dispatchNodeOperation'];
24
+ startInteraction: Engine['startInteraction'];
25
+ endInteraction: Engine['endInteraction'];
26
+ canInteract: Engine['canInteract'];
27
27
  canvasScale: number;
28
28
  private subscription?;
29
29
  private transformers$;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DraggableOptions as DraggableOptions$1 } from '@interactjs/actions/drag/plugin';
2
- import { Node, BasePlugin, NodeOperation, InteractionPriority } from '@knotx/core';
2
+ import { Node, BasePlugin, Engine } from '@knotx/core';
3
3
 
4
4
  type DraggableOptions = Omit<DraggableOptions$1, 'listeners'>;
5
5
  interface DragTransformerContext {
@@ -19,11 +19,11 @@ declare module '@knotx/core' {
19
19
  }
20
20
  declare class Drag extends BasePlugin {
21
21
  name: "drag";
22
- getNode: (id: string) => Node | undefined;
23
- dispatchNodeOperation: (operation: NodeOperation) => void;
24
- startInteraction: (pluginId: string, type: string, priority: InteractionPriority) => void;
25
- endInteraction: (pluginId: string, type: string) => void;
26
- canInteract: (pluginId: string, type: string, autoStartPriority?: InteractionPriority) => boolean;
22
+ getNode: Engine['getNode'];
23
+ dispatchNodeOperation: Engine['dispatchNodeOperation'];
24
+ startInteraction: Engine['startInteraction'];
25
+ endInteraction: Engine['endInteraction'];
26
+ canInteract: Engine['canInteract'];
27
27
  canvasScale: number;
28
28
  private subscription?;
29
29
  private transformers$;
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ class Drag extends (_a = BasePlugin, _getNode_dec = [inject.getNode()], _dispatc
117
117
  * 应用所有转换器,生成最终的配置
118
118
  */
119
119
  applyTransformers(nodeId) {
120
- const node = this.getNode(nodeId);
120
+ const node = this.getNode({ id: nodeId });
121
121
  if (!node)
122
122
  return this.options;
123
123
  const context = {
@@ -193,7 +193,7 @@ class Drag extends (_a = BasePlugin, _getNode_dec = [inject.getNode()], _dispatc
193
193
  var _a2;
194
194
  const draftId = `${this.pluginId}-${startEvent.nodeId}`;
195
195
  const { nodeId } = startEvent;
196
- const startPosition = (_a2 = this.getNode(nodeId)) == null ? void 0 : _a2.position;
196
+ const startPosition = (_a2 = this.getNode({ id: nodeId })) == null ? void 0 : _a2.position;
197
197
  const currentPosition = { x: (startPosition == null ? void 0 : startPosition.x) || 0, y: (startPosition == null ? void 0 : startPosition.y) || 0 };
198
198
  this.dispatchNodeOperation({
199
199
  type: "startDraft",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-drag",
3
- "version": "0.2.14",
3
+ "version": "0.3.0",
4
4
  "description": "Drag Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -28,8 +28,8 @@
28
28
  "dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@knotx/jsx": "0.2.12",
32
- "@knotx/plugins-canvas": "0.2.14"
31
+ "@knotx/jsx": "0.3.0",
32
+ "@knotx/plugins-canvas": "0.3.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "@interactjs/actions": "^1.10.27",
@@ -38,15 +38,15 @@
38
38
  "@interactjs/types": "^1.10.27",
39
39
  "interactjs": "^1.10.27",
40
40
  "rxjs": "^7.8.1",
41
- "@knotx/core": "0.2.13",
42
- "@knotx/decorators": "0.2.14"
41
+ "@knotx/core": "0.3.0",
42
+ "@knotx/decorators": "0.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@knotx/build-config": "0.2.12",
46
- "@knotx/eslint-config": "0.2.12",
47
- "@knotx/jsx": "0.2.12",
48
- "@knotx/plugins-canvas": "0.2.14",
49
- "@knotx/typescript-config": "0.2.12"
45
+ "@knotx/build-config": "0.3.0",
46
+ "@knotx/eslint-config": "0.3.0",
47
+ "@knotx/jsx": "0.3.0",
48
+ "@knotx/plugins-canvas": "0.3.0",
49
+ "@knotx/typescript-config": "0.3.0"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "unbuild",