@flowgram.ai/minimap-plugin 0.1.1

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