@lincle/react-web-minimap 0.4.0-next.16 → 0.4.0-next.18
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/cjs/MiniMap/index.js +20 -0
- package/dist/cjs/MiniMap/index.js.map +1 -0
- package/dist/cjs/MiniMapNode/Ellipse.js +30 -0
- package/dist/cjs/MiniMapNode/Ellipse.js.map +1 -0
- package/dist/cjs/MiniMapNode/Rectangle.js +8 -0
- package/dist/cjs/MiniMapNode/Rectangle.js.map +1 -0
- package/dist/cjs/MiniMapNode/index.js +12 -0
- package/dist/cjs/MiniMapNode/index.js.map +1 -0
- package/dist/{MiniMapPlain → cjs/MiniMapPlain}/index.js +26 -30
- package/dist/cjs/MiniMapPlain/index.js.map +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/MiniMap/index.js +20 -0
- package/dist/esm/MiniMap/index.js.map +1 -0
- package/dist/esm/MiniMapNode/Ellipse.js +30 -0
- package/dist/esm/MiniMapNode/Ellipse.js.map +1 -0
- package/dist/esm/MiniMapNode/Rectangle.js +8 -0
- package/dist/esm/MiniMapNode/Rectangle.js.map +1 -0
- package/dist/esm/MiniMapNode/index.js +12 -0
- package/dist/esm/MiniMapNode/index.js.map +1 -0
- package/dist/esm/MiniMapPlain/index.js +145 -0
- package/dist/esm/MiniMapPlain/index.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/styles.g.css +2 -1
- package/package.json +29 -26
- package/dist/MiniMap/index.js +0 -24
- package/dist/MiniMapNode/Ellipse.js +0 -31
- package/dist/MiniMapNode/Rectangle.js +0 -9
- package/dist/MiniMapNode/index.js +0 -16
- package/dist/index.js +0 -12
- package/dist/types.js +0 -2
- /package/dist/{MiniMap → esm/MiniMap}/index.d.ts +0 -0
- /package/dist/{MiniMapNode → esm/MiniMapNode}/Ellipse.d.ts +0 -0
- /package/dist/{MiniMapNode → esm/MiniMapNode}/Rectangle.d.ts +0 -0
- /package/dist/{MiniMapNode → esm/MiniMapNode}/index.d.ts +0 -0
- /package/dist/{MiniMapPlain → esm/MiniMapPlain}/index.d.ts +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{types.d.ts → esm/types.d.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import MiniMapPlain from '../MiniMapPlain';
|
|
3
|
+
import { memo, useMemo } from 'react';
|
|
4
|
+
import { useResizeDetector } from 'react-resize-detector';
|
|
5
|
+
const displayName = 'LincleMiniMap';
|
|
6
|
+
const MiniMap = ({ className: givenClassname, gutter, height, node, style, width }) => {
|
|
7
|
+
const { height: lincleHeight = 0, ref, width: lincleWidth = 0 } = useResizeDetector({
|
|
8
|
+
refreshMode: 'debounce',
|
|
9
|
+
refreshRate: 16
|
|
10
|
+
});
|
|
11
|
+
const className = useMemo(() => {
|
|
12
|
+
return `lincle-minimap-container ${givenClassname}`;
|
|
13
|
+
}, [
|
|
14
|
+
givenClassname
|
|
15
|
+
]);
|
|
16
|
+
return (_jsx("div", { className: 'lincle-minimap', ref: ref, children: _jsx(MiniMapPlain, { className: className, gutter: gutter, height: height, lincleHeight: lincleHeight, lincleWidth: lincleWidth, node: node, style: style, width: width }) }));
|
|
17
|
+
};
|
|
18
|
+
MiniMap.displayName = displayName;
|
|
19
|
+
export default memo(MiniMap);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMap/index.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAEL,IAAI,EAEJ,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,OAAO,GAAoC,CAAC,EAChD,SAAS,EAAE,cAAc,EACzB,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACN,EAAgB,EAAE;IACjB,MAAM,EACJ,MAAM,EAAE,YAAY,GAAG,CAAC,EACxB,GAAG,EACH,KAAK,EAAE,WAAW,GAAG,CAAC,EACvB,GAAG,iBAAiB,CAAC;QACpB,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,EAAE;KAChB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE;QACH,OAAO,4BAA4B,cAAc,EAAE,CAAC;IACtD,CAAC,EACD;QACE,cAAc;KACf,CACF,CAAC;IAEF,OAAO,CACL,cACE,SAAS,EAAC,gBAAgB,EAC1B,GAAG,EAAE,GAAG,YAER,KAAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACZ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAElC,eAAe,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
const MiniMapNodeEllipse = ({ height, width, x, y }) => {
|
|
4
|
+
const cx = useMemo(() => {
|
|
5
|
+
return x + width / 2;
|
|
6
|
+
}, [
|
|
7
|
+
width,
|
|
8
|
+
x
|
|
9
|
+
]);
|
|
10
|
+
const cy = useMemo(() => {
|
|
11
|
+
return y + height / 2;
|
|
12
|
+
}, [
|
|
13
|
+
height,
|
|
14
|
+
y
|
|
15
|
+
]);
|
|
16
|
+
const rx = useMemo(() => {
|
|
17
|
+
return width / 2;
|
|
18
|
+
}, [
|
|
19
|
+
width
|
|
20
|
+
]);
|
|
21
|
+
const ry = useMemo(() => {
|
|
22
|
+
return height / 2;
|
|
23
|
+
}, [
|
|
24
|
+
height
|
|
25
|
+
]);
|
|
26
|
+
return (_jsx("ellipse", { cx: cx, cy: cy, fill: 'rgba(0, 0, 0, 0.6)', rx: rx, ry: ry }));
|
|
27
|
+
};
|
|
28
|
+
MiniMapNodeEllipse.displayName = 'LincleMiniMapNodeEllipse';
|
|
29
|
+
export default memo(MiniMapNodeEllipse);
|
|
30
|
+
//# sourceMappingURL=Ellipse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ellipse.js","sourceRoot":"","sources":["../../../src/MiniMapNode/Ellipse.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EACJ,OAAO,EACR,MAAM,OAAO,CAAC;AAEf,MAAM,kBAAkB,GAA+C,CAAC,EACtE,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACvB,CAAC,EACD;QACE,KAAK;QACL,CAAC;KACF,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;IACxB,CAAC,EACD;QACE,MAAM;QACN,CAAC;KACF,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC,EACD;QACE,KAAK;KACN,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC,EACD;QACE,MAAM;KACP,CACF,CAAC;IAEF,OAAO,CACL,kBACE,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,oBAAoB,EACzB,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACN,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAS5D,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
const MiniMapNodeRectangle = ({ height, width, x, y }) => {
|
|
4
|
+
return (_jsx("rect", { fill: 'rgba(0, 0, 0, 0.6)', height: height, width: width, x: x, y: y }));
|
|
5
|
+
};
|
|
6
|
+
MiniMapNodeRectangle.displayName = 'LincleMiniMapNodeRectangle';
|
|
7
|
+
export default memo(MiniMapNodeRectangle);
|
|
8
|
+
//# sourceMappingURL=Rectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rectangle.js","sourceRoot":"","sources":["../../../src/MiniMapNode/Rectangle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EACL,MAAM,OAAO,CAAC;AAEf,MAAM,oBAAoB,GAAiD,CAAC,EAC1E,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,OAAO,CACL,eACE,IAAI,EAAC,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,WAAW,GAAG,4BAA4B,CAAC;AAShE,eAAe,IAAI,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Ellipse from './Ellipse';
|
|
3
|
+
import Rectangle from './Rectangle';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
const MiniMapNode = ({ height, shape, width, x, y }) => {
|
|
6
|
+
return (shape === 'oval' ?
|
|
7
|
+
_jsx(Ellipse, { height: height, width: width, x: x, y: y }) :
|
|
8
|
+
_jsx(Rectangle, { height: height, width: width, x: x, y: y }));
|
|
9
|
+
};
|
|
10
|
+
MiniMapNode.displayName = 'LincleMiniMapNode';
|
|
11
|
+
export default memo(MiniMapNode);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMapNode/index.tsx"],"names":[],"mappings":";AAGA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAEL,IAAI,EACL,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,GAAwC,CAAC,EACxD,MAAM,EACN,KAAK,EACL,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,OAAO,CACL,KAAK,KAAK,MAAM,CAAC,CAAC;QAEhB,KAAC,OAAO,IACN,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CAAC,CAAC;QAEJ,KAAC,SAAS,IACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CAEL,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAE9C,eAAe,IAAI,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const MiniMapNode_1 = __importDefault(require("../MiniMapNode"));
|
|
8
|
-
const react_web_interactive_1 = require("@lincle/react-web-interactive");
|
|
9
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Node from '../MiniMapNode';
|
|
3
|
+
import { useNodePositions, useScale, useTranslate } from '@lincle/react-web-interactive';
|
|
4
|
+
import { memo, useEffect, useMemo, useState } from 'react';
|
|
10
5
|
const displayName = 'LincleMiniMapPlain';
|
|
11
|
-
const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeight, lincleHeight
|
|
12
|
-
const nodePositions =
|
|
13
|
-
const { x: translateX, y: translateY } =
|
|
14
|
-
const scale =
|
|
15
|
-
const [nodes, setNodes] =
|
|
16
|
-
const hasNodes =
|
|
6
|
+
const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeight, lincleHeight, lincleWidth, node: nodeFunction, style: givenStyle, width: givenMapWidth }) => {
|
|
7
|
+
const nodePositions = useNodePositions();
|
|
8
|
+
const { x: translateX, y: translateY } = useTranslate();
|
|
9
|
+
const scale = useScale();
|
|
10
|
+
const [nodes, setNodes] = useState();
|
|
11
|
+
const hasNodes = useMemo(() => {
|
|
17
12
|
return nodes && Object.keys(nodes).length;
|
|
18
13
|
}, [
|
|
19
14
|
nodes
|
|
20
15
|
]);
|
|
21
|
-
const [nodeSize, setNodeSize] =
|
|
22
|
-
|
|
23
|
-
nodePositions
|
|
16
|
+
const [nodeSize, setNodeSize] = useState();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
nodePositions?.subscribe(displayName, (newSize, newNodes) => {
|
|
24
19
|
setNodeSize(newSize);
|
|
25
20
|
setNodes(newNodes);
|
|
26
21
|
});
|
|
27
22
|
return () => {
|
|
28
|
-
nodePositions
|
|
23
|
+
nodePositions?.unsubscribe(displayName);
|
|
29
24
|
};
|
|
30
25
|
}, []);
|
|
31
|
-
const map =
|
|
26
|
+
const map = useMemo(() => {
|
|
32
27
|
const piWidth = lincleWidth / Math.PI;
|
|
33
28
|
const piHeight = lincleHeight / Math.PI;
|
|
34
|
-
const width = givenMapWidth
|
|
35
|
-
const height = givenMapHeight
|
|
29
|
+
const width = givenMapWidth ?? Math.min(lincleWidth - 32, Math.max(Math.min(piWidth, piHeight), 128));
|
|
30
|
+
const height = givenMapHeight ?? Math.min(lincleHeight - 32, Math.max(Math.min(piWidth, piHeight / 1.5), 128));
|
|
36
31
|
return {
|
|
37
32
|
height,
|
|
38
33
|
width
|
|
@@ -43,7 +38,7 @@ const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeig
|
|
|
43
38
|
lincleHeight,
|
|
44
39
|
lincleWidth
|
|
45
40
|
]);
|
|
46
|
-
const viewSize =
|
|
41
|
+
const viewSize = useMemo(() => {
|
|
47
42
|
const height = lincleHeight / scale;
|
|
48
43
|
const left = -translateX / scale;
|
|
49
44
|
const top = -translateY / scale;
|
|
@@ -65,7 +60,7 @@ const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeig
|
|
|
65
60
|
translateX,
|
|
66
61
|
translateY
|
|
67
62
|
]);
|
|
68
|
-
const fullSize =
|
|
63
|
+
const fullSize = useMemo(() => {
|
|
69
64
|
if (hasNodes &&
|
|
70
65
|
nodeSize) {
|
|
71
66
|
const bottom = Math.max(nodeSize.bottom, viewSize.bottom);
|
|
@@ -89,7 +84,7 @@ const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeig
|
|
|
89
84
|
nodeSize,
|
|
90
85
|
viewSize
|
|
91
86
|
]);
|
|
92
|
-
const viewMaskSize =
|
|
87
|
+
const viewMaskSize = useMemo(() => {
|
|
93
88
|
const scaledHeight = fullSize.height / map.height;
|
|
94
89
|
const scaledWidth = fullSize.width / map.width;
|
|
95
90
|
const viewScale = Math.max(scaledWidth, scaledHeight);
|
|
@@ -122,20 +117,20 @@ const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeig
|
|
|
122
117
|
if (node) {
|
|
123
118
|
return nodeFunction ?
|
|
124
119
|
nodeFunction(node) :
|
|
125
|
-
((
|
|
120
|
+
(_jsx(Node, { height: node.height, shape: node.shape, width: node.width, x: node.x, y: node.y }, node.id));
|
|
126
121
|
}
|
|
127
122
|
else {
|
|
128
123
|
return null;
|
|
129
124
|
}
|
|
130
125
|
}) :
|
|
131
126
|
null;
|
|
132
|
-
const d =
|
|
127
|
+
const d = useMemo(() => {
|
|
133
128
|
return `M${viewMaskSize.left - viewMaskSize.gutter},${viewMaskSize.top - viewMaskSize.gutter}h${viewMaskSize.width + viewMaskSize.gutter * 2}v${viewMaskSize.height + viewMaskSize.gutter * 2}h${-viewMaskSize.width - viewMaskSize.gutter * 2}z M${viewSize.left},${viewSize.top}h${viewSize.width}v${viewSize.height}h${-viewSize.width}z`;
|
|
134
129
|
}, [
|
|
135
130
|
viewMaskSize,
|
|
136
131
|
viewSize
|
|
137
132
|
]);
|
|
138
|
-
const viewBox =
|
|
133
|
+
const viewBox = useMemo(() => {
|
|
139
134
|
return `${viewMaskSize.left} ${viewMaskSize.top} ${viewMaskSize.width} ${viewMaskSize.height}`;
|
|
140
135
|
}, [
|
|
141
136
|
viewMaskSize
|
|
@@ -143,7 +138,8 @@ const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeig
|
|
|
143
138
|
return lincleWidth === 0 ||
|
|
144
139
|
lincleHeight === 0 ?
|
|
145
140
|
null :
|
|
146
|
-
(
|
|
141
|
+
_jsxs("svg", { className: `${className} lincle-minimap-svg`, height: map.height, style: givenStyle, viewBox: viewBox, width: map.width, children: [Nodes, _jsx("path", { d: d, fill: 'rgba(238, 238, 238, 0.65)', fillRule: 'evenodd' })] });
|
|
147
142
|
};
|
|
148
143
|
MiniMapPlain.displayName = displayName;
|
|
149
|
-
|
|
144
|
+
export default memo(MiniMapPlain);
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMapPlain/index.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAQlC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC,MAAM,YAAY,GAAyC,CAAC,EAC1D,SAAS,EACT,MAAM,EAAE,WAAW,GAAG,CAAC,EACvB,MAAM,EAAE,cAAc,EACtB,YAAY,EACZ,WAAW,EACX,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,aAAa,EACrB,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IAEzC,MAAM,EACJ,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACd,GAAG,YAAY,EAAE,CAAC;IAEnB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,CACJ,KAAK,EACL,QAAQ,CACT,GAAG,QAAQ,EAAmB,CAAC;IAEhC,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE;QACH,OAAO,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAC5C,CAAC,EACD;QACE,KAAK;KACN,CACF,CAAC;IAEF,MAAM,CACJ,QAAQ,EACR,WAAW,CACZ,GAAG,QAAQ,EAAQ,CAAC;IAErB,SAAS,CACP,GAAG,EAAE;QACH,aAAa,EAAE,SAAS,CACtB,WAAW,EACX,CACE,OAAO,EACP,QAAQ,E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,CAAC,EAAE,CAAC,EACJ,IAAI,EAAC,2BAA2B,EAChC,QAAQ,EAAC,SAAS,GAClB,IACE,CAAC;AACX,CAAC,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;AAEvC,eAAe,IAAI,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,OAAO,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,IAAI,WAAW,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,OAAO,IAAI,YAAY,EACxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import MiniMapPlain from '../MiniMapPlain';
|
|
3
|
+
import { memo, useMemo } from 'react';
|
|
4
|
+
import { useResizeDetector } from 'react-resize-detector';
|
|
5
|
+
const displayName = 'LincleMiniMap';
|
|
6
|
+
const MiniMap = ({ className: givenClassname, gutter, height, node, style, width }) => {
|
|
7
|
+
const { height: lincleHeight = 0, ref, width: lincleWidth = 0 } = useResizeDetector({
|
|
8
|
+
refreshMode: 'debounce',
|
|
9
|
+
refreshRate: 16
|
|
10
|
+
});
|
|
11
|
+
const className = useMemo(() => {
|
|
12
|
+
return `lincle-minimap-container ${givenClassname}`;
|
|
13
|
+
}, [
|
|
14
|
+
givenClassname
|
|
15
|
+
]);
|
|
16
|
+
return (_jsx("div", { className: 'lincle-minimap', ref: ref, children: _jsx(MiniMapPlain, { className: className, gutter: gutter, height: height, lincleHeight: lincleHeight, lincleWidth: lincleWidth, node: node, style: style, width: width }) }));
|
|
17
|
+
};
|
|
18
|
+
MiniMap.displayName = displayName;
|
|
19
|
+
export default memo(MiniMap);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMap/index.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAEL,IAAI,EAEJ,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,OAAO,GAAoC,CAAC,EAChD,SAAS,EAAE,cAAc,EACzB,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACN,EAAgB,EAAE;IACjB,MAAM,EACJ,MAAM,EAAE,YAAY,GAAG,CAAC,EACxB,GAAG,EACH,KAAK,EAAE,WAAW,GAAG,CAAC,EACvB,GAAG,iBAAiB,CAAC;QACpB,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,EAAE;KAChB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE;QACH,OAAO,4BAA4B,cAAc,EAAE,CAAC;IACtD,CAAC,EACD;QACE,cAAc;KACf,CACF,CAAC;IAEF,OAAO,CACL,cACE,SAAS,EAAC,gBAAgB,EAC1B,GAAG,EAAE,GAAG,YAER,KAAC,YAAY,IACX,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACZ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAElC,eAAe,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
const MiniMapNodeEllipse = ({ height, width, x, y }) => {
|
|
4
|
+
const cx = useMemo(() => {
|
|
5
|
+
return x + width / 2;
|
|
6
|
+
}, [
|
|
7
|
+
width,
|
|
8
|
+
x
|
|
9
|
+
]);
|
|
10
|
+
const cy = useMemo(() => {
|
|
11
|
+
return y + height / 2;
|
|
12
|
+
}, [
|
|
13
|
+
height,
|
|
14
|
+
y
|
|
15
|
+
]);
|
|
16
|
+
const rx = useMemo(() => {
|
|
17
|
+
return width / 2;
|
|
18
|
+
}, [
|
|
19
|
+
width
|
|
20
|
+
]);
|
|
21
|
+
const ry = useMemo(() => {
|
|
22
|
+
return height / 2;
|
|
23
|
+
}, [
|
|
24
|
+
height
|
|
25
|
+
]);
|
|
26
|
+
return (_jsx("ellipse", { cx: cx, cy: cy, fill: 'rgba(0, 0, 0, 0.6)', rx: rx, ry: ry }));
|
|
27
|
+
};
|
|
28
|
+
MiniMapNodeEllipse.displayName = 'LincleMiniMapNodeEllipse';
|
|
29
|
+
export default memo(MiniMapNodeEllipse);
|
|
30
|
+
//# sourceMappingURL=Ellipse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ellipse.js","sourceRoot":"","sources":["../../../src/MiniMapNode/Ellipse.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EACJ,OAAO,EACR,MAAM,OAAO,CAAC;AAEf,MAAM,kBAAkB,GAA+C,CAAC,EACtE,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IACvB,CAAC,EACD;QACE,KAAK;QACL,CAAC;KACF,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;IACxB,CAAC,EACD;QACE,MAAM;QACN,CAAC;KACF,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC,EACD;QACE,KAAK;KACN,CACF,CAAC;IACF,MAAM,EAAE,GAAG,OAAO,CAChB,GAAG,EAAE;QACH,OAAO,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC,EACD;QACE,MAAM;KACP,CACF,CAAC;IAEF,OAAO,CACL,kBACE,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,oBAAoB,EACzB,EAAE,EAAE,EAAE,EACN,EAAE,EAAE,EAAE,GACN,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAS5D,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
const MiniMapNodeRectangle = ({ height, width, x, y }) => {
|
|
4
|
+
return (_jsx("rect", { fill: 'rgba(0, 0, 0, 0.6)', height: height, width: width, x: x, y: y }));
|
|
5
|
+
};
|
|
6
|
+
MiniMapNodeRectangle.displayName = 'LincleMiniMapNodeRectangle';
|
|
7
|
+
export default memo(MiniMapNodeRectangle);
|
|
8
|
+
//# sourceMappingURL=Rectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rectangle.js","sourceRoot":"","sources":["../../../src/MiniMapNode/Rectangle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EACL,MAAM,OAAO,CAAC;AAEf,MAAM,oBAAoB,GAAiD,CAAC,EAC1E,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,OAAO,CACL,eACE,IAAI,EAAC,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,WAAW,GAAG,4BAA4B,CAAC;AAShE,eAAe,IAAI,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Ellipse from './Ellipse';
|
|
3
|
+
import Rectangle from './Rectangle';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
const MiniMapNode = ({ height, shape, width, x, y }) => {
|
|
6
|
+
return (shape === 'oval' ?
|
|
7
|
+
_jsx(Ellipse, { height: height, width: width, x: x, y: y }) :
|
|
8
|
+
_jsx(Rectangle, { height: height, width: width, x: x, y: y }));
|
|
9
|
+
};
|
|
10
|
+
MiniMapNode.displayName = 'LincleMiniMapNode';
|
|
11
|
+
export default memo(MiniMapNode);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMapNode/index.tsx"],"names":[],"mappings":";AAGA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAEL,IAAI,EACL,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,GAAwC,CAAC,EACxD,MAAM,EACN,KAAK,EACL,KAAK,EACL,CAAC,EACD,CAAC,EACF,EAAE,EAAE;IACH,OAAO,CACL,KAAK,KAAK,MAAM,CAAC,CAAC;QAEhB,KAAC,OAAO,IACN,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CAAC,CAAC;QAEJ,KAAC,SAAS,IACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACJ,CAEL,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAE9C,eAAe,IAAI,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Node from '../MiniMapNode';
|
|
3
|
+
import { useNodePositions, useScale, useTranslate } from '@lincle/react-web-interactive';
|
|
4
|
+
import { memo, useEffect, useMemo, useState } from 'react';
|
|
5
|
+
const displayName = 'LincleMiniMapPlain';
|
|
6
|
+
const MiniMapPlain = ({ className, gutter: givenGutter = 8, height: givenMapHeight, lincleHeight, lincleWidth, node: nodeFunction, style: givenStyle, width: givenMapWidth }) => {
|
|
7
|
+
const nodePositions = useNodePositions();
|
|
8
|
+
const { x: translateX, y: translateY } = useTranslate();
|
|
9
|
+
const scale = useScale();
|
|
10
|
+
const [nodes, setNodes] = useState();
|
|
11
|
+
const hasNodes = useMemo(() => {
|
|
12
|
+
return nodes && Object.keys(nodes).length;
|
|
13
|
+
}, [
|
|
14
|
+
nodes
|
|
15
|
+
]);
|
|
16
|
+
const [nodeSize, setNodeSize] = useState();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
nodePositions?.subscribe(displayName, (newSize, newNodes) => {
|
|
19
|
+
setNodeSize(newSize);
|
|
20
|
+
setNodes(newNodes);
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
nodePositions?.unsubscribe(displayName);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
const map = useMemo(() => {
|
|
27
|
+
const piWidth = lincleWidth / Math.PI;
|
|
28
|
+
const piHeight = lincleHeight / Math.PI;
|
|
29
|
+
const width = givenMapWidth ?? Math.min(lincleWidth - 32, Math.max(Math.min(piWidth, piHeight), 128));
|
|
30
|
+
const height = givenMapHeight ?? Math.min(lincleHeight - 32, Math.max(Math.min(piWidth, piHeight / 1.5), 128));
|
|
31
|
+
return {
|
|
32
|
+
height,
|
|
33
|
+
width
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
givenMapHeight,
|
|
37
|
+
givenMapWidth,
|
|
38
|
+
lincleHeight,
|
|
39
|
+
lincleWidth
|
|
40
|
+
]);
|
|
41
|
+
const viewSize = useMemo(() => {
|
|
42
|
+
const height = lincleHeight / scale;
|
|
43
|
+
const left = -translateX / scale;
|
|
44
|
+
const top = -translateY / scale;
|
|
45
|
+
const width = lincleWidth / scale;
|
|
46
|
+
const bottom = top + height;
|
|
47
|
+
const right = left + width;
|
|
48
|
+
return {
|
|
49
|
+
bottom,
|
|
50
|
+
height,
|
|
51
|
+
left,
|
|
52
|
+
right,
|
|
53
|
+
top,
|
|
54
|
+
width
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
lincleHeight,
|
|
58
|
+
lincleWidth,
|
|
59
|
+
scale,
|
|
60
|
+
translateX,
|
|
61
|
+
translateY
|
|
62
|
+
]);
|
|
63
|
+
const fullSize = useMemo(() => {
|
|
64
|
+
if (hasNodes &&
|
|
65
|
+
nodeSize) {
|
|
66
|
+
const bottom = Math.max(nodeSize.bottom, viewSize.bottom);
|
|
67
|
+
const left = Math.min(nodeSize.left, viewSize.left);
|
|
68
|
+
const right = Math.max(nodeSize.right, viewSize.right);
|
|
69
|
+
const top = Math.min(nodeSize.top, viewSize.top);
|
|
70
|
+
const height = bottom - top;
|
|
71
|
+
const width = right - left;
|
|
72
|
+
return {
|
|
73
|
+
bottom,
|
|
74
|
+
height,
|
|
75
|
+
left,
|
|
76
|
+
right,
|
|
77
|
+
top,
|
|
78
|
+
width
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return viewSize;
|
|
82
|
+
}, [
|
|
83
|
+
hasNodes,
|
|
84
|
+
nodeSize,
|
|
85
|
+
viewSize
|
|
86
|
+
]);
|
|
87
|
+
const viewMaskSize = useMemo(() => {
|
|
88
|
+
const scaledHeight = fullSize.height / map.height;
|
|
89
|
+
const scaledWidth = fullSize.width / map.width;
|
|
90
|
+
const viewScale = Math.max(scaledWidth, scaledHeight);
|
|
91
|
+
const viewHeight = viewScale * map.height;
|
|
92
|
+
const viewWidth = viewScale * map.width;
|
|
93
|
+
const gutter = givenGutter * viewScale;
|
|
94
|
+
const left = fullSize.left - (viewWidth - fullSize.width) / 2 - gutter;
|
|
95
|
+
const top = fullSize.top - (viewHeight - fullSize.height) / 2 - gutter;
|
|
96
|
+
const height = viewHeight + gutter * 2;
|
|
97
|
+
const width = viewWidth + gutter * 2;
|
|
98
|
+
const bottom = top + height;
|
|
99
|
+
const right = left + width;
|
|
100
|
+
return {
|
|
101
|
+
bottom,
|
|
102
|
+
gutter,
|
|
103
|
+
height,
|
|
104
|
+
left,
|
|
105
|
+
right,
|
|
106
|
+
top,
|
|
107
|
+
width
|
|
108
|
+
};
|
|
109
|
+
}, [
|
|
110
|
+
fullSize,
|
|
111
|
+
givenGutter,
|
|
112
|
+
map
|
|
113
|
+
]);
|
|
114
|
+
const Nodes = nodes ?
|
|
115
|
+
Object.keys(nodes).map((nodeId) => {
|
|
116
|
+
const node = nodes[nodeId];
|
|
117
|
+
if (node) {
|
|
118
|
+
return nodeFunction ?
|
|
119
|
+
nodeFunction(node) :
|
|
120
|
+
(_jsx(Node, { height: node.height, shape: node.shape, width: node.width, x: node.x, y: node.y }, node.id));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}) :
|
|
126
|
+
null;
|
|
127
|
+
const d = useMemo(() => {
|
|
128
|
+
return `M${viewMaskSize.left - viewMaskSize.gutter},${viewMaskSize.top - viewMaskSize.gutter}h${viewMaskSize.width + viewMaskSize.gutter * 2}v${viewMaskSize.height + viewMaskSize.gutter * 2}h${-viewMaskSize.width - viewMaskSize.gutter * 2}z M${viewSize.left},${viewSize.top}h${viewSize.width}v${viewSize.height}h${-viewSize.width}z`;
|
|
129
|
+
}, [
|
|
130
|
+
viewMaskSize,
|
|
131
|
+
viewSize
|
|
132
|
+
]);
|
|
133
|
+
const viewBox = useMemo(() => {
|
|
134
|
+
return `${viewMaskSize.left} ${viewMaskSize.top} ${viewMaskSize.width} ${viewMaskSize.height}`;
|
|
135
|
+
}, [
|
|
136
|
+
viewMaskSize
|
|
137
|
+
]);
|
|
138
|
+
return lincleWidth === 0 ||
|
|
139
|
+
lincleHeight === 0 ?
|
|
140
|
+
null :
|
|
141
|
+
_jsxs("svg", { className: `${className} lincle-minimap-svg`, height: map.height, style: givenStyle, viewBox: viewBox, width: map.width, children: [Nodes, _jsx("path", { d: d, fill: 'rgba(238, 238, 238, 0.65)', fillRule: 'evenodd' })] });
|
|
142
|
+
};
|
|
143
|
+
MiniMapPlain.displayName = displayName;
|
|
144
|
+
export default memo(MiniMapPlain);
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/MiniMapPlain/index.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAQlC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,IAAI,EACJ,SAAS,EACT,OAAO,EACP,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC,MAAM,YAAY,GAAyC,CAAC,EAC1D,SAAS,EACT,MAAM,EAAE,WAAW,GAAG,CAAC,EACvB,MAAM,EAAE,cAAc,EACtB,YAAY,EACZ,WAAW,EACX,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,aAAa,EACrB,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,gBAAgB,EAAE,CA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G,CAAC;IACN,CAAC,EACD;QACE,YAAY;QACZ,QAAQ;KACT,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE;QACH,OAAO,GACL,YAAY,CAAC,IACf,IACE,YAAY,CAAC,GACf,IACE,YAAY,CAAC,KACf,IACE,YAAY,CAAC,MACf,EAAE,CAAC;IACL,CAAC,EACD;QACE,YAAY;KACb,CACF,CAAC;IAEF,OAAO,WAAW,KAAK,CAAC;QACtB,YAAY,KAAK,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,CAAC;QAEN,eACE,SAAS,EAAE,GAAG,SAAS,qBAAqB,EAC5C,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,GAAG,CAAC,KAAK,aAEf,KAAK,EACN,eACE,CAAC,EAAE,CAAC,EACJ,IAAI,EAAC,2BAA2B,EAChC,QAAQ,EAAC,SAAS,GAClB,IACE,CAAC;AACX,CAAC,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;AAEvC,eAAe,IAAI,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,OAAO,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,IAAI,WAAW,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,OAAO,IAAI,YAAY,EACxB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/dist/styles.g.css
CHANGED
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
.lincle-minimap-svg {
|
|
28
28
|
display: flex;
|
|
29
|
+
z-index: 2;
|
|
29
30
|
align-items: center;
|
|
30
|
-
background-color:
|
|
31
|
+
background-color: rgb(255 255 255 / 0.95%);
|
|
31
32
|
cursor: pointer;
|
|
32
33
|
pointer-events: auto;
|
|
33
34
|
backdrop-filter: blur(8px);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@lincle/react-web-minimap",
|
|
3
3
|
"title": "lincle react web minimap",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
|
-
"version": "0.4.0-next.
|
|
5
|
+
"version": "0.4.0-next.18",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A 'reactive' React node and edge generator",
|
|
8
8
|
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
"position": "Initial and Lead Developer"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"
|
|
16
|
+
"main": "dist/cjs/index.js",
|
|
17
|
+
"module": "dist/esm/index.js",
|
|
18
|
+
"types": "dist/esm/index.d.ts",
|
|
18
19
|
"files": [
|
|
19
20
|
"dist/",
|
|
20
21
|
"COPYING.md",
|
|
@@ -30,7 +31,9 @@
|
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build": "run-s clean:dist build:prod build:styles",
|
|
33
|
-
"build:prod": "
|
|
34
|
+
"build:prod": "run-p build:cjs:prod build:esm:prod",
|
|
35
|
+
"build:cjs:prod": "tsc -p ./tsconfig.cjs.json",
|
|
36
|
+
"build:esm:prod": "tsc -p ./tsconfig.json",
|
|
34
37
|
"build:watch": "run-s clean:dist build:prod build:styles build:watch:tsc",
|
|
35
38
|
"build:watch:tsc": "tsc -p ./tsconfig.json --watch --pretty --preserveWatchOutput",
|
|
36
39
|
"build:styles": "ncp src/styles.g.css dist/styles.g.css",
|
|
@@ -44,33 +47,33 @@
|
|
|
44
47
|
"clean:dist": "rimraf dist"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
|
-
"@digest/eslint-config-jest": "^4.14.
|
|
48
|
-
"@digest/eslint-config-react": "^4.14.
|
|
49
|
-
"@digest/eslint-config-typescript": "^4.14.
|
|
50
|
-
"@digest/jest-junit": "^4.14.
|
|
51
|
-
"@digest/jest-react": "^4.14.
|
|
52
|
-
"@digest/jest-typescript": "^4.14.
|
|
53
|
-
"@digest/stylelint-config": "^4.14.
|
|
54
|
-
"@digest/typescript": "^4.14.
|
|
55
|
-
"@types/jest": "^
|
|
56
|
-
"@types/node": "^
|
|
57
|
-
"@types/react": "^19.
|
|
58
|
-
"@types/react-dom": "^19.
|
|
50
|
+
"@digest/eslint-config-jest": "^4.14.14",
|
|
51
|
+
"@digest/eslint-config-react": "^4.14.14",
|
|
52
|
+
"@digest/eslint-config-typescript": "^4.14.14",
|
|
53
|
+
"@digest/jest-junit": "^4.14.14",
|
|
54
|
+
"@digest/jest-react": "^4.14.14",
|
|
55
|
+
"@digest/jest-typescript": "^4.14.14",
|
|
56
|
+
"@digest/stylelint-config": "^4.14.14",
|
|
57
|
+
"@digest/typescript": "^4.14.14",
|
|
58
|
+
"@types/jest": "^30.0.0",
|
|
59
|
+
"@types/node": "^25.2.1",
|
|
60
|
+
"@types/react": "^19.2.13",
|
|
61
|
+
"@types/react-dom": "^19.2.3",
|
|
59
62
|
"@types/react-test-renderer": "^19.1.0",
|
|
60
|
-
"cross-env": "^
|
|
61
|
-
"jest-environment-jsdom": "^
|
|
63
|
+
"cross-env": "^10.1.0",
|
|
64
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
62
65
|
"jest-environment-jsdom-global": "^4.0.0",
|
|
63
66
|
"ncp": "^2.0.0",
|
|
64
67
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"react": "^19.
|
|
66
|
-
"react-dom": "^19.
|
|
67
|
-
"react-test-renderer": "^19.
|
|
68
|
-
"rimraf": "^6.
|
|
68
|
+
"react": "^19.2.4",
|
|
69
|
+
"react-dom": "^19.2.4",
|
|
70
|
+
"react-test-renderer": "^19.2.4",
|
|
71
|
+
"rimraf": "^6.1.2"
|
|
69
72
|
},
|
|
70
73
|
"dependencies": {
|
|
71
|
-
"@lincle/react-shared": "^0.4.0-next.
|
|
72
|
-
"@lincle/react-web-interactive": "^0.4.0-next.
|
|
73
|
-
"react-resize-detector": "^12.0
|
|
74
|
+
"@lincle/react-shared": "^0.4.0-next.18",
|
|
75
|
+
"@lincle/react-web-interactive": "^0.4.0-next.18",
|
|
76
|
+
"react-resize-detector": "^12.3.0"
|
|
74
77
|
},
|
|
75
78
|
"peerDependencies": {
|
|
76
79
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -91,5 +94,5 @@
|
|
|
91
94
|
"acyclical graph",
|
|
92
95
|
"cyclical graph"
|
|
93
96
|
],
|
|
94
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "8c8017797cadc70f9c4a7665982040b192c8e357"
|
|
95
98
|
}
|
package/dist/MiniMap/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const MiniMapPlain_1 = __importDefault(require("../MiniMapPlain"));
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const react_resize_detector_1 = require("react-resize-detector");
|
|
10
|
-
const displayName = 'LincleMiniMap';
|
|
11
|
-
const MiniMap = ({ className: givenClassname, gutter, height, node, style, width }) => {
|
|
12
|
-
const { height: lincleHeight = 0, ref, width: lincleWidth = 0 } = (0, react_resize_detector_1.useResizeDetector)({
|
|
13
|
-
refreshMode: 'debounce',
|
|
14
|
-
refreshRate: 16
|
|
15
|
-
});
|
|
16
|
-
const className = (0, react_1.useMemo)(() => {
|
|
17
|
-
return `lincle-minimap-container ${givenClassname}`;
|
|
18
|
-
}, [
|
|
19
|
-
givenClassname
|
|
20
|
-
]);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: 'lincle-minimap', ref: ref, children: (0, jsx_runtime_1.jsx)(MiniMapPlain_1.default, { className: className, gutter: gutter, height: height, lincleHeight: lincleHeight, lincleWidth: lincleWidth, node: node, style: style, width: width }) }));
|
|
22
|
-
};
|
|
23
|
-
MiniMap.displayName = displayName;
|
|
24
|
-
exports.default = (0, react_1.memo)(MiniMap);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const MiniMapNodeEllipse = ({ height, width, x, y }) => {
|
|
6
|
-
const cx = (0, react_1.useMemo)(() => {
|
|
7
|
-
return x + width / 2;
|
|
8
|
-
}, [
|
|
9
|
-
width,
|
|
10
|
-
x
|
|
11
|
-
]);
|
|
12
|
-
const cy = (0, react_1.useMemo)(() => {
|
|
13
|
-
return y + height / 2;
|
|
14
|
-
}, [
|
|
15
|
-
height,
|
|
16
|
-
y
|
|
17
|
-
]);
|
|
18
|
-
const rx = (0, react_1.useMemo)(() => {
|
|
19
|
-
return width / 2;
|
|
20
|
-
}, [
|
|
21
|
-
width
|
|
22
|
-
]);
|
|
23
|
-
const ry = (0, react_1.useMemo)(() => {
|
|
24
|
-
return height / 2;
|
|
25
|
-
}, [
|
|
26
|
-
height
|
|
27
|
-
]);
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)("ellipse", { cx: cx, cy: cy, fill: 'rgba(0, 0, 0, 0.6)', rx: rx, ry: ry }));
|
|
29
|
-
};
|
|
30
|
-
MiniMapNodeEllipse.displayName = 'LincleMiniMapNodeEllipse';
|
|
31
|
-
exports.default = (0, react_1.memo)(MiniMapNodeEllipse);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const MiniMapNodeRectangle = ({ height, width, x, y }) => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("rect", { fill: 'rgba(0, 0, 0, 0.6)', height: height, width: width, x: x, y: y }));
|
|
7
|
-
};
|
|
8
|
-
MiniMapNodeRectangle.displayName = 'LincleMiniMapNodeRectangle';
|
|
9
|
-
exports.default = (0, react_1.memo)(MiniMapNodeRectangle);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const Ellipse_1 = __importDefault(require("./Ellipse"));
|
|
8
|
-
const Rectangle_1 = __importDefault(require("./Rectangle"));
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const MiniMapNode = ({ height, shape, width, x, y }) => {
|
|
11
|
-
return (shape === 'oval' ?
|
|
12
|
-
(0, jsx_runtime_1.jsx)(Ellipse_1.default, { height: height, width: width, x: x, y: y }) :
|
|
13
|
-
(0, jsx_runtime_1.jsx)(Rectangle_1.default, { height: height, width: width, x: x, y: y }));
|
|
14
|
-
};
|
|
15
|
-
MiniMapNode.displayName = 'LincleMiniMapNode';
|
|
16
|
-
exports.default = (0, react_1.memo)(MiniMapNode);
|
package/dist/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MiniMapPlain = exports.MiniMapNode = exports.MiniMap = void 0;
|
|
7
|
-
var MiniMap_1 = require("./MiniMap");
|
|
8
|
-
Object.defineProperty(exports, "MiniMap", { enumerable: true, get: function () { return __importDefault(MiniMap_1).default; } });
|
|
9
|
-
var MiniMapNode_1 = require("./MiniMapNode");
|
|
10
|
-
Object.defineProperty(exports, "MiniMapNode", { enumerable: true, get: function () { return __importDefault(MiniMapNode_1).default; } });
|
|
11
|
-
var MiniMapPlain_1 = require("./MiniMapPlain");
|
|
12
|
-
Object.defineProperty(exports, "MiniMapPlain", { enumerable: true, get: function () { return __importDefault(MiniMapPlain_1).default; } });
|
package/dist/types.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|