@knotx/plugins-bounding 0.3.1 → 0.3.2
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 +10 -14
- package/dist/index.d.cts +1 -3
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +10 -14
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -79,7 +79,7 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
|
|
|
79
79
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
80
80
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
81
81
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
82
|
-
var _render_dec, _destroy_dec, _init_dec, _getResizeHandleAttributes_dec, _canvasScale_dec,
|
|
82
|
+
var _render_dec, _destroy_dec, _init_dec, _getResizeHandleAttributes_dec, _canvasScale_dec, _interaction_dec, _dispatchNodeOperation_dec, _getNode_dec, _nodes_dec, _a, _init;
|
|
83
83
|
const DEFAULT_CONNECT_HANDLE_POSITIONS = [
|
|
84
84
|
{ top: true },
|
|
85
85
|
{ right: true },
|
|
@@ -125,7 +125,7 @@ const DEFAULT_CONFIG = {
|
|
|
125
125
|
]
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.nodes()], _getNode_dec = [decorators.inject.getNode()], _dispatchNodeOperation_dec = [decorators.inject.dispatchNodeOperation()],
|
|
128
|
+
class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.nodes()], _getNode_dec = [decorators.inject.getNode()], _dispatchNodeOperation_dec = [decorators.inject.dispatchNodeOperation()], _interaction_dec = [decorators.inject.interaction()], _canvasScale_dec = [decorators.inject.canvas.transform((state) => state.scale)], _getResizeHandleAttributes_dec = [decorators.register("getCustomResizeHandleAttributes")], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _render_dec = [decorators.layer(core.Layer.Nodes, 1)], _a) {
|
|
129
129
|
constructor() {
|
|
130
130
|
super(...arguments);
|
|
131
131
|
__runInitializers(_init, 5, this);
|
|
@@ -134,22 +134,20 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
134
134
|
__publicField(this, "nodes", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
135
135
|
__publicField(this, "getNode", __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
|
136
136
|
__publicField(this, "dispatchNodeOperation", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
|
137
|
-
__publicField(this, "
|
|
138
|
-
__publicField(this, "
|
|
139
|
-
__publicField(this, "canInteract", __runInitializers(_init, 28, this)), __runInitializers(_init, 31, this);
|
|
140
|
-
__publicField(this, "canvasScale", __runInitializers(_init, 32, this, 1)), __runInitializers(_init, 35, this);
|
|
137
|
+
__publicField(this, "interaction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
|
138
|
+
__publicField(this, "canvasScale", __runInitializers(_init, 24, this, 1)), __runInitializers(_init, 27, this);
|
|
141
139
|
__publicField(this, "subscription");
|
|
142
140
|
__publicField(this, "resizeHandleClassName", core.bem(this.name, "resize-handle"));
|
|
143
141
|
__publicField(this, "connectHandleClassName", core.bem(this.name, "connect-handle"));
|
|
144
142
|
__publicField(this, "boundingBoxClassName", core.bem(this.name, "bounding-box"));
|
|
145
|
-
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init,
|
|
143
|
+
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init, 28, this, (nodeId, position) => {
|
|
146
144
|
return {
|
|
147
145
|
"className": this.resizeHandleClassName,
|
|
148
146
|
"data-plugin-id": this.pluginId,
|
|
149
147
|
"data-resize-target": nodeId,
|
|
150
148
|
"data-resize-handle-position": position
|
|
151
149
|
};
|
|
152
|
-
})), __runInitializers(_init,
|
|
150
|
+
})), __runInitializers(_init, 31, this);
|
|
153
151
|
}
|
|
154
152
|
init(config) {
|
|
155
153
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
@@ -178,14 +176,14 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
178
176
|
startY: node.position.y,
|
|
179
177
|
position
|
|
180
178
|
});
|
|
181
|
-
this.
|
|
179
|
+
this.interaction.start(this.pluginId, "resize", core.InteractionPriority.EntityMeasureDrag);
|
|
182
180
|
};
|
|
183
181
|
const endResize = () => {
|
|
184
182
|
resizeEnd$.next();
|
|
185
|
-
this.
|
|
183
|
+
this.interaction.end(this.pluginId, "resize");
|
|
186
184
|
};
|
|
187
185
|
const updateResize = (event) => {
|
|
188
|
-
if (!this.canInteract(
|
|
186
|
+
if (!this.interaction.canInteract(core.InteractionPriority.EntityMeasureDrag)) {
|
|
189
187
|
endResize();
|
|
190
188
|
return;
|
|
191
189
|
}
|
|
@@ -485,9 +483,7 @@ __decorateElement(_init, 1, "render", _render_dec, Bounding);
|
|
|
485
483
|
__decorateElement(_init, 5, "nodes", _nodes_dec, Bounding);
|
|
486
484
|
__decorateElement(_init, 5, "getNode", _getNode_dec, Bounding);
|
|
487
485
|
__decorateElement(_init, 5, "dispatchNodeOperation", _dispatchNodeOperation_dec, Bounding);
|
|
488
|
-
__decorateElement(_init, 5, "
|
|
489
|
-
__decorateElement(_init, 5, "endInteraction", _endInteraction_dec, Bounding);
|
|
490
|
-
__decorateElement(_init, 5, "canInteract", _canInteract_dec, Bounding);
|
|
486
|
+
__decorateElement(_init, 5, "interaction", _interaction_dec, Bounding);
|
|
491
487
|
__decorateElement(_init, 5, "canvasScale", _canvasScale_dec, Bounding);
|
|
492
488
|
__decorateElement(_init, 5, "getResizeHandleAttributes", _getResizeHandleAttributes_dec, Bounding);
|
|
493
489
|
__decoratorMetadata(_init, Bounding);
|
package/dist/index.d.cts
CHANGED
|
@@ -83,9 +83,7 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
83
83
|
nodes: Node[];
|
|
84
84
|
getNode: Engine['getNode'];
|
|
85
85
|
dispatchNodeOperation: Engine['dispatchNodeOperation'];
|
|
86
|
-
|
|
87
|
-
endInteraction: Engine['endInteraction'];
|
|
88
|
-
canInteract: Engine['canInteract'];
|
|
86
|
+
interaction: Engine['interaction'];
|
|
89
87
|
canvasScale: number;
|
|
90
88
|
private subscription?;
|
|
91
89
|
private resizeHandleClassName;
|
package/dist/index.d.mts
CHANGED
|
@@ -83,9 +83,7 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
83
83
|
nodes: Node[];
|
|
84
84
|
getNode: Engine['getNode'];
|
|
85
85
|
dispatchNodeOperation: Engine['dispatchNodeOperation'];
|
|
86
|
-
|
|
87
|
-
endInteraction: Engine['endInteraction'];
|
|
88
|
-
canInteract: Engine['canInteract'];
|
|
86
|
+
interaction: Engine['interaction'];
|
|
89
87
|
canvasScale: number;
|
|
90
88
|
private subscription?;
|
|
91
89
|
private resizeHandleClassName;
|
package/dist/index.d.ts
CHANGED
|
@@ -83,9 +83,7 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
83
83
|
nodes: Node[];
|
|
84
84
|
getNode: Engine['getNode'];
|
|
85
85
|
dispatchNodeOperation: Engine['dispatchNodeOperation'];
|
|
86
|
-
|
|
87
|
-
endInteraction: Engine['endInteraction'];
|
|
88
|
-
canInteract: Engine['canInteract'];
|
|
86
|
+
interaction: Engine['interaction'];
|
|
89
87
|
canvasScale: number;
|
|
90
88
|
private subscription?;
|
|
91
89
|
private resizeHandleClassName;
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,7 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
|
|
|
73
73
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
74
74
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
75
75
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
76
|
-
var _render_dec, _destroy_dec, _init_dec, _getResizeHandleAttributes_dec, _canvasScale_dec,
|
|
76
|
+
var _render_dec, _destroy_dec, _init_dec, _getResizeHandleAttributes_dec, _canvasScale_dec, _interaction_dec, _dispatchNodeOperation_dec, _getNode_dec, _nodes_dec, _a, _init;
|
|
77
77
|
const DEFAULT_CONNECT_HANDLE_POSITIONS = [
|
|
78
78
|
{ top: true },
|
|
79
79
|
{ right: true },
|
|
@@ -119,7 +119,7 @@ const DEFAULT_CONFIG = {
|
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode_dec = [inject.getNode()], _dispatchNodeOperation_dec = [inject.dispatchNodeOperation()],
|
|
122
|
+
class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode_dec = [inject.getNode()], _dispatchNodeOperation_dec = [inject.dispatchNodeOperation()], _interaction_dec = [inject.interaction()], _canvasScale_dec = [inject.canvas.transform((state) => state.scale)], _getResizeHandleAttributes_dec = [register("getCustomResizeHandleAttributes")], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _render_dec = [layer(Layer.Nodes, 1)], _a) {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(...arguments);
|
|
125
125
|
__runInitializers(_init, 5, this);
|
|
@@ -128,22 +128,20 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
128
128
|
__publicField(this, "nodes", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
129
129
|
__publicField(this, "getNode", __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
|
130
130
|
__publicField(this, "dispatchNodeOperation", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
|
131
|
-
__publicField(this, "
|
|
132
|
-
__publicField(this, "
|
|
133
|
-
__publicField(this, "canInteract", __runInitializers(_init, 28, this)), __runInitializers(_init, 31, this);
|
|
134
|
-
__publicField(this, "canvasScale", __runInitializers(_init, 32, this, 1)), __runInitializers(_init, 35, this);
|
|
131
|
+
__publicField(this, "interaction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
|
132
|
+
__publicField(this, "canvasScale", __runInitializers(_init, 24, this, 1)), __runInitializers(_init, 27, this);
|
|
135
133
|
__publicField(this, "subscription");
|
|
136
134
|
__publicField(this, "resizeHandleClassName", bem(this.name, "resize-handle"));
|
|
137
135
|
__publicField(this, "connectHandleClassName", bem(this.name, "connect-handle"));
|
|
138
136
|
__publicField(this, "boundingBoxClassName", bem(this.name, "bounding-box"));
|
|
139
|
-
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init,
|
|
137
|
+
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init, 28, this, (nodeId, position) => {
|
|
140
138
|
return {
|
|
141
139
|
"className": this.resizeHandleClassName,
|
|
142
140
|
"data-plugin-id": this.pluginId,
|
|
143
141
|
"data-resize-target": nodeId,
|
|
144
142
|
"data-resize-handle-position": position
|
|
145
143
|
};
|
|
146
|
-
})), __runInitializers(_init,
|
|
144
|
+
})), __runInitializers(_init, 31, this);
|
|
147
145
|
}
|
|
148
146
|
init(config) {
|
|
149
147
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
@@ -172,14 +170,14 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
172
170
|
startY: node.position.y,
|
|
173
171
|
position
|
|
174
172
|
});
|
|
175
|
-
this.
|
|
173
|
+
this.interaction.start(this.pluginId, "resize", InteractionPriority.EntityMeasureDrag);
|
|
176
174
|
};
|
|
177
175
|
const endResize = () => {
|
|
178
176
|
resizeEnd$.next();
|
|
179
|
-
this.
|
|
177
|
+
this.interaction.end(this.pluginId, "resize");
|
|
180
178
|
};
|
|
181
179
|
const updateResize = (event) => {
|
|
182
|
-
if (!this.canInteract(
|
|
180
|
+
if (!this.interaction.canInteract(InteractionPriority.EntityMeasureDrag)) {
|
|
183
181
|
endResize();
|
|
184
182
|
return;
|
|
185
183
|
}
|
|
@@ -479,9 +477,7 @@ __decorateElement(_init, 1, "render", _render_dec, Bounding);
|
|
|
479
477
|
__decorateElement(_init, 5, "nodes", _nodes_dec, Bounding);
|
|
480
478
|
__decorateElement(_init, 5, "getNode", _getNode_dec, Bounding);
|
|
481
479
|
__decorateElement(_init, 5, "dispatchNodeOperation", _dispatchNodeOperation_dec, Bounding);
|
|
482
|
-
__decorateElement(_init, 5, "
|
|
483
|
-
__decorateElement(_init, 5, "endInteraction", _endInteraction_dec, Bounding);
|
|
484
|
-
__decorateElement(_init, 5, "canInteract", _canInteract_dec, Bounding);
|
|
480
|
+
__decorateElement(_init, 5, "interaction", _interaction_dec, Bounding);
|
|
485
481
|
__decorateElement(_init, 5, "canvasScale", _canvasScale_dec, Bounding);
|
|
486
482
|
__decorateElement(_init, 5, "getResizeHandleAttributes", _getResizeHandleAttributes_dec, Bounding);
|
|
487
483
|
__decoratorMetadata(_init, Bounding);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-bounding",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Bounding 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.3.
|
|
32
|
-
"@knotx/plugins-canvas": "0.3.
|
|
31
|
+
"@knotx/jsx": "0.3.2",
|
|
32
|
+
"@knotx/plugins-canvas": "0.3.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@interactjs/actions": "^1.10.27",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"@interactjs/types": "^1.10.27",
|
|
39
39
|
"interactjs": "^1.10.27",
|
|
40
40
|
"rxjs": "^7.8.1",
|
|
41
|
-
"@knotx/core": "0.3.
|
|
42
|
-
"@knotx/
|
|
43
|
-
"@knotx/
|
|
41
|
+
"@knotx/core": "0.3.2",
|
|
42
|
+
"@knotx/decorators": "0.3.2",
|
|
43
|
+
"@knotx/render": "0.3.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@knotx/build-config": "0.3.
|
|
47
|
-
"@knotx/eslint-config": "0.3.
|
|
48
|
-
"@knotx/jsx": "0.3.
|
|
49
|
-
"@knotx/plugins-canvas": "0.3.
|
|
50
|
-
"@knotx/typescript-config": "0.3.
|
|
46
|
+
"@knotx/build-config": "0.3.2",
|
|
47
|
+
"@knotx/eslint-config": "0.3.2",
|
|
48
|
+
"@knotx/jsx": "0.3.2",
|
|
49
|
+
"@knotx/plugins-canvas": "0.3.2",
|
|
50
|
+
"@knotx/typescript-config": "0.3.2"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "unbuild",
|