@knotx/plugins-bounding 0.4.1 → 0.4.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 +7 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -10
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -143,7 +143,7 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
143
143
|
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init, 28, this, (nodeId, position) => {
|
|
144
144
|
return {
|
|
145
145
|
"className": this.resizeHandleClassName,
|
|
146
|
-
|
|
146
|
+
[`data-${this.pluginId}`]: "",
|
|
147
147
|
"data-resize-target": nodeId,
|
|
148
148
|
"data-resize-handle-position": position
|
|
149
149
|
};
|
|
@@ -194,7 +194,7 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
194
194
|
});
|
|
195
195
|
};
|
|
196
196
|
if ((_g = this.config.features) == null ? void 0 : _g.resize) {
|
|
197
|
-
const currentInteractable = interact__default(`[data
|
|
197
|
+
const currentInteractable = interact__default(`[data-${this.pluginId}].${this.resizeHandleClassName}`).resizable({
|
|
198
198
|
edges: { left: true, right: true, bottom: true, top: true },
|
|
199
199
|
inertia: (_h = this.config.resize) == null ? void 0 : _h.inertia,
|
|
200
200
|
cursorChecker: (_action, _interactable, element) => {
|
|
@@ -304,7 +304,7 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
304
304
|
resizeEnd$.complete();
|
|
305
305
|
});
|
|
306
306
|
if ((_i = this.config.features) == null ? void 0 : _i.boundingBox) {
|
|
307
|
-
const boundingInteractable = interact__default(`[data
|
|
307
|
+
const boundingInteractable = interact__default(`[data-${this.pluginId}].${this.boundingBoxClassName}`).resizable({
|
|
308
308
|
enabled: (_j = this.config.features) == null ? void 0 : _j.resize,
|
|
309
309
|
edges: { left: true, right: true, bottom: true, top: true },
|
|
310
310
|
inertia: (_k = this.config.resize) == null ? void 0 : _k.inertia,
|
|
@@ -332,7 +332,6 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
332
332
|
render() {
|
|
333
333
|
var _a2;
|
|
334
334
|
const nodes = core.use(() => this.nodes);
|
|
335
|
-
const pluginId = this.pluginId;
|
|
336
335
|
const nodesType = (_a2 = this.config.resize) == null ? void 0 : _a2.nodesType;
|
|
337
336
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
338
337
|
"svg",
|
|
@@ -359,9 +358,8 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
359
358
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { style: { pointerEvents: "auto" }, children: [
|
|
360
359
|
((_m = this.config.features) == null ? void 0 : _m.boundingBox) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
361
360
|
"rect",
|
|
362
|
-
{
|
|
361
|
+
__spreadValues({
|
|
363
362
|
className: this.boundingBoxClassName,
|
|
364
|
-
"data-plugin-id": this.pluginId,
|
|
365
363
|
"data-resize-target": node.id,
|
|
366
364
|
x,
|
|
367
365
|
y,
|
|
@@ -371,7 +369,7 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
371
369
|
stroke: (_o = (_n = this.config.styles) == null ? void 0 : _n.boundingBox) == null ? void 0 : _o.stroke,
|
|
372
370
|
strokeWidth: (_q = (_p = this.config.styles) == null ? void 0 : _p.boundingBox) == null ? void 0 : _q.strokeWidth,
|
|
373
371
|
style: { pointerEvents: "auto" }
|
|
374
|
-
}
|
|
372
|
+
}, { [`data-${this.pluginId}`]: "" })
|
|
375
373
|
),
|
|
376
374
|
((_r = this.config.features) == null ? void 0 : _r.resize) && ((_t = (_s = this.config.resize) == null ? void 0 : _s.handles) == null ? void 0 : _t.map((position, index) => {
|
|
377
375
|
let handleX = x;
|
|
@@ -423,9 +421,8 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
423
421
|
handleY = y;
|
|
424
422
|
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
425
423
|
"circle",
|
|
426
|
-
{
|
|
424
|
+
__spreadValues({
|
|
427
425
|
className: this.connectHandleClassName,
|
|
428
|
-
"data-plugin-id": pluginId,
|
|
429
426
|
"data-handle-target": node.id,
|
|
430
427
|
cx: handleX,
|
|
431
428
|
cy: handleY,
|
|
@@ -433,7 +430,7 @@ class Bounding extends (_a = core.BasePlugin, _nodes_dec = [decorators.inject.no
|
|
|
433
430
|
fill: connectStyles == null ? void 0 : connectStyles.fill,
|
|
434
431
|
stroke: connectStyles == null ? void 0 : connectStyles.stroke,
|
|
435
432
|
strokeWidth: connectStyles == null ? void 0 : connectStyles.strokeWidth
|
|
436
|
-
}
|
|
433
|
+
}, { [`data-${this.pluginId}`]: "" })
|
|
437
434
|
) }, `connect-${index}`);
|
|
438
435
|
})
|
|
439
436
|
] }, node.id);
|
package/dist/index.d.cts
CHANGED
|
@@ -90,8 +90,8 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
90
90
|
private connectHandleClassName;
|
|
91
91
|
private boundingBoxClassName;
|
|
92
92
|
getResizeHandleAttributes: (nodeId: string, position: string) => {
|
|
93
|
+
[x: string]: string;
|
|
93
94
|
className: string;
|
|
94
|
-
'data-plugin-id': string;
|
|
95
95
|
'data-resize-target': string;
|
|
96
96
|
'data-resize-handle-position': string;
|
|
97
97
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -90,8 +90,8 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
90
90
|
private connectHandleClassName;
|
|
91
91
|
private boundingBoxClassName;
|
|
92
92
|
getResizeHandleAttributes: (nodeId: string, position: string) => {
|
|
93
|
+
[x: string]: string;
|
|
93
94
|
className: string;
|
|
94
|
-
'data-plugin-id': string;
|
|
95
95
|
'data-resize-target': string;
|
|
96
96
|
'data-resize-handle-position': string;
|
|
97
97
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -90,8 +90,8 @@ declare class Bounding extends BasePlugin<'bounding', BoundingConfig> {
|
|
|
90
90
|
private connectHandleClassName;
|
|
91
91
|
private boundingBoxClassName;
|
|
92
92
|
getResizeHandleAttributes: (nodeId: string, position: string) => {
|
|
93
|
+
[x: string]: string;
|
|
93
94
|
className: string;
|
|
94
|
-
'data-plugin-id': string;
|
|
95
95
|
'data-resize-target': string;
|
|
96
96
|
'data-resize-handle-position': string;
|
|
97
97
|
};
|
package/dist/index.js
CHANGED
|
@@ -137,7 +137,7 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
137
137
|
__publicField(this, "getResizeHandleAttributes", __runInitializers(_init, 28, this, (nodeId, position) => {
|
|
138
138
|
return {
|
|
139
139
|
"className": this.resizeHandleClassName,
|
|
140
|
-
|
|
140
|
+
[`data-${this.pluginId}`]: "",
|
|
141
141
|
"data-resize-target": nodeId,
|
|
142
142
|
"data-resize-handle-position": position
|
|
143
143
|
};
|
|
@@ -188,7 +188,7 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
190
|
if ((_g = this.config.features) == null ? void 0 : _g.resize) {
|
|
191
|
-
const currentInteractable = interact(`[data
|
|
191
|
+
const currentInteractable = interact(`[data-${this.pluginId}].${this.resizeHandleClassName}`).resizable({
|
|
192
192
|
edges: { left: true, right: true, bottom: true, top: true },
|
|
193
193
|
inertia: (_h = this.config.resize) == null ? void 0 : _h.inertia,
|
|
194
194
|
cursorChecker: (_action, _interactable, element) => {
|
|
@@ -298,7 +298,7 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
298
298
|
resizeEnd$.complete();
|
|
299
299
|
});
|
|
300
300
|
if ((_i = this.config.features) == null ? void 0 : _i.boundingBox) {
|
|
301
|
-
const boundingInteractable = interact(`[data
|
|
301
|
+
const boundingInteractable = interact(`[data-${this.pluginId}].${this.boundingBoxClassName}`).resizable({
|
|
302
302
|
enabled: (_j = this.config.features) == null ? void 0 : _j.resize,
|
|
303
303
|
edges: { left: true, right: true, bottom: true, top: true },
|
|
304
304
|
inertia: (_k = this.config.resize) == null ? void 0 : _k.inertia,
|
|
@@ -326,7 +326,6 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
326
326
|
render() {
|
|
327
327
|
var _a2;
|
|
328
328
|
const nodes = use(() => this.nodes);
|
|
329
|
-
const pluginId = this.pluginId;
|
|
330
329
|
const nodesType = (_a2 = this.config.resize) == null ? void 0 : _a2.nodesType;
|
|
331
330
|
return /* @__PURE__ */ jsx(
|
|
332
331
|
"svg",
|
|
@@ -353,9 +352,8 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
353
352
|
return /* @__PURE__ */ jsxs("g", { style: { pointerEvents: "auto" }, children: [
|
|
354
353
|
((_m = this.config.features) == null ? void 0 : _m.boundingBox) && /* @__PURE__ */ jsx(
|
|
355
354
|
"rect",
|
|
356
|
-
{
|
|
355
|
+
__spreadValues({
|
|
357
356
|
className: this.boundingBoxClassName,
|
|
358
|
-
"data-plugin-id": this.pluginId,
|
|
359
357
|
"data-resize-target": node.id,
|
|
360
358
|
x,
|
|
361
359
|
y,
|
|
@@ -365,7 +363,7 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
365
363
|
stroke: (_o = (_n = this.config.styles) == null ? void 0 : _n.boundingBox) == null ? void 0 : _o.stroke,
|
|
366
364
|
strokeWidth: (_q = (_p = this.config.styles) == null ? void 0 : _p.boundingBox) == null ? void 0 : _q.strokeWidth,
|
|
367
365
|
style: { pointerEvents: "auto" }
|
|
368
|
-
}
|
|
366
|
+
}, { [`data-${this.pluginId}`]: "" })
|
|
369
367
|
),
|
|
370
368
|
((_r = this.config.features) == null ? void 0 : _r.resize) && ((_t = (_s = this.config.resize) == null ? void 0 : _s.handles) == null ? void 0 : _t.map((position, index) => {
|
|
371
369
|
let handleX = x;
|
|
@@ -417,9 +415,8 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
417
415
|
handleY = y;
|
|
418
416
|
return /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(
|
|
419
417
|
"circle",
|
|
420
|
-
{
|
|
418
|
+
__spreadValues({
|
|
421
419
|
className: this.connectHandleClassName,
|
|
422
|
-
"data-plugin-id": pluginId,
|
|
423
420
|
"data-handle-target": node.id,
|
|
424
421
|
cx: handleX,
|
|
425
422
|
cy: handleY,
|
|
@@ -427,7 +424,7 @@ class Bounding extends (_a = BasePlugin, _nodes_dec = [inject.nodes()], _getNode
|
|
|
427
424
|
fill: connectStyles == null ? void 0 : connectStyles.fill,
|
|
428
425
|
stroke: connectStyles == null ? void 0 : connectStyles.stroke,
|
|
429
426
|
strokeWidth: connectStyles == null ? void 0 : connectStyles.strokeWidth
|
|
430
|
-
}
|
|
427
|
+
}, { [`data-${this.pluginId}`]: "" })
|
|
431
428
|
) }, `connect-${index}`);
|
|
432
429
|
})
|
|
433
430
|
] }, node.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-bounding",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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.4.
|
|
32
|
-
"@knotx/plugins-canvas": "0.4.
|
|
31
|
+
"@knotx/jsx": "0.4.2",
|
|
32
|
+
"@knotx/plugins-canvas": "0.4.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.4.
|
|
42
|
-
"@knotx/decorators": "0.4.
|
|
43
|
-
"@knotx/render": "0.4.
|
|
41
|
+
"@knotx/core": "0.4.2",
|
|
42
|
+
"@knotx/decorators": "0.4.2",
|
|
43
|
+
"@knotx/render": "0.4.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@knotx/build-config": "0.4.
|
|
47
|
-
"@knotx/eslint-config": "0.4.
|
|
48
|
-
"@knotx/jsx": "0.4.
|
|
49
|
-
"@knotx/plugins-canvas": "0.4.
|
|
50
|
-
"@knotx/typescript-config": "0.4.
|
|
46
|
+
"@knotx/build-config": "0.4.2",
|
|
47
|
+
"@knotx/eslint-config": "0.4.2",
|
|
48
|
+
"@knotx/jsx": "0.4.2",
|
|
49
|
+
"@knotx/plugins-canvas": "0.4.2",
|
|
50
|
+
"@knotx/typescript-config": "0.4.2"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "unbuild",
|