@lincle/react-web-minimap 0.4.0-next.10

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/LICENSE.md ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
package/README.md ADDED
@@ -0,0 +1,297 @@
1
+ <div align="center">
2
+ <h1><code>@lincle/react-web-interactive</code>: An interactive <i>reactive</i> React node and edge generator</h1>
3
+ </div>
4
+
5
+ <div align="center">
6
+ <a href="https://www.npmjs.org/package/@lincle/react-web-interactive"><img alt="NPM Version" src="https://img.shields.io/npm/v/@lincle/react-web-interactive.svg" /></a>
7
+ <a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img alt="License" src="https://img.shields.io/npm/l/@lincle/react-web-interactive.svg" /></a>
8
+ <a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgitlab.com%2Flincle%2Flincle?ref=badge_shield"><img alt="FOSSA Status" src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgitlab.com%2Flincle%2Flincle.svg?type=shield" /></a>
9
+ </div>
10
+
11
+ <div align="center">
12
+ <a href="https://github.com/gajus/canonical"><img alt="Canonical Code Style" src="https://img.shields.io/badge/code%20style-canonical-blue.svg" /></a>
13
+ <a href="https://commitizen.github.io/cz-cli/"><img alt="Commitizen Friendly" src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" /></a>
14
+ <a href="https://github.com/semantic-release/semantic-release#readme"><img alt="Semantic Release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" /></a>
15
+ </div>
16
+
17
+ <div align="center">
18
+ <a href="https://gitlab.com/digested/lincle/commits/master"><img alt="Build Status" src="https://gitlab.com/digested/lincle/badges/master/pipeline.svg" /></a>
19
+ <a href="https://lincle.gitlab.io/lincle/stats/base/coverage/lcov-report/"><img alt="Coverage Report" src="https://gitlab.com/digested/lincle/badges/master/coverage.svg" /></a>
20
+ <a href="https://lincle.gitlab.io/lincle/stats/base/webpack/"><img alt="Build Analysis" src="https://img.shields.io/badge/webpack-stats-blue.svg" /></a>
21
+ </div>
22
+
23
+ **`@lincle/react-web-interactive`** generates a reactive, composable graph/diagram. `@lincle/react-web-interactive` is built on [`@lincle/base`](https://www.npmjs.com/package/@lincle/base) diagram generating capabilities adding interactive functionality.
24
+
25
+ Interactivity is provided by:
26
+ * [`react-map-interaction`](https://www.npmjs.com/package/react-map-interaction) for panning and scaling
27
+ * [`react-draggable`](https://www.npmjs.com/package/react-draggable) for moving of nodes and edges.
28
+
29
+ The nodes are moveable by default. To pull new edges, tap and hold the diagram or press and hold `shift`. To select nodes, press on a node for half a second or hold `ctrl`.
30
+
31
+ > ***Note**: node selection relies on a callback function and is **disabled** if a callback is not provided.*
32
+
33
+ Please see the various testing [demos](https://lincle.gitlab.io/lincle/) for examples.
34
+
35
+ ## Installation & Setup
36
+
37
+ Install `@lincle/react-web-interactive` and the peer dependencies `react`, `react-dom`:
38
+
39
+ ```
40
+ npm install react react-dom @lincle/react-web-interactive
41
+ ```
42
+
43
+ Also include the provided styles file. For example:
44
+
45
+ ```
46
+ import '@lincle/react-web-interactive/dist/main.min.css';
47
+ ```
48
+
49
+ ## Simple Example
50
+
51
+ The following example will generate this diagram:
52
+
53
+ <div align="center">
54
+ <a href="https://gitlab.com/digested/lincle/-/raw/master/static/react-yad-example.png">
55
+ <img src="https://gitlab.com/digested/lincle/-/raw/master/static/react-yad-example.png" alt="resulting screenshot of simple example" style="max-width:100%;">
56
+ </a>
57
+ </div>
58
+
59
+ > [<h3>CodeSandbox</h3>](https://codesandbox.io/s/react-yad-simple-example-cus8v)
60
+
61
+ ```css
62
+ .node {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ width: calc(100% - 2px);
67
+ height: calc(100% - 2px);
68
+ cursor: grab;
69
+ border: 1px solid black;
70
+ background-color: white;
71
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
72
+ }
73
+
74
+ .node:active {
75
+ cursor: grabbing;
76
+ }
77
+
78
+ .node-oval {
79
+ border-radius: 50%;
80
+ }
81
+ ```
82
+
83
+ ```ts
84
+ <Graph
85
+ id='YetAnotherDiagram'
86
+ key='1'
87
+ nodeHeight={50}
88
+ nodeWidth={50}
89
+ onEdgeDrop={handleEdgeDrop}
90
+ >
91
+ <Nodes>
92
+ <Node
93
+ id={1}
94
+ key={1}
95
+ x={50}
96
+ y={50}
97
+ >
98
+ <div styleName='node'>
99
+ Node 1
100
+ </div>
101
+ </Node>
102
+ <Node
103
+ height={100}
104
+ id={2}
105
+ key={2}
106
+ line='direct'
107
+ shape='oval'
108
+ width={200}
109
+ x={100}
110
+ y={150}
111
+ >
112
+ <div styleName='node node-oval'>
113
+ Node 2
114
+ </div>
115
+ </Node>
116
+ <Node
117
+ id={3}
118
+ key={3}
119
+ line='curve'
120
+ shape='oval'
121
+ x={150}
122
+ y={350}
123
+ >
124
+ <div styleName='node node-oval'>
125
+ Node 3
126
+ </div>
127
+ </Node>
128
+ </Nodes>
129
+ <Edges>
130
+ <Edge
131
+ id={1}
132
+ key={1}
133
+ sourceId={1}
134
+ targetId={2}
135
+ >
136
+ <circle
137
+ fill='white'
138
+ r='3'
139
+ stroke='black'
140
+ strokeWidth={2}
141
+ >
142
+ <title>
143
+ Bridge
144
+ </title>
145
+ </circle>
146
+ </Edge>
147
+ <Edge
148
+ id={2}
149
+ key={2}
150
+ line='direct'
151
+ sourceId={2}
152
+ targetId={3}
153
+ />
154
+ </Edges>
155
+ </Graph>
156
+ ```
157
+
158
+ ## Component API's
159
+
160
+ **\*** *bolded parameters are required*
161
+
162
+ ### `<Graph>`
163
+
164
+ | Parameters | Type | Default | Description |
165
+ |---|---|---|---|
166
+ | **`id`** | `string \| number` | | The unique ID of the graph |
167
+ | disableMove | `boolean` | `false` | Disable moving nodes |
168
+ | disablePan | `boolean` | `false` | Disable panning the diagram |
169
+ | disablePull | `boolean` | `false` | Disable connecting nodes |
170
+ | disableScale | `boolean` | `false` | Disable zooming/scaling the diagram |
171
+ | edgeFrequency | `number` | `16` (*60Hz*) | Frequency of edge updates during node movements (in ms) |
172
+ | grid | `false \| [number, number]` | `[16, 16]` | The background grid space; false to disable. |
173
+ | line | `"curve" \| "direct" \| "step"` | `"step"` | The default curve for the edges |
174
+ | maxScale | `number` | `2` | The maximum zoom/scale of the diagram |
175
+ | minScale | `number` | `0.5` | The minimum zoom/scale of the diagram |
176
+ | mode | `"move" \| "pull"` | `"move"` | Forced interaction state of the diagram (moving nodes or pulling/connectiong them) |
177
+ | nodeFrequency | `number` | `500` | Frequency of node movements reported (in ms, aside from edges) |
178
+ | nodeHeight | `number` | `50` | The default height for nodes (in px) |
179
+ | nodeWidth | `number` | `50` | The default width for nodes (in px) |
180
+ | onEdgeDrop | `(sourceId: string, targetId: string) => void` | | The default callback when an edge is dropped. |
181
+ | onMouseDown | `(event: MouseEvent<HTMLDivElement>) => void` | | Callback passed on main diagram `<div />` |
182
+ | onMouseUp | `(event: MouseEvent<HTMLDivElement>) => void` | | Callback passed on main diagram `<div />` |
183
+ | onNodeDrag | `(event: DraggableEvent, nodeId: ReactText, data: DraggableData) => void` | | Default callback for dropping an edge |
184
+ | onNodeSelect | `(nodeId: ReactText) => void` | | Default callback for selecting a node |
185
+ | onNodeStart | `(event: DraggableEvent, nodeId: ReactText) => void` | | Default callback for nodes |
186
+ | onNodeStop | `(event: DraggableEvent, nodeId: ReactText, data: DraggableData) => void` | | Default callback for nodes |
187
+ | onScale | `(scale: number) => void` | | Callback passed on diagram scale events |
188
+ | onTouchEnd | `(event: TouchEvent<HTMLDivElement>) => void` | | Callback passed on main diagram `<div />` |
189
+ | onTouchStart| `(event: TouchEvent<HTMLDivElement>) => void` | | Callback passed on main diagram `<div />` |
190
+ | onTranslate | `({x: number, y: number}) => void` | | Callback passed on diagram translate events |
191
+ | scale | `number` | `1` | The default zoom/scale of the diagram |
192
+ | shape | `"oval" \| "rectangle"` | `"rectangle"` | The default shape for nodes |
193
+ | snap | `boolean \| [number, number]` | `false` | Snap nodes to grid when moved. If `true` nodes will snap to `grid` dimensions. |
194
+ | xOffset | `number` | `0` | The initial x-axis position of the diagram |
195
+ | yOffset | `number` | `0` | The initial y-axis position of the diagram |
196
+
197
+ ### `<GraphContexts>`
198
+
199
+ | Parameters | Type | Default | Description |
200
+ |---|---|---|---|
201
+ | <td colspan="3">*Same API as `<Graph />` ommiting the mouse and touch event passthrough* |
202
+
203
+ The primary purpose of `<GraphContexts>` is to include additional elements in the graph that will share access to the various `<Context.Providers>` - such as `@lincle/minimap`.
204
+
205
+ ### `<Nodes>`
206
+
207
+ | Parameters | Type | Default | Description |
208
+ |---|---|---|---|
209
+ | *none* |
210
+
211
+ ### `<Node>`
212
+
213
+ | Parameters | Type | Default | Description |
214
+ |---|---|---|---|
215
+ | **`id`** | `string | number` | | The unique ID of the node |
216
+ | x | `number` | `0` | The initial `x` coordinate of the node |
217
+ | y | `number` | `0` | The initial `y` coordinate of the node |
218
+ | <td colspan="3">*The following override the defaults provided by `<Graph />`* |
219
+ | disableMove | `boolean` | `false` | Disable moving this node |
220
+ | disablePull | `boolean` | `false` | Disable connecting this node |
221
+ | height | `number` | `50` | The node height|
222
+ | line | `'curve' \| 'direct' \| 'step'` | | The connector line shape |
223
+ | mode | `"move" \| "pull"` | | The node interactive state (moving node or pulling/connecting) |
224
+ | onDrag | `(event: DraggableEvent, nodeId: ReactText, data: DraggableData) => void` | | Callback for node |
225
+ | onEdgeDrop | `(sourceId: string, targetId: string) => void` | | Callback for dropping an edge |
226
+ | onSelect | `(nodeId: ReactText) => void` | | Callback for selecting a node |
227
+ | onStart | `(event: DraggableEvent, nodeId: ReactText) => void` | | Callback for node |
228
+ | onStop | `(event: DraggableEvent, nodeId: ReactText, data: DraggableData) => void` | | Callback for node |
229
+ | shape | `'oval' \| 'rectangle'` | | The node shape |
230
+ | width | `number` | `50` | The node width |
231
+
232
+ ### `<Edges>`
233
+
234
+ | Parameters | Type | Default | Description |
235
+ |---|---|---|---|
236
+ | dash | `boolean \| undefined` | `undefined` | Whether dash should be enabled. Defaults to hover only. |
237
+
238
+ ### `<Edge>`
239
+
240
+ | Parameters | Type | Default | Description |
241
+ |---|---|---|---|
242
+ | **`id`** | `string \| number` | | The unique ID for the edge |
243
+ | dash | `boolean \| undefined` | `undefined` | Whether dash should be enabled. Defaults to hover only. |
244
+ | line | `'curve' \| 'direct' \| 'step'` | | The line shape (overrides default) and not applicable if custom path generator is used. |
245
+ | markerEnd | `string` | | Passed to the default path generated `<path>` SVG |
246
+ | markerStart | `string` | | Passed to the default path generated `<path>` SVG |
247
+ | path | *path `function` - see below* | | Use to generate a custom path component. |
248
+ | **`sourceId`** | `string \| number` | | ID for the source node |
249
+ | **`targetId`** | `string \| number` | | ID for the target node |
250
+
251
+ > ***Note**: The child of `<Edge />` is intended to be an element at the center of the path. The child will be inside an `<SVG />` element and should be an SVG type or wrapped in a `<foreignObject />` element. See examples for details.*
252
+
253
+ ### Path `function`
254
+
255
+ Instead of using the `@lincle/react-web-interactive` provided edges (`curve`, `line`, & `step`), you may opt to generate your own path component:
256
+
257
+ ```ts
258
+ (
259
+ source: {
260
+ height: number,
261
+ id: string | number,
262
+ shape: 'oval' | 'rectangle',
263
+ width: number,
264
+ x: number,
265
+ y: number
266
+ },
267
+ target: {
268
+ height: number,
269
+ id: string | number,
270
+ shape: 'oval' | 'rectangle',
271
+ width: number,
272
+ x: number,
273
+ y: number
274
+ },
275
+ children?: ReactNode
276
+ ) => Component<SVG type>
277
+ ```
278
+
279
+ ### `<Grid>`
280
+
281
+ | Parameters | Type | Default | Description |
282
+ |---|---|---|---|
283
+ | children | `SVG` | `<circle>` | The repeated SVG |
284
+
285
+ ### Contexts
286
+
287
+ There are several `<Context>`'s used that can be taken advantage of to extend the functionality of `lincle` via their respective `<Context.Provider>`s':
288
+
289
+ | Context | Provides | Description |
290
+ |---|---|---|
291
+ | `<GraphContext>` | `{diagramId: ReactText, nodePosition: NodePositions, edgeSubscriber: EdgeSubscriber, defaultSettings: DefaultSettings}` | Provides the current diagramId and default settings along with classes to subscribe to `<Node>` and `<Edge>` events. |
292
+ | `<GridContext>` | `[number, number]` | Provides the current grid dimensions. |
293
+ | `<ModeContext>` | `{disableMove?: boolean, disablePull?: boolean, givenMode?: 'move' \| 'pull' \| 'select', mode: 'move' \| 'pull' \| 'select', onMode?: 'move' \| 'pull' \| 'select' => void}` | Provides the current graph mode, whether move and pull are enabled on nodes, an optional given override mode, and a function to change the mode. |
294
+ | `<ScaleContext>` | `{scale: number, onScale?: (scale: number) => void}` | Provides the current scale and a function to change the scale. |
295
+ | `<SnapContext>` | `[number, number]` | Provides the current snap dimensions. |
296
+ | `<TranslateContext>` | `{translate: {x: number, y: number}, onTranslate?: (translate: {x: number, y: number}) => void}` | Provides the current graph translation (xOffset and yOffset) and a function to change the translation. |
297
+ | `<TransformContext>` | `{disablePan?: boolean, disableScale?: boolean, maxScale?: number, minScale?: number}` | Provides the rest of the graphs current transform properties. |
@@ -0,0 +1,3 @@
1
+ import { type MiniMapProps } from '../types';
2
+ declare const _default: import("react").NamedExoticComponent<MiniMapProps>;
3
+ export default _default;
@@ -0,0 +1,24 @@
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);
@@ -0,0 +1,8 @@
1
+ type MiniMapNodeEllipseProps = {
2
+ readonly height: number;
3
+ readonly width: number;
4
+ readonly x: number;
5
+ readonly y: number;
6
+ };
7
+ declare const _default: import("react").NamedExoticComponent<MiniMapNodeEllipseProps>;
8
+ export default _default;
@@ -0,0 +1,31 @@
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);
@@ -0,0 +1,8 @@
1
+ type MiniMapNodeRectangleProps = {
2
+ readonly height: number;
3
+ readonly width: number;
4
+ readonly x: number;
5
+ readonly y: number;
6
+ };
7
+ declare const _default: import("react").NamedExoticComponent<MiniMapNodeRectangleProps>;
8
+ export default _default;
@@ -0,0 +1,9 @@
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);
@@ -0,0 +1,3 @@
1
+ import { type MiniMapNodeProps } from '../types';
2
+ declare const _default: import("react").NamedExoticComponent<MiniMapNodeProps>;
3
+ export default _default;
@@ -0,0 +1,16 @@
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);
@@ -0,0 +1,3 @@
1
+ import { type MiniMapPlainProps } from '../types';
2
+ declare const _default: import("react").NamedExoticComponent<MiniMapPlainProps>;
3
+ export default _default;