@flowgram.ai/minimap-plugin 0.1.0-alpha.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.
@@ -0,0 +1,611 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+
12
+ // src/component.tsx
13
+ import React, { useEffect, useRef, useState } from "react";
14
+
15
+ // src/constant.ts
16
+ var MinimapDefaultCanvasStyle = {
17
+ canvasWidth: 250,
18
+ canvasHeight: 250,
19
+ canvasPadding: 50,
20
+ canvasBackground: "rgba(242, 243, 245, 1)",
21
+ canvasBorderRadius: 10,
22
+ viewportBackground: "rgba(255, 255, 255, 1)",
23
+ viewportBorderRadius: 4,
24
+ viewportBorderColor: "rgba(6, 7, 9, 0.10)",
25
+ viewportBorderWidth: 1,
26
+ viewportBorderDashLength: void 0,
27
+ nodeColor: "rgba(0, 0, 0, 0.10)",
28
+ nodeBorderRadius: 2,
29
+ nodeBorderWidth: 0.145,
30
+ nodeBorderColor: "rgba(6, 7, 9, 0.10)",
31
+ overlayColor: "rgba(255, 255, 255, 0.55)"
32
+ };
33
+ var MinimapDefaultInactiveStyle = {
34
+ scale: 0.7,
35
+ opacity: 1,
36
+ translateX: 15,
37
+ translateY: 15
38
+ };
39
+ var MinimapDefaultOptions = {
40
+ canvasStyle: MinimapDefaultCanvasStyle,
41
+ canvasClassName: "gedit-minimap-canvas",
42
+ enableActiveDebounce: false,
43
+ enableInactiveDebounce: true,
44
+ enableDisplayAllNodes: false,
45
+ activeDebounceTime: 0,
46
+ inactiveDebounceTime: 5
47
+ };
48
+
49
+ // src/component.tsx
50
+ var MinimapRender = (props) => {
51
+ const {
52
+ service,
53
+ panelStyles = {},
54
+ containerStyles = {},
55
+ inactiveStyle: customInactiveStyle = {}
56
+ } = props;
57
+ const inactiveStyle = {
58
+ ...MinimapDefaultInactiveStyle,
59
+ ...customInactiveStyle
60
+ };
61
+ const panelRef = useRef(null);
62
+ const [activated, setActivated] = useState(false);
63
+ useEffect(() => {
64
+ const canvasContainer = panelRef.current;
65
+ if (canvasContainer && service.canvas) {
66
+ canvasContainer.appendChild(service.canvas);
67
+ }
68
+ const disposer = service.onActive((activate) => {
69
+ setActivated(activate);
70
+ });
71
+ return () => {
72
+ disposer.dispose();
73
+ };
74
+ }, []);
75
+ const scale = activated ? 1 : inactiveStyle.scale;
76
+ const opacity = activated ? 1 : inactiveStyle.opacity;
77
+ const translateX = activated ? 0 : inactiveStyle.translateX;
78
+ const translateY = activated ? 0 : inactiveStyle.translateY;
79
+ return /* @__PURE__ */ React.createElement(
80
+ "div",
81
+ {
82
+ className: "minimap-container",
83
+ style: {
84
+ position: "fixed",
85
+ right: 30,
86
+ bottom: 70,
87
+ transition: "all 0.3s ease",
88
+ // 添加过渡效果
89
+ transform: `scale(${scale}) translate(${translateX}px, ${translateY}px)`,
90
+ opacity,
91
+ transformOrigin: "bottom right",
92
+ // 设置变换的原点
93
+ ...containerStyles
94
+ }
95
+ },
96
+ /* @__PURE__ */ React.createElement(
97
+ "div",
98
+ {
99
+ className: "minimap-panel",
100
+ style: {
101
+ display: "flex",
102
+ width: "100%",
103
+ height: "100%",
104
+ borderRadius: "10px",
105
+ backgroundColor: "rgba(255, 255, 255, 1)",
106
+ border: "0.572px solid rgba(6, 7, 9, 0.10)",
107
+ overflow: "hidden",
108
+ boxShadow: "0px 2.289px 6.867px 0px rgba(0, 0, 0, 0.08), 0px 4.578px 13.733px 0px rgba(0, 0, 0, 0.04)",
109
+ boxSizing: "border-box",
110
+ padding: 8,
111
+ ...panelStyles
112
+ },
113
+ "data-flow-editor-selectable": "false",
114
+ ref: panelRef,
115
+ onMouseEnter: () => {
116
+ service.setActivate(true);
117
+ },
118
+ onMouseLeave: () => {
119
+ service.setActivate(false);
120
+ },
121
+ onTouchStartCapture: () => {
122
+ service.setActivate(true);
123
+ },
124
+ onTouchEndCapture: () => {
125
+ service.setActivate(false);
126
+ }
127
+ }
128
+ )
129
+ );
130
+ };
131
+
132
+ // src/create-plugin.ts
133
+ import { definePluginCreator } from "@flowgram.ai/core";
134
+
135
+ // src/service.ts
136
+ import { debounce } from "lodash";
137
+ import { inject, injectable } from "inversify";
138
+ import { DisposableCollection, Rectangle } from "@flowgram.ai/utils";
139
+ import { FlowNodeTransformData } from "@flowgram.ai/document";
140
+ import { FlowNodeBaseType } from "@flowgram.ai/document";
141
+ import { FlowDocument } from "@flowgram.ai/document";
142
+ import { EntityManager, MouseTouchEvent, PlaygroundConfigEntity } from "@flowgram.ai/core";
143
+
144
+ // src/draw.ts
145
+ var MinimapDraw;
146
+ ((MinimapDraw2) => {
147
+ const isRectValid = (rect) => rect.width > 0 && rect.height > 0;
148
+ MinimapDraw2.clear = (params) => {
149
+ const { canvas, context } = params;
150
+ context.clearRect(0, 0, canvas.width, canvas.height);
151
+ };
152
+ MinimapDraw2.backgroundColor = (params) => {
153
+ const { canvas, context, color } = params;
154
+ context.fillStyle = color;
155
+ context.fillRect(0, 0, canvas.width, canvas.height);
156
+ };
157
+ MinimapDraw2.rectangle = (params) => {
158
+ const { context, rect, color } = params;
159
+ if (!isRectValid(rect)) {
160
+ return;
161
+ }
162
+ context.fillStyle = color;
163
+ context.fillRect(rect.x, rect.y, rect.width, rect.height);
164
+ };
165
+ MinimapDraw2.roundRectangle = (params) => {
166
+ const { context, rect, color, radius, borderColor, borderDashLength, borderWidth = 0 } = params;
167
+ const { x, y, width, height } = rect;
168
+ if (!isRectValid(rect)) {
169
+ return;
170
+ }
171
+ context.beginPath();
172
+ const drawRoundedRectPath = () => {
173
+ context.moveTo(x + radius, y);
174
+ context.lineTo(x + width - radius, y);
175
+ context.quadraticCurveTo(x + width, y, x + width, y + radius);
176
+ context.lineTo(x + width, y + height - radius);
177
+ context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
178
+ context.lineTo(x + radius, y + height);
179
+ context.quadraticCurveTo(x, y + height, x, y + height - radius);
180
+ context.lineTo(x, y + radius);
181
+ context.quadraticCurveTo(x, y, x + radius, y);
182
+ context.closePath();
183
+ };
184
+ drawRoundedRectPath();
185
+ context.fillStyle = color;
186
+ context.fill();
187
+ if (borderColor && borderWidth > 0) {
188
+ context.strokeStyle = borderColor;
189
+ context.lineWidth = borderWidth;
190
+ if (borderDashLength) {
191
+ context.setLineDash([borderDashLength, borderDashLength]);
192
+ } else {
193
+ context.setLineDash([]);
194
+ }
195
+ context.stroke();
196
+ context.setLineDash([]);
197
+ }
198
+ };
199
+ MinimapDraw2.overlay = (params) => {
200
+ const { canvas, context, offset, scale, rect, color } = params;
201
+ if (!isRectValid(rect)) {
202
+ return;
203
+ }
204
+ context.fillStyle = color;
205
+ context.fillRect(0, 0, canvas.width, (rect.y + offset.y) * scale);
206
+ context.fillRect(
207
+ 0,
208
+ (rect.y + rect.height + offset.y) * scale,
209
+ canvas.width,
210
+ canvas.height - (rect.y + rect.height + offset.y) * scale
211
+ );
212
+ context.fillRect(
213
+ 0,
214
+ (rect.y + offset.y) * scale,
215
+ (rect.x + offset.x) * scale,
216
+ rect.height * scale
217
+ );
218
+ context.fillRect(
219
+ (rect.x + rect.width + offset.x) * scale,
220
+ (rect.y + offset.y) * scale,
221
+ canvas.width - (rect.x + rect.width + offset.x) * scale,
222
+ rect.height * scale
223
+ );
224
+ };
225
+ })(MinimapDraw || (MinimapDraw = {}));
226
+
227
+ // src/service.ts
228
+ var FlowMinimapService = class {
229
+ constructor() {
230
+ this.onActive = (callback) => {
231
+ this.onActiveCallbacks.add(callback);
232
+ return {
233
+ dispose: () => {
234
+ this.onActiveCallbacks.delete(callback);
235
+ }
236
+ };
237
+ };
238
+ /**
239
+ * 触发渲染
240
+ */
241
+ this.render = this._render;
242
+ this.handleWheel = (event) => {
243
+ };
244
+ this.handleStartDrag = (event) => {
245
+ MouseTouchEvent.preventDefault(event);
246
+ event.stopPropagation();
247
+ const renderContext = this.createRenderContext();
248
+ const { viewRect, scale, offset } = renderContext;
249
+ const canvasRect = this.canvas.getBoundingClientRect();
250
+ const { clientX, clientY } = MouseTouchEvent.getEventCoord(event);
251
+ const mousePoint = {
252
+ x: clientX - canvasRect.left,
253
+ y: clientY - canvasRect.top
254
+ };
255
+ const viewRectOnCanvas = this.rectOnCanvas({
256
+ rect: viewRect,
257
+ scale,
258
+ offset
259
+ });
260
+ if (!this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {
261
+ return;
262
+ }
263
+ this.isDragging = true;
264
+ this.dragStart = mousePoint;
265
+ document.addEventListener("mousemove", this.handleDragging);
266
+ document.addEventListener("mouseup", this.handleEndDrag);
267
+ document.addEventListener("touchmove", this.handleDragging, { passive: false });
268
+ document.addEventListener("touchend", this.handleEndDrag);
269
+ document.addEventListener("touchcancel", this.handleEndDrag);
270
+ };
271
+ this.handleDragging = (event) => {
272
+ if (!this.isDragging || !this.dragStart) return;
273
+ MouseTouchEvent.preventDefault(event);
274
+ event.stopPropagation();
275
+ const renderContext = this.createRenderContext();
276
+ const { scale } = renderContext;
277
+ const canvasRect = this.canvas.getBoundingClientRect();
278
+ const { clientX, clientY } = MouseTouchEvent.getEventCoord(event);
279
+ const mouseX = clientX - canvasRect.left;
280
+ const mouseY = clientY - canvasRect.top;
281
+ const deltaX = (mouseX - this.dragStart.x) / scale;
282
+ const deltaY = (mouseY - this.dragStart.y) / scale;
283
+ this.updateScrollPosition(deltaX, deltaY);
284
+ this.dragStart = { x: mouseX, y: mouseY };
285
+ this.render();
286
+ };
287
+ this.handleEndDrag = (event) => {
288
+ MouseTouchEvent.preventDefault(event);
289
+ event.stopPropagation();
290
+ document.removeEventListener("mousemove", this.handleDragging);
291
+ document.removeEventListener("mouseup", this.handleEndDrag);
292
+ document.removeEventListener("touchmove", this.handleDragging);
293
+ document.removeEventListener("touchend", this.handleEndDrag);
294
+ document.removeEventListener("touchcancel", this.handleEndDrag);
295
+ this.isDragging = false;
296
+ this.dragStart = void 0;
297
+ this.setActivate(this.isMouseInCanvas(event));
298
+ };
299
+ this.handleCursor = (event) => {
300
+ if (!this.activated) return;
301
+ const renderContext = this.createRenderContext();
302
+ const { viewRect, scale, offset } = renderContext;
303
+ const canvasRect = this.canvas.getBoundingClientRect();
304
+ const mousePoint = {
305
+ x: event.clientX - canvasRect.left,
306
+ y: event.clientY - canvasRect.top
307
+ };
308
+ const viewRectOnCanvas = this.rectOnCanvas({
309
+ rect: viewRect,
310
+ scale,
311
+ offset
312
+ });
313
+ if (this.isPointInRect({ point: mousePoint, rect: viewRectOnCanvas })) {
314
+ this.canvas.style.cursor = "grab";
315
+ } else {
316
+ this.canvas.style.cursor = "default";
317
+ }
318
+ };
319
+ this.canvas = document.createElement("canvas");
320
+ this.context2D = this.canvas.getContext("2d");
321
+ this.initialized = !!this.context2D;
322
+ this.onActiveCallbacks = /* @__PURE__ */ new Set();
323
+ this.toDispose = new DisposableCollection();
324
+ this.render = this._render;
325
+ this.activated = false;
326
+ this.isDragging = false;
327
+ }
328
+ init(options) {
329
+ this.options = MinimapDefaultOptions;
330
+ Object.assign(this.options, options);
331
+ this.setDebounce({
332
+ enableDebounce: this.options.enableInactiveDebounce,
333
+ debounceTime: this.options.inactiveDebounceTime
334
+ });
335
+ this.initStyle();
336
+ this.mountListener();
337
+ }
338
+ dispose() {
339
+ this.toDispose.dispose();
340
+ this.initialized = false;
341
+ this.activated = false;
342
+ this.removeEventListeners();
343
+ }
344
+ setActivate(activate) {
345
+ if (activate === this.activated) {
346
+ return;
347
+ }
348
+ if (!activate && this.isDragging) {
349
+ return;
350
+ }
351
+ this.activated = activate;
352
+ if (activate) {
353
+ this.setDebounce({
354
+ enableDebounce: this.options.enableActiveDebounce,
355
+ debounceTime: this.options.activeDebounceTime
356
+ });
357
+ this.addEventListeners();
358
+ } else {
359
+ this.setDebounce({
360
+ enableDebounce: this.options.enableInactiveDebounce,
361
+ debounceTime: this.options.inactiveDebounceTime
362
+ });
363
+ this.removeEventListeners();
364
+ }
365
+ this.render();
366
+ this.onActiveCallbacks.forEach((callback) => callback(activate));
367
+ }
368
+ initStyle() {
369
+ if (!this.initialized) {
370
+ return;
371
+ }
372
+ const { canvasClassName, canvasStyle } = this.options;
373
+ this.canvas.className = canvasClassName;
374
+ this.style = {
375
+ ...MinimapDefaultCanvasStyle,
376
+ ...canvasStyle
377
+ };
378
+ this.canvas.width = this.style.canvasWidth;
379
+ this.canvas.height = this.style.canvasHeight;
380
+ this.canvas.style.borderRadius = this.style.canvasBorderRadius ? `${this.style.canvasBorderRadius}px` : "unset";
381
+ }
382
+ setDebounce(params) {
383
+ const { enableDebounce, debounceTime } = params;
384
+ if (enableDebounce) {
385
+ this.render = debounce(this._render, debounceTime);
386
+ } else {
387
+ this.render = this._render;
388
+ }
389
+ }
390
+ _render() {
391
+ if (!this.initialized) {
392
+ return;
393
+ }
394
+ const renderContext = this.createRenderContext();
395
+ this.renderCanvas(renderContext);
396
+ }
397
+ createRenderContext() {
398
+ const { canvas, context2D, nodes } = this;
399
+ const nodeTransforms = this.nodeTransforms(nodes);
400
+ const nodeRects = nodeTransforms.map((transform) => transform.bounds);
401
+ const viewRect = this.viewRect();
402
+ const renderRect = this.renderRect(nodeRects).withPadding({
403
+ top: this.style.canvasPadding,
404
+ bottom: this.style.canvasPadding,
405
+ left: this.style.canvasPadding,
406
+ right: this.style.canvasPadding
407
+ });
408
+ const canvasRect = Rectangle.enlarge([viewRect, renderRect]);
409
+ const { scale, offset } = this.calculateScaleAndOffset({ canvasRect });
410
+ return {
411
+ canvas,
412
+ context2D,
413
+ nodeRects,
414
+ canvasRect,
415
+ viewRect,
416
+ renderRect,
417
+ scale,
418
+ offset
419
+ };
420
+ }
421
+ renderCanvas(renderContext) {
422
+ const { canvas, context2D, nodeRects, viewRect, scale, offset } = renderContext;
423
+ MinimapDraw.clear({ canvas, context: context2D });
424
+ MinimapDraw.backgroundColor({
425
+ canvas,
426
+ context: context2D,
427
+ color: this.style.canvasBackground
428
+ });
429
+ MinimapDraw.roundRectangle({
430
+ context: context2D,
431
+ rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),
432
+ color: this.style.viewportBackground,
433
+ radius: this.style.viewportBorderRadius
434
+ });
435
+ nodeRects.forEach((nodeRect) => {
436
+ MinimapDraw.roundRectangle({
437
+ context: context2D,
438
+ rect: this.rectOnCanvas({ rect: nodeRect, scale, offset }),
439
+ color: this.style.nodeColor,
440
+ radius: this.style.nodeBorderRadius,
441
+ borderWidth: this.style.nodeBorderWidth,
442
+ borderColor: this.style.nodeBorderColor
443
+ });
444
+ });
445
+ MinimapDraw.roundRectangle({
446
+ context: context2D,
447
+ rect: this.rectOnCanvas({ rect: viewRect, scale, offset }),
448
+ color: "rgba(255, 255, 255, 0)",
449
+ radius: this.style.viewportBorderRadius,
450
+ borderColor: this.style.viewportBorderColor,
451
+ borderWidth: this.style.viewportBorderWidth,
452
+ borderDashLength: this.style.viewportBorderDashLength
453
+ });
454
+ MinimapDraw.overlay({
455
+ canvas,
456
+ context: context2D,
457
+ offset,
458
+ scale,
459
+ rect: viewRect,
460
+ color: this.style.overlayColor
461
+ });
462
+ }
463
+ calculateScaleAndOffset(params) {
464
+ const { canvasRect } = params;
465
+ const { width: canvasWidth, height: canvasHeight } = this.canvas;
466
+ const scaleX = canvasWidth / canvasRect.width;
467
+ const scaleY = canvasHeight / canvasRect.height;
468
+ const scale = Math.min(scaleX, scaleY);
469
+ const scaledWidth = canvasRect.width * scale;
470
+ const scaledHeight = canvasRect.height * scale;
471
+ const centerOffsetX = (canvasWidth - scaledWidth) / 2;
472
+ const centerOffsetY = (canvasHeight - scaledHeight) / 2;
473
+ const offset = {
474
+ x: centerOffsetX / scale - canvasRect.x,
475
+ y: centerOffsetY / scale - canvasRect.y
476
+ };
477
+ return { scale, offset };
478
+ }
479
+ get nodes() {
480
+ return this.document.getAllNodes().filter((node) => {
481
+ if (node.hidden) return false;
482
+ if (node.flowNodeType === FlowNodeBaseType.ROOT) return;
483
+ if (!this.options.enableDisplayAllNodes && node.parent && node.parent.flowNodeType !== FlowNodeBaseType.ROOT)
484
+ return;
485
+ return true;
486
+ });
487
+ }
488
+ nodeTransforms(nodes) {
489
+ return nodes.map((node) => node.getData(FlowNodeTransformData)).filter(Boolean);
490
+ }
491
+ renderRect(rects) {
492
+ return Rectangle.enlarge(rects);
493
+ }
494
+ viewRect() {
495
+ const { width, height, scrollX, scrollY, zoom } = this.playgroundConfig.config;
496
+ return new Rectangle(scrollX / zoom, scrollY / zoom, width / zoom, height / zoom);
497
+ }
498
+ mountListener() {
499
+ const entityManagerDisposer = this.entityManager.onEntityChange(() => this.render());
500
+ this.toDispose.push(entityManagerDisposer);
501
+ }
502
+ /** 计算画布坐标系下的矩形 */
503
+ rectOnCanvas(params) {
504
+ const { rect, scale, offset } = params;
505
+ return new Rectangle(
506
+ (rect.x + offset.x) * scale,
507
+ (rect.y + offset.y) * scale,
508
+ rect.width * scale,
509
+ rect.height * scale
510
+ );
511
+ }
512
+ isPointInRect(params) {
513
+ const { point, rect } = params;
514
+ return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
515
+ }
516
+ addEventListeners() {
517
+ this.canvas.addEventListener("wheel", this.handleWheel);
518
+ this.canvas.addEventListener("mousedown", this.handleStartDrag);
519
+ this.canvas.addEventListener("touchstart", this.handleStartDrag, { passive: false });
520
+ this.canvas.addEventListener("mousemove", this.handleCursor);
521
+ }
522
+ removeEventListeners() {
523
+ this.canvas.removeEventListener("wheel", this.handleWheel);
524
+ this.canvas.removeEventListener("mousedown", this.handleStartDrag);
525
+ this.canvas.removeEventListener("touchstart", this.handleStartDrag);
526
+ this.canvas.removeEventListener("mousemove", this.handleCursor);
527
+ }
528
+ isMouseInCanvas(event) {
529
+ const canvasRect = this.canvas.getBoundingClientRect();
530
+ const { clientX, clientY } = MouseTouchEvent.getEventCoord(event);
531
+ return clientX >= canvasRect.left && clientX <= canvasRect.right && clientY >= canvasRect.top && clientY <= canvasRect.bottom;
532
+ }
533
+ updateScrollPosition(deltaX, deltaY) {
534
+ const { scrollX, scrollY, zoom } = this.playgroundConfig.config;
535
+ this.playgroundConfig.updateConfig({
536
+ scrollX: scrollX + deltaX * zoom,
537
+ scrollY: scrollY + deltaY * zoom
538
+ });
539
+ }
540
+ };
541
+ __decorateClass([
542
+ inject(FlowDocument)
543
+ ], FlowMinimapService.prototype, "document", 2);
544
+ __decorateClass([
545
+ inject(EntityManager)
546
+ ], FlowMinimapService.prototype, "entityManager", 2);
547
+ __decorateClass([
548
+ inject(PlaygroundConfigEntity)
549
+ ], FlowMinimapService.prototype, "playgroundConfig", 2);
550
+ FlowMinimapService = __decorateClass([
551
+ injectable()
552
+ ], FlowMinimapService);
553
+
554
+ // src/layer.tsx
555
+ import React2 from "react";
556
+ import { inject as inject2, injectable as injectable2 } from "inversify";
557
+ import { Layer } from "@flowgram.ai/core";
558
+ import { domUtils } from "@flowgram.ai/utils";
559
+ var FlowMinimapLayer = class extends Layer {
560
+ constructor() {
561
+ super();
562
+ this.className = "gedit-minimap-layer gedit-playground-layer";
563
+ this.node = domUtils.createDivWithClass(this.className);
564
+ this.node.style.zIndex = "9999";
565
+ }
566
+ render() {
567
+ if (this.options.disableLayer) {
568
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null);
569
+ }
570
+ return /* @__PURE__ */ React2.createElement(
571
+ MinimapRender,
572
+ {
573
+ service: this.service,
574
+ panelStyles: this.options.panelStyles,
575
+ containerStyles: this.options.containerStyles,
576
+ inactiveStyle: this.options.inactiveStyle
577
+ }
578
+ );
579
+ }
580
+ };
581
+ FlowMinimapLayer.type = "FlowMinimapLayer";
582
+ __decorateClass([
583
+ inject2(FlowMinimapService)
584
+ ], FlowMinimapLayer.prototype, "service", 2);
585
+ FlowMinimapLayer = __decorateClass([
586
+ injectable2()
587
+ ], FlowMinimapLayer);
588
+
589
+ // src/create-plugin.ts
590
+ var createMinimapPlugin = definePluginCreator({
591
+ onBind: ({ bind }) => {
592
+ bind(FlowMinimapService).toSelf().inSingletonScope();
593
+ },
594
+ onInit: (ctx, opts) => {
595
+ ctx.playground.registerLayer(FlowMinimapLayer, opts);
596
+ ctx.get(FlowMinimapService).init(opts);
597
+ },
598
+ onDispose: (ctx) => {
599
+ ctx.get(FlowMinimapService).dispose();
600
+ }
601
+ });
602
+ export {
603
+ FlowMinimapLayer,
604
+ FlowMinimapService,
605
+ MinimapDefaultCanvasStyle,
606
+ MinimapDefaultInactiveStyle,
607
+ MinimapDefaultOptions,
608
+ MinimapRender,
609
+ createMinimapPlugin
610
+ };
611
+ //# sourceMappingURL=index.js.map