@knotx/plugins-canvas 0.4.3 → 0.4.4
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 +3 -2
- package/dist/index.d.cts +5 -2
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -2
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -325,10 +325,10 @@ class Canvas extends (_a = core.BasePlugin, _transform_dec = [decorators.registe
|
|
|
325
325
|
var _a2, _b, _c, _d;
|
|
326
326
|
const defaultTransform = react.useMemo(() => {
|
|
327
327
|
const defaultLocated = __spreadValues({}, this.config.defaultLocated);
|
|
328
|
-
if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
|
|
328
|
+
if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId) && !defaultLocated.limitToBounds) {
|
|
329
329
|
return this.transform;
|
|
330
330
|
}
|
|
331
|
-
const node = this.getNode({ id: defaultLocated.nodeId });
|
|
331
|
+
const node = defaultLocated.nodeId ? this.getNode({ id: defaultLocated.nodeId }) : void 0;
|
|
332
332
|
defaultLocated.inline || (defaultLocated.inline = "center");
|
|
333
333
|
defaultLocated.block || (defaultLocated.block = "center");
|
|
334
334
|
defaultLocated.scale || (defaultLocated.scale = this.transform.scale);
|
|
@@ -474,6 +474,7 @@ class Canvas extends (_a = core.BasePlugin, _transform_dec = [decorators.registe
|
|
|
474
474
|
contain: "strict"
|
|
475
475
|
},
|
|
476
476
|
wrapperProps: {
|
|
477
|
+
id: this.pluginId,
|
|
477
478
|
onClick,
|
|
478
479
|
onContextMenu,
|
|
479
480
|
onMouseMove,
|
package/dist/index.d.cts
CHANGED
|
@@ -25,6 +25,9 @@ interface ScrollNodeIntoViewOptions {
|
|
|
25
25
|
animationTime?: number;
|
|
26
26
|
limitToBounds?: boolean;
|
|
27
27
|
}
|
|
28
|
+
interface DefaultLocatedOptions extends Omit<ScrollNodeIntoViewOptions, 'nodeId'> {
|
|
29
|
+
nodeId?: string | null;
|
|
30
|
+
}
|
|
28
31
|
interface EdgeScrollConfig {
|
|
29
32
|
enabled: boolean;
|
|
30
33
|
edgeSize: number;
|
|
@@ -33,7 +36,7 @@ interface EdgeScrollConfig {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
type CanvasConfig = ReactZoomPanPinchProps & {
|
|
36
|
-
defaultLocated?:
|
|
39
|
+
defaultLocated?: DefaultLocatedOptions;
|
|
37
40
|
};
|
|
38
41
|
declare module '@knotx/core' {
|
|
39
42
|
interface PluginData {
|
|
@@ -184,4 +187,4 @@ declare class Canvas extends BasePlugin<'canvas', CanvasConfig> {
|
|
|
184
187
|
private isCanvasEvent;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
|
190
|
+
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type DefaultLocatedOptions, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,9 @@ interface ScrollNodeIntoViewOptions {
|
|
|
25
25
|
animationTime?: number;
|
|
26
26
|
limitToBounds?: boolean;
|
|
27
27
|
}
|
|
28
|
+
interface DefaultLocatedOptions extends Omit<ScrollNodeIntoViewOptions, 'nodeId'> {
|
|
29
|
+
nodeId?: string | null;
|
|
30
|
+
}
|
|
28
31
|
interface EdgeScrollConfig {
|
|
29
32
|
enabled: boolean;
|
|
30
33
|
edgeSize: number;
|
|
@@ -33,7 +36,7 @@ interface EdgeScrollConfig {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
type CanvasConfig = ReactZoomPanPinchProps & {
|
|
36
|
-
defaultLocated?:
|
|
39
|
+
defaultLocated?: DefaultLocatedOptions;
|
|
37
40
|
};
|
|
38
41
|
declare module '@knotx/core' {
|
|
39
42
|
interface PluginData {
|
|
@@ -184,4 +187,4 @@ declare class Canvas extends BasePlugin<'canvas', CanvasConfig> {
|
|
|
184
187
|
private isCanvasEvent;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
|
190
|
+
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type DefaultLocatedOptions, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ interface ScrollNodeIntoViewOptions {
|
|
|
25
25
|
animationTime?: number;
|
|
26
26
|
limitToBounds?: boolean;
|
|
27
27
|
}
|
|
28
|
+
interface DefaultLocatedOptions extends Omit<ScrollNodeIntoViewOptions, 'nodeId'> {
|
|
29
|
+
nodeId?: string | null;
|
|
30
|
+
}
|
|
28
31
|
interface EdgeScrollConfig {
|
|
29
32
|
enabled: boolean;
|
|
30
33
|
edgeSize: number;
|
|
@@ -33,7 +36,7 @@ interface EdgeScrollConfig {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
type CanvasConfig = ReactZoomPanPinchProps & {
|
|
36
|
-
defaultLocated?:
|
|
39
|
+
defaultLocated?: DefaultLocatedOptions;
|
|
37
40
|
};
|
|
38
41
|
declare module '@knotx/core' {
|
|
39
42
|
interface PluginData {
|
|
@@ -184,4 +187,4 @@ declare class Canvas extends BasePlugin<'canvas', CanvasConfig> {
|
|
|
184
187
|
private isCanvasEvent;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
|
190
|
+
export { Canvas, type CanvasConfig, type CanvasContentSize, type CanvasEventListener, type CanvasEventType, type CanvasTransformState, type DefaultLocatedOptions, type EdgeScrollConfig, type ScrollNodeIntoViewOptions };
|
package/dist/index.js
CHANGED
|
@@ -323,10 +323,10 @@ class Canvas extends (_a = BasePlugin, _transform_dec = [register("transform")],
|
|
|
323
323
|
var _a2, _b, _c, _d;
|
|
324
324
|
const defaultTransform = useMemo(() => {
|
|
325
325
|
const defaultLocated = __spreadValues({}, this.config.defaultLocated);
|
|
326
|
-
if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
|
|
326
|
+
if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId) && !defaultLocated.limitToBounds) {
|
|
327
327
|
return this.transform;
|
|
328
328
|
}
|
|
329
|
-
const node = this.getNode({ id: defaultLocated.nodeId });
|
|
329
|
+
const node = defaultLocated.nodeId ? this.getNode({ id: defaultLocated.nodeId }) : void 0;
|
|
330
330
|
defaultLocated.inline || (defaultLocated.inline = "center");
|
|
331
331
|
defaultLocated.block || (defaultLocated.block = "center");
|
|
332
332
|
defaultLocated.scale || (defaultLocated.scale = this.transform.scale);
|
|
@@ -472,6 +472,7 @@ class Canvas extends (_a = BasePlugin, _transform_dec = [register("transform")],
|
|
|
472
472
|
contain: "strict"
|
|
473
473
|
},
|
|
474
474
|
wrapperProps: {
|
|
475
|
+
id: this.pluginId,
|
|
475
476
|
onClick,
|
|
476
477
|
onContextMenu,
|
|
477
478
|
onMouseMove,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-canvas",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Canvas Plugin for Knotx",
|
|
5
5
|
"author": "boenfu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=17.0.0",
|
|
32
|
-
"@knotx/jsx": "0.4.
|
|
32
|
+
"@knotx/jsx": "0.4.4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
36
|
"react-zoom-pan-pinch": "^3.7.0",
|
|
37
37
|
"rxjs": "^7.8.1",
|
|
38
|
-
"@knotx/core": "0.4.
|
|
39
|
-
"@knotx/decorators": "0.4.
|
|
38
|
+
"@knotx/core": "0.4.4",
|
|
39
|
+
"@knotx/decorators": "0.4.4"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/lodash-es": "^4.17.12",
|
|
43
43
|
"@types/react": "^17.0.0",
|
|
44
44
|
"react": "^17.0.0",
|
|
45
|
-
"@knotx/build-config": "0.4.
|
|
46
|
-
"@knotx/eslint-config": "0.4.
|
|
47
|
-
"@knotx/jsx": "0.4.
|
|
48
|
-
"@knotx/typescript-config": "0.4.
|
|
45
|
+
"@knotx/build-config": "0.4.4",
|
|
46
|
+
"@knotx/eslint-config": "0.4.4",
|
|
47
|
+
"@knotx/jsx": "0.4.4",
|
|
48
|
+
"@knotx/typescript-config": "0.4.4"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "unbuild",
|