table-minimap 1.0.0 → 1.1.0
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 +22 -0
- package/README.md +55 -21
- package/dist/index.d.ts +62 -6
- package/dist/shadcn.css +75 -15
- package/dist/table-minimap.cjs +1 -1
- package/dist/table-minimap.cjs.map +1 -1
- package/dist/table-minimap.js +249 -151
- package/dist/table-minimap.js.map +1 -1
- package/package.json +7 -6
- package/dist/style.css +0 -1
package/dist/table-minimap.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var z = (
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
var X = Object.defineProperty;
|
|
2
|
+
var z = (v, t, e) => t in v ? X(v, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : v[t] = e;
|
|
3
|
+
var n = (v, t, e) => z(v, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
const H = {
|
|
5
5
|
mode: "columns",
|
|
6
6
|
height: 40,
|
|
7
7
|
position: "bottom",
|
|
8
8
|
fixedWidth: 300,
|
|
9
|
+
fixedPosition: "bottom-right",
|
|
10
|
+
compact: !1,
|
|
9
11
|
draggable: !0,
|
|
10
12
|
showViewport: !0,
|
|
11
13
|
zoomable: !1,
|
|
12
14
|
minZoom: 1,
|
|
13
15
|
maxZoom: 10,
|
|
14
16
|
zoomSpeed: 0.1
|
|
15
|
-
};
|
|
16
|
-
class
|
|
17
|
+
}, T = 24, A = 5, O = 180;
|
|
18
|
+
class F {
|
|
17
19
|
/**
|
|
18
20
|
* Creates a new TableMinimap instance
|
|
19
21
|
*
|
|
@@ -23,25 +25,33 @@ class A {
|
|
|
23
25
|
*/
|
|
24
26
|
constructor(t, e = {}) {
|
|
25
27
|
/** The target table element */
|
|
26
|
-
|
|
28
|
+
n(this, "table");
|
|
27
29
|
/** Configuration options */
|
|
28
|
-
|
|
30
|
+
n(this, "options");
|
|
31
|
+
/** Whether compact fixed-overlay behavior is enabled */
|
|
32
|
+
n(this, "isCompactMode");
|
|
33
|
+
/** Whether the compact minimap is currently collapsed */
|
|
34
|
+
n(this, "isCompactCollapsed", !1);
|
|
35
|
+
/** Whether the compact minimap is currently expanding (transition in progress) */
|
|
36
|
+
n(this, "isCompactExpanding", !1);
|
|
37
|
+
/** Timeout used to collapse compact mode after pointer leave */
|
|
38
|
+
n(this, "compactCollapseTimer", null);
|
|
29
39
|
/** The scrollable container (parent of table) */
|
|
30
|
-
|
|
40
|
+
n(this, "scrollContainer", null);
|
|
31
41
|
/** Main minimap container element */
|
|
32
|
-
|
|
42
|
+
n(this, "minimapEl", null);
|
|
33
43
|
/** Columns container for columns mode */
|
|
34
|
-
|
|
44
|
+
n(this, "columnsEl", null);
|
|
35
45
|
/** Canvas element for canvas mode */
|
|
36
|
-
|
|
46
|
+
n(this, "canvasEl", null);
|
|
37
47
|
/** Canvas 2D rendering context */
|
|
38
|
-
|
|
48
|
+
n(this, "canvasCtx", null);
|
|
39
49
|
/** Viewport indicator element */
|
|
40
|
-
|
|
50
|
+
n(this, "viewportEl", null);
|
|
41
51
|
/** Detected column information */
|
|
42
|
-
|
|
52
|
+
n(this, "columns", []);
|
|
43
53
|
/** Current scroll state */
|
|
44
|
-
|
|
54
|
+
n(this, "scrollState", {
|
|
45
55
|
scrollLeft: 0,
|
|
46
56
|
scrollWidth: 0,
|
|
47
57
|
clientWidth: 0,
|
|
@@ -49,41 +59,39 @@ class A {
|
|
|
49
59
|
positionRatio: 0
|
|
50
60
|
});
|
|
51
61
|
/** Current zoom state */
|
|
52
|
-
|
|
62
|
+
n(this, "zoomState", {
|
|
53
63
|
level: 1,
|
|
54
64
|
panX: 0,
|
|
55
65
|
isMinZoom: !0,
|
|
56
66
|
isMaxZoom: !1
|
|
57
67
|
});
|
|
58
68
|
/** Is the viewport being dragged */
|
|
59
|
-
|
|
69
|
+
n(this, "isDragging", !1);
|
|
60
70
|
/** Is the canvas being panned (when zoomed) */
|
|
61
|
-
|
|
71
|
+
n(this, "isPanning", !1);
|
|
62
72
|
/** Was just panning (to prevent click after pan) */
|
|
63
|
-
|
|
73
|
+
n(this, "wasPanning", !1);
|
|
64
74
|
/** Pan start position */
|
|
65
|
-
|
|
75
|
+
n(this, "panStartX", 0);
|
|
66
76
|
/** Currently hovered column index (-1 = none) */
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
/** Drag start position */
|
|
71
|
-
o(this, "dragStartX", 0);
|
|
77
|
+
n(this, "hoveredColumn", -1);
|
|
78
|
+
/** Drag start X position */
|
|
79
|
+
n(this, "dragStartX", 0);
|
|
72
80
|
/** Drag start scroll position */
|
|
73
|
-
|
|
81
|
+
n(this, "dragStartScrollLeft", 0);
|
|
74
82
|
/** ResizeObserver instance */
|
|
75
|
-
|
|
83
|
+
n(this, "resizeObserver", null);
|
|
76
84
|
/** MutationObserver instance */
|
|
77
|
-
|
|
85
|
+
n(this, "mutationObserver", null);
|
|
78
86
|
/** Bound event handlers for cleanup */
|
|
79
|
-
|
|
87
|
+
n(this, "boundHandlers");
|
|
80
88
|
/** Animation frame ID for throttling */
|
|
81
|
-
|
|
89
|
+
n(this, "rafId", null);
|
|
82
90
|
/** Whether the instance has been destroyed */
|
|
83
|
-
|
|
91
|
+
n(this, "isDestroyed", !1);
|
|
84
92
|
/** Whether we started a potential pan (waiting to see if it's a click or drag) */
|
|
85
|
-
|
|
86
|
-
this.table = this.resolveTable(t), this.options = { ...
|
|
93
|
+
n(this, "isPotentialPan", !1);
|
|
94
|
+
this.table = this.resolveTable(t), this.options = { ...H, ...e }, this.isCompactMode = this.options.compact && this.options.position === "fixed", this.boundHandlers = {
|
|
87
95
|
onScroll: this.onScroll.bind(this),
|
|
88
96
|
onPointerDown: this.onPointerDown.bind(this),
|
|
89
97
|
onPointerMove: this.onPointerMove.bind(this),
|
|
@@ -92,7 +100,11 @@ class A {
|
|
|
92
100
|
onWheel: this.onWheel.bind(this),
|
|
93
101
|
onCanvasPointerDown: this.onCanvasPointerDown.bind(this),
|
|
94
102
|
onCanvasMouseMove: this.onCanvasMouseMove.bind(this),
|
|
95
|
-
onCanvasMouseLeave: this.onCanvasMouseLeave.bind(this)
|
|
103
|
+
onCanvasMouseLeave: this.onCanvasMouseLeave.bind(this),
|
|
104
|
+
onCompactFocusIn: this.onCompactFocusIn.bind(this),
|
|
105
|
+
onCompactFocusOut: this.onCompactFocusOut.bind(this),
|
|
106
|
+
onCompactKeyDown: this.onCompactKeyDown.bind(this),
|
|
107
|
+
onDocumentClick: this.onDocumentClick.bind(this)
|
|
96
108
|
}, this.init();
|
|
97
109
|
}
|
|
98
110
|
/**
|
|
@@ -135,8 +147,8 @@ class A {
|
|
|
135
147
|
findScrollContainer() {
|
|
136
148
|
let t = this.table.parentElement;
|
|
137
149
|
for (; t; ) {
|
|
138
|
-
const e = getComputedStyle(t), i = e.overflowX,
|
|
139
|
-
if (i === "auto" || i === "scroll" ||
|
|
150
|
+
const e = getComputedStyle(t), i = e.overflowX, o = e.overflow;
|
|
151
|
+
if (i === "auto" || i === "scroll" || o === "auto" || o === "scroll" || t.scrollWidth > t.clientWidth)
|
|
140
152
|
return t;
|
|
141
153
|
t = t.parentElement;
|
|
142
154
|
}
|
|
@@ -154,14 +166,14 @@ class A {
|
|
|
154
166
|
if (t.length > 0)
|
|
155
167
|
e = t;
|
|
156
168
|
else {
|
|
157
|
-
const
|
|
158
|
-
|
|
169
|
+
const o = this.table.querySelector("tr");
|
|
170
|
+
o ? e = o.querySelectorAll("th, td") : e = [];
|
|
159
171
|
}
|
|
160
172
|
const i = this.table.offsetWidth || 1;
|
|
161
|
-
Array.from(e).forEach((
|
|
162
|
-
const a =
|
|
173
|
+
Array.from(e).forEach((o) => {
|
|
174
|
+
const a = o.colSpan || 1, s = o.offsetWidth;
|
|
163
175
|
for (let l = 0; l < a; l++) {
|
|
164
|
-
const r =
|
|
176
|
+
const r = s / a;
|
|
165
177
|
this.columns.push({
|
|
166
178
|
index: this.columns.length,
|
|
167
179
|
width: r,
|
|
@@ -178,15 +190,15 @@ class A {
|
|
|
178
190
|
* Creates the minimap DOM element
|
|
179
191
|
*/
|
|
180
192
|
createMinimapElement() {
|
|
181
|
-
this.minimapEl = document.createElement("div"), this.minimapEl.className = `tm-minimap tm-minimap--${this.options.position}`, this.minimapEl.style.height
|
|
193
|
+
this.minimapEl = document.createElement("div"), this.minimapEl.className = `tm-minimap tm-minimap--${this.options.position}`, this.minimapEl.style.setProperty("--tm-minimap-height", `${this.options.height}px`), this.options.position === "fixed" && (this.minimapEl.style.setProperty("--tm-minimap-width", `${this.options.fixedWidth}px`), this.minimapEl.classList.add(`tm-minimap--${this.options.fixedPosition}`)), this.isCompactMode ? (this.minimapEl.classList.add("tm-minimap--compact", "tm-minimap--compact-collapsed"), this.minimapEl.style.setProperty("--tm-compact-dot-size", `${A}px`), this.isCompactCollapsed = !0, this.applyCompactDimensions(!0), this.minimapEl.setAttribute("aria-expanded", "false")) : this.minimapEl.setAttribute("aria-expanded", "true"), this.minimapEl.setAttribute("role", "slider"), this.minimapEl.setAttribute("aria-label", "Table minimap navigation"), this.minimapEl.setAttribute("aria-valuemin", "0"), this.minimapEl.setAttribute("aria-valuemax", "100"), this.minimapEl.setAttribute("tabindex", "0"), this.options.mode === "canvas" ? this.createCanvasContent() : this.createColumnsContent(), this.options.showViewport && this.createViewportIndicator(), this.insertMinimap();
|
|
182
194
|
}
|
|
183
195
|
/**
|
|
184
196
|
* Creates columns-mode content
|
|
185
197
|
*/
|
|
186
198
|
createColumnsContent() {
|
|
187
|
-
this.minimapEl && (this.columnsEl = document.createElement("div"), this.columnsEl.className = "tm-columns", this.columns.forEach((
|
|
188
|
-
const
|
|
189
|
-
|
|
199
|
+
this.minimapEl && (this.columnsEl = document.createElement("div"), this.columnsEl.className = "tm-columns", this.columns.forEach(() => {
|
|
200
|
+
const t = document.createElement("div");
|
|
201
|
+
t.className = "tm-column", this.columnsEl.appendChild(t);
|
|
190
202
|
}), this.minimapEl.appendChild(this.columnsEl));
|
|
191
203
|
}
|
|
192
204
|
/**
|
|
@@ -211,7 +223,9 @@ class A {
|
|
|
211
223
|
if (t) {
|
|
212
224
|
getComputedStyle(t).position === "static" && (t.style.position = "relative");
|
|
213
225
|
const i = this.scrollContainer.nextSibling;
|
|
214
|
-
i ? t.insertBefore(this.minimapEl, i) : t.appendChild(this.minimapEl), this.minimapEl.style.position = "absolute"
|
|
226
|
+
i ? t.insertBefore(this.minimapEl, i) : t.appendChild(this.minimapEl), this.minimapEl.style.position = "absolute";
|
|
227
|
+
const o = this.isCompactMode ? 8 : 12, a = this.options.fixedPosition;
|
|
228
|
+
this.minimapEl.style.top = "", this.minimapEl.style.bottom = "", this.minimapEl.style.left = "", this.minimapEl.style.right = "", this.minimapEl.style.marginTop = "0", a === "top-left" ? (this.minimapEl.style.top = `${o}px`, this.minimapEl.style.left = `${o}px`) : a === "top-right" ? (this.minimapEl.style.top = `${o}px`, this.minimapEl.style.right = `${o}px`) : a === "bottom-left" ? (this.minimapEl.style.bottom = `${o}px`, this.minimapEl.style.left = `${o}px`) : (this.minimapEl.style.bottom = `${o}px`, this.minimapEl.style.right = `${o}px`);
|
|
215
229
|
}
|
|
216
230
|
} else if (this.options.position === "top")
|
|
217
231
|
t ? t.insertBefore(this.minimapEl, this.scrollContainer) : this.scrollContainer.insertBefore(this.minimapEl, this.scrollContainer.firstChild);
|
|
@@ -242,59 +256,55 @@ class A {
|
|
|
242
256
|
* Renders the minimap
|
|
243
257
|
*/
|
|
244
258
|
render() {
|
|
245
|
-
this.isDestroyed || (this.updateViewport(), this.options.mode === "canvas" && this.renderCanvas());
|
|
259
|
+
this.isDestroyed || this.isCompactMode && this.isCompactCollapsed || (this.updateViewport(), this.options.mode === "canvas" && this.renderCanvas());
|
|
246
260
|
}
|
|
247
261
|
/**
|
|
248
262
|
* Canvas metrics for calculations - cached values to avoid repeated computations
|
|
249
263
|
*/
|
|
250
264
|
getCanvasMetrics() {
|
|
251
|
-
var
|
|
252
|
-
const t = ((
|
|
265
|
+
var p;
|
|
266
|
+
const t = ((p = this.minimapEl) == null ? void 0 : p.offsetWidth) ?? 0, e = this.zoomState.level, i = this.columns.length, o = 1 / e, a = i * o, s = a > 0 ? t / a : 0;
|
|
253
267
|
let l = 0;
|
|
254
268
|
if (e > 1 && this.scrollContainer) {
|
|
255
|
-
const { scrollLeft:
|
|
256
|
-
l =
|
|
269
|
+
const { scrollLeft: m, scrollWidth: E, clientWidth: g } = this.scrollContainer, u = Math.max(E - g, 1);
|
|
270
|
+
l = m / u * (1 - o);
|
|
257
271
|
}
|
|
258
|
-
const r = l * i,
|
|
272
|
+
const r = l * i, c = Math.floor(r), h = Math.min(Math.ceil(r + a) + 1, i), f = -(r - c) * s;
|
|
259
273
|
return {
|
|
260
274
|
width: t,
|
|
261
275
|
zoom: e,
|
|
262
276
|
numCols: i,
|
|
263
|
-
visibleRatio:
|
|
277
|
+
visibleRatio: o,
|
|
264
278
|
visibleCols: a,
|
|
265
|
-
cellWidth:
|
|
279
|
+
cellWidth: s,
|
|
266
280
|
panX: l,
|
|
267
281
|
startColFloat: r,
|
|
268
|
-
startCol:
|
|
269
|
-
endCol:
|
|
270
|
-
xOffset:
|
|
282
|
+
startCol: c,
|
|
283
|
+
endCol: h,
|
|
284
|
+
xOffset: f
|
|
271
285
|
};
|
|
272
286
|
}
|
|
273
287
|
/**
|
|
274
288
|
* Calculates column index from mouse X position
|
|
275
289
|
*/
|
|
276
290
|
getColumnAtX(t) {
|
|
277
|
-
const { width: e, numCols: i, panX:
|
|
291
|
+
const { width: e, numCols: i, panX: o, visibleRatio: a } = this.getCanvasMetrics();
|
|
278
292
|
if (i === 0 || e === 0) return -1;
|
|
279
|
-
const
|
|
293
|
+
const s = t / e, l = o + s * a, r = Math.floor(l * i);
|
|
280
294
|
return Math.max(0, Math.min(i - 1, r));
|
|
281
295
|
}
|
|
282
296
|
/**
|
|
283
297
|
* Updates the viewport indicator position and size
|
|
284
|
-
*
|
|
298
|
+
* Shows the visible portion of the table (columns mode only)
|
|
285
299
|
*/
|
|
286
300
|
updateViewport() {
|
|
287
301
|
if (!this.viewportEl || !this.minimapEl) return;
|
|
288
302
|
if (this.options.mode === "canvas") {
|
|
289
|
-
|
|
290
|
-
const { cellWidth: a, startColFloat: n } = this.getCanvasMetrics(), l = (this.focusedColumn - n) * a;
|
|
291
|
-
this.viewportEl.style.cssText = `width:${a}px;left:${l}px;display:block`;
|
|
292
|
-
} else
|
|
293
|
-
this.viewportEl.style.display = "none";
|
|
303
|
+
this.viewportEl.style.display = "none";
|
|
294
304
|
return;
|
|
295
305
|
}
|
|
296
|
-
const t = this.minimapEl.offsetWidth, e = Math.max(t * this.scrollState.viewportRatio, 20),
|
|
297
|
-
this.viewportEl.style.cssText = `width:${e}px;left:${
|
|
306
|
+
const t = this.minimapEl.offsetWidth, e = Math.max(t * this.scrollState.viewportRatio, 20), o = (t - e) * this.scrollState.positionRatio;
|
|
307
|
+
this.viewportEl.style.cssText = `width:${e}px;left:${o}px;display:block`;
|
|
298
308
|
}
|
|
299
309
|
/**
|
|
300
310
|
* Renders the canvas-mode visualization with table preview
|
|
@@ -308,11 +318,11 @@ class A {
|
|
|
308
318
|
* Renders the visible portion of the table directly onto the canvas
|
|
309
319
|
*/
|
|
310
320
|
renderTableDirect(t, e) {
|
|
311
|
-
var
|
|
321
|
+
var S, y, P, D;
|
|
312
322
|
if (!this.canvasCtx) return;
|
|
313
|
-
const i = this.canvasCtx, { width:
|
|
314
|
-
if (
|
|
315
|
-
const
|
|
323
|
+
const i = this.canvasCtx, { width: o, numCols: a, cellWidth: s, startCol: l, endCol: r, xOffset: c } = t, h = Array.from(this.table.querySelectorAll("tr")), f = h.length;
|
|
324
|
+
if (f === 0 || a === 0) return;
|
|
325
|
+
const p = Math.min(e * 0.15, 30), m = (e - p) / f, E = Math.min(m * 0.6, s * 0.15, 14), g = Math.min(p * 0.6, s * 0.15, 14), u = {
|
|
316
326
|
bg: "#ffffff",
|
|
317
327
|
headerBg: "#f1f5f9",
|
|
318
328
|
border: "#e2e8f0",
|
|
@@ -322,35 +332,35 @@ class A {
|
|
|
322
332
|
hoverFill: "rgba(59, 130, 246, 0.08)",
|
|
323
333
|
hoverStroke: "rgba(59, 130, 246, 0.3)"
|
|
324
334
|
};
|
|
325
|
-
i.fillStyle =
|
|
326
|
-
const
|
|
327
|
-
i.font = `bold ${
|
|
328
|
-
for (let
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
i.strokeStyle =
|
|
332
|
-
const
|
|
333
|
-
i.fillStyle =
|
|
335
|
+
i.fillStyle = u.bg, i.fillRect(0, 0, o, e), i.fillStyle = u.headerBg, i.fillRect(0, 0, o, p);
|
|
336
|
+
const x = this.table.querySelector("thead tr") || h[0], L = x ? Array.from(x.querySelectorAll("th, td")) : [];
|
|
337
|
+
i.font = `bold ${g}px system-ui, sans-serif`, i.textBaseline = "middle";
|
|
338
|
+
for (let d = l; d < r; d++) {
|
|
339
|
+
const C = c + (d - l) * s;
|
|
340
|
+
if (C + s < 0 || C > o) continue;
|
|
341
|
+
i.strokeStyle = u.border, i.lineWidth = 1, i.strokeRect(C, 0, s, p);
|
|
342
|
+
const b = ((y = (S = L[d]) == null ? void 0 : S.textContent) == null ? void 0 : y.trim()) || `Col ${d + 1}`;
|
|
343
|
+
i.fillStyle = u.headerText, i.save(), i.beginPath(), i.rect(C + 2, 0, s - 4, p), i.clip(), i.fillText(b, C + 4, p / 2), i.restore();
|
|
334
344
|
}
|
|
335
|
-
i.font = `${
|
|
336
|
-
for (let
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
const
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
const
|
|
345
|
+
i.font = `${E}px system-ui, sans-serif`;
|
|
346
|
+
for (let d = 0; d < h.length; d++) {
|
|
347
|
+
const C = h[d];
|
|
348
|
+
if (C.closest("thead")) continue;
|
|
349
|
+
const b = p + d * m;
|
|
350
|
+
if (b + m < 0 || b > e) continue;
|
|
351
|
+
d % 2 === 1 && (i.fillStyle = u.altRow, i.fillRect(0, b, o, m));
|
|
352
|
+
const R = Array.from(C.querySelectorAll("th, td"));
|
|
343
353
|
for (let M = l; M < r; M++) {
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
i.strokeStyle =
|
|
347
|
-
const
|
|
348
|
-
|
|
354
|
+
const w = c + (M - l) * s;
|
|
355
|
+
if (w + s < 0 || w > o) continue;
|
|
356
|
+
i.strokeStyle = u.border, i.lineWidth = 0.5, i.strokeRect(w, b, s, m);
|
|
357
|
+
const k = (D = (P = R[M]) == null ? void 0 : P.textContent) == null ? void 0 : D.trim();
|
|
358
|
+
k && (i.fillStyle = u.text, i.save(), i.beginPath(), i.rect(w + 2, b, s - 4, m), i.clip(), i.fillText(k, w + 4, b + m / 2), i.restore());
|
|
349
359
|
}
|
|
350
360
|
}
|
|
351
361
|
if (this.hoveredColumn >= l && this.hoveredColumn < r) {
|
|
352
|
-
const
|
|
353
|
-
i.fillStyle =
|
|
362
|
+
const d = c + (this.hoveredColumn - l) * s;
|
|
363
|
+
i.fillStyle = u.hoverFill, i.fillRect(d, 0, s, e), i.strokeStyle = u.hoverStroke, i.lineWidth = 1, i.strokeRect(d, 0, s, e);
|
|
354
364
|
}
|
|
355
365
|
}
|
|
356
366
|
/**
|
|
@@ -359,7 +369,7 @@ class A {
|
|
|
359
369
|
attachEventListeners() {
|
|
360
370
|
!this.scrollContainer || !this.minimapEl || (this.scrollContainer.addEventListener("scroll", this.boundHandlers.onScroll, {
|
|
361
371
|
passive: !0
|
|
362
|
-
}), this.minimapEl.addEventListener("click", this.boundHandlers.onMinimapClick), this.options.draggable && this.viewportEl && this.viewportEl.addEventListener("pointerdown", this.boundHandlers.onPointerDown), this.options.zoomable && this.options.mode === "canvas" && this.canvasEl && (this.canvasEl.addEventListener("wheel", this.boundHandlers.onWheel, { passive: !1 }), this.canvasEl.addEventListener("pointerdown", this.boundHandlers.onCanvasPointerDown), this.canvasEl.style.cursor = this.zoomState.level > 1 ? "grab" : "pointer", this.viewportEl && this.viewportEl.addEventListener("wheel", this.boundHandlers.onWheel, { passive: !1 })), this.options.mode === "canvas" && this.canvasEl && (this.canvasEl.addEventListener("mousemove", this.boundHandlers.onCanvasMouseMove), this.canvasEl.addEventListener("mouseleave", this.boundHandlers.onCanvasMouseLeave)), document.addEventListener("pointermove", this.boundHandlers.onPointerMove), document.addEventListener("pointerup", this.boundHandlers.onPointerUp));
|
|
372
|
+
}), this.minimapEl.addEventListener("click", this.boundHandlers.onMinimapClick), this.isCompactMode && (this.minimapEl.addEventListener("focusin", this.boundHandlers.onCompactFocusIn), this.minimapEl.addEventListener("focusout", this.boundHandlers.onCompactFocusOut), this.minimapEl.addEventListener("keydown", this.boundHandlers.onCompactKeyDown), document.addEventListener("click", this.boundHandlers.onDocumentClick)), this.options.draggable && this.viewportEl && this.viewportEl.addEventListener("pointerdown", this.boundHandlers.onPointerDown), this.options.zoomable && this.options.mode === "canvas" && this.canvasEl && (this.canvasEl.addEventListener("wheel", this.boundHandlers.onWheel, { passive: !1 }), this.canvasEl.addEventListener("pointerdown", this.boundHandlers.onCanvasPointerDown), this.canvasEl.style.cursor = this.zoomState.level > 1 ? "grab" : "pointer", this.viewportEl && this.viewportEl.addEventListener("wheel", this.boundHandlers.onWheel, { passive: !1 })), this.options.mode === "canvas" && this.canvasEl && (this.canvasEl.addEventListener("mousemove", this.boundHandlers.onCanvasMouseMove), this.canvasEl.addEventListener("mouseleave", this.boundHandlers.onCanvasMouseLeave)), document.addEventListener("pointermove", this.boundHandlers.onPointerMove), document.addEventListener("pointerup", this.boundHandlers.onPointerUp));
|
|
363
373
|
}
|
|
364
374
|
/**
|
|
365
375
|
* Handles scroll events on the container
|
|
@@ -375,27 +385,27 @@ class A {
|
|
|
375
385
|
* @param e - Mouse event
|
|
376
386
|
*/
|
|
377
387
|
onMinimapClick(t) {
|
|
378
|
-
if (!this.minimapEl || !this.scrollContainer
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
this.focusedColumn = this.hoveredColumn;
|
|
382
|
-
const b = e / s, h = (this.hoveredColumn + 0.5) * b - i / 2, g = e - i, x = Math.max(0, Math.min(g, h));
|
|
383
|
-
this.scrollContainer.scrollTo({
|
|
384
|
-
left: x,
|
|
385
|
-
behavior: "smooth"
|
|
386
|
-
}), this.updateViewport();
|
|
388
|
+
if (!this.minimapEl || !this.scrollContainer) return;
|
|
389
|
+
if (this.isCompactMode && this.isCompactCollapsed) {
|
|
390
|
+
t.preventDefault(), this.expandCompact();
|
|
387
391
|
return;
|
|
388
392
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
393
|
+
if (this.isCompactExpanding || this.isDragging || this.isPanning || this.wasPanning) return;
|
|
394
|
+
const { scrollWidth: e, clientWidth: i } = this.scrollContainer, o = e - i, a = this.minimapEl.getBoundingClientRect(), s = t.clientX - a.left;
|
|
395
|
+
if (this.options.mode === "canvas") {
|
|
396
|
+
const c = this.getColumnAtX(s);
|
|
397
|
+
if (c >= 0) {
|
|
398
|
+
const h = this.columns.length, f = e / h, m = (c + 0.5) * f - i / 2;
|
|
399
|
+
this.scrollContainer.scrollTo({
|
|
400
|
+
left: Math.max(0, Math.min(o, m)),
|
|
401
|
+
behavior: "smooth"
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const r = s / a.width * o;
|
|
397
407
|
this.scrollContainer.scrollTo({
|
|
398
|
-
left:
|
|
408
|
+
left: Math.max(0, Math.min(o, r)),
|
|
399
409
|
behavior: "smooth"
|
|
400
410
|
});
|
|
401
411
|
}
|
|
@@ -415,17 +425,14 @@ class A {
|
|
|
415
425
|
onPointerMove(t) {
|
|
416
426
|
if (this.isPotentialPan && !this.isPanning && this.canvasEl && this.zoomState.level > 1 && Math.abs(t.clientX - this.panStartX) > 3 && (this.isPanning = !0, this.canvasEl.style.cursor = "grabbing"), this.isPanning && this.canvasEl && this.minimapEl && this.scrollContainer) {
|
|
417
427
|
t.preventDefault();
|
|
418
|
-
const
|
|
419
|
-
this.scrollContainer.scrollLeft = Math.max(0, Math.min(
|
|
428
|
+
const c = t.clientX - this.panStartX, h = this.minimapEl.offsetWidth, { scrollWidth: f, clientWidth: p } = this.scrollContainer, m = f - p, E = c / h * m * this.zoomState.level, g = this.dragStartScrollLeft + E;
|
|
429
|
+
this.scrollContainer.scrollLeft = Math.max(0, Math.min(m, g)), this.updateScrollState(), this.updateViewport(), this.render();
|
|
420
430
|
return;
|
|
421
431
|
}
|
|
422
432
|
if (!this.isDragging || !this.minimapEl || !this.scrollContainer) return;
|
|
423
433
|
t.preventDefault();
|
|
424
|
-
const e
|
|
425
|
-
this.scrollContainer.scrollLeft = Math.max(
|
|
426
|
-
0,
|
|
427
|
-
Math.min(s, n)
|
|
428
|
-
), this.updateScrollState(), this.updateViewport();
|
|
434
|
+
const { scrollWidth: e, clientWidth: i } = this.scrollContainer, o = this.minimapEl.offsetWidth, a = e - i, l = (t.clientX - this.dragStartX) / o * a, r = this.dragStartScrollLeft + l;
|
|
435
|
+
this.scrollContainer.scrollLeft = Math.max(0, Math.min(a, r)), this.updateScrollState(), this.updateViewport();
|
|
429
436
|
}
|
|
430
437
|
/**
|
|
431
438
|
* Handles pointer up to end drag
|
|
@@ -453,19 +460,26 @@ class A {
|
|
|
453
460
|
* @param e - Wheel event
|
|
454
461
|
*/
|
|
455
462
|
onWheel(t) {
|
|
456
|
-
if (!this.options.zoomable || this.options.mode !== "canvas") return;
|
|
463
|
+
if (!this.options.zoomable || this.options.mode !== "canvas" || !this.canvasEl || !this.scrollContainer || !this.minimapEl) return;
|
|
457
464
|
t.preventDefault();
|
|
458
|
-
const e = -t.deltaY * this.options.zoomSpeed,
|
|
465
|
+
const e = this.zoomState.level, i = -t.deltaY * this.options.zoomSpeed, o = Math.max(
|
|
459
466
|
this.options.minZoom,
|
|
460
|
-
Math.min(this.options.maxZoom,
|
|
467
|
+
Math.min(this.options.maxZoom, e + i)
|
|
461
468
|
);
|
|
469
|
+
if (o === e) return;
|
|
470
|
+
const a = this.canvasEl.getBoundingClientRect(), s = t.clientX - a.left, l = this.minimapEl.offsetWidth, r = s / l, c = 1 / e, { scrollLeft: h, scrollWidth: f, clientWidth: p } = this.scrollContainer, m = Math.max(f - p, 1), E = h / m, u = (e > 1 ? E * (1 - c) : 0) + r * c;
|
|
462
471
|
this.zoomState = {
|
|
463
|
-
level:
|
|
472
|
+
level: o,
|
|
464
473
|
panX: 0,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
474
|
+
isMinZoom: o <= this.options.minZoom,
|
|
475
|
+
isMaxZoom: o >= this.options.maxZoom
|
|
476
|
+
};
|
|
477
|
+
const x = 1 / o;
|
|
478
|
+
if (o > 1) {
|
|
479
|
+
const S = (u - r * x) / (1 - x), y = Math.max(0, Math.min(m, S * m));
|
|
480
|
+
this.scrollContainer.scrollLeft = y;
|
|
481
|
+
}
|
|
482
|
+
this.updateScrollState(), this.render();
|
|
469
483
|
}
|
|
470
484
|
/**
|
|
471
485
|
* Handles pointer down on canvas for drag start (scrolls table when zoomed)
|
|
@@ -489,6 +503,76 @@ class A {
|
|
|
489
503
|
onCanvasMouseLeave() {
|
|
490
504
|
this.hoveredColumn !== -1 && (this.hoveredColumn = -1, this.canvasEl && (this.canvasEl.style.cursor = this.zoomState.level > 1 ? "grab" : "default"), this.render());
|
|
491
505
|
}
|
|
506
|
+
/**
|
|
507
|
+
* Expands the compact minimap and clears any pending collapse.
|
|
508
|
+
*/
|
|
509
|
+
expandCompact() {
|
|
510
|
+
!this.isCompactMode || !this.minimapEl || this.isCompactExpanding || (this.clearCompactCollapseTimer(), this.isCompactExpanding = !0, this.applyCompactDimensions(!1), setTimeout(() => {
|
|
511
|
+
this.isCompactExpanding = !1, !this.isDestroyed && !this.isCompactCollapsed && (this.updateScrollState(), this.render());
|
|
512
|
+
}, 200));
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Collapses the compact minimap to the small dot handle.
|
|
516
|
+
*/
|
|
517
|
+
collapseCompact() {
|
|
518
|
+
!this.isCompactMode || !this.minimapEl || this.applyCompactDimensions(!0);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Applies compact sizing/state to the minimap.
|
|
522
|
+
*/
|
|
523
|
+
applyCompactDimensions(t) {
|
|
524
|
+
if (!(!this.minimapEl || !this.isCompactMode)) {
|
|
525
|
+
if (this.isCompactCollapsed = t, t) {
|
|
526
|
+
this.minimapEl.classList.add("tm-minimap--compact-collapsed"), this.minimapEl.classList.remove("tm-minimap--compact-expanded"), this.minimapEl.style.setProperty("--tm-minimap-width", `${T}px`), this.minimapEl.style.setProperty("--tm-minimap-height", `${T}px`), this.minimapEl.setAttribute("aria-expanded", "false");
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
this.minimapEl.classList.remove("tm-minimap--compact-collapsed"), this.minimapEl.classList.add("tm-minimap--compact-expanded"), this.minimapEl.style.setProperty("--tm-minimap-width", `${this.options.fixedWidth}px`), this.minimapEl.style.setProperty("--tm-minimap-height", `${this.options.height}px`), this.minimapEl.setAttribute("aria-expanded", "true");
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Clears a pending compact collapse timer.
|
|
534
|
+
*/
|
|
535
|
+
clearCompactCollapseTimer() {
|
|
536
|
+
this.compactCollapseTimer !== null && (clearTimeout(this.compactCollapseTimer), this.compactCollapseTimer = null);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Schedules the compact minimap to collapse.
|
|
540
|
+
*/
|
|
541
|
+
scheduleCompactCollapse(t = O) {
|
|
542
|
+
this.isCompactMode && (this.clearCompactCollapseTimer(), this.compactCollapseTimer = window.setTimeout(() => {
|
|
543
|
+
this.collapseCompact(), this.compactCollapseTimer = null;
|
|
544
|
+
}, t));
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Handles document click for closing compact mode when clicking outside.
|
|
548
|
+
*/
|
|
549
|
+
onDocumentClick(t) {
|
|
550
|
+
!this.isCompactMode || !this.minimapEl || this.isCompactCollapsed || this.minimapEl.contains(t.target) || this.collapseCompact();
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Handles focus entering compact mode.
|
|
554
|
+
*/
|
|
555
|
+
onCompactFocusIn() {
|
|
556
|
+
this.isCompactMode && this.expandCompact();
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Handles focus leaving compact mode.
|
|
560
|
+
*/
|
|
561
|
+
onCompactFocusOut() {
|
|
562
|
+
this.isCompactMode && this.scheduleCompactCollapse(0);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Keyboard interactions for compact mode.
|
|
566
|
+
*/
|
|
567
|
+
onCompactKeyDown(t) {
|
|
568
|
+
if (this.isCompactMode) {
|
|
569
|
+
if (t.key === "Escape") {
|
|
570
|
+
t.preventDefault(), this.collapseCompact();
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.isCompactCollapsed ? this.expandCompact() : this.collapseCompact());
|
|
574
|
+
}
|
|
575
|
+
}
|
|
492
576
|
/**
|
|
493
577
|
* Sets up ResizeObserver and MutationObserver
|
|
494
578
|
*/
|
|
@@ -511,9 +595,9 @@ class A {
|
|
|
511
595
|
*/
|
|
512
596
|
onResize() {
|
|
513
597
|
this.isDestroyed || (this.rafId !== null && cancelAnimationFrame(this.rafId), this.rafId = requestAnimationFrame(() => {
|
|
514
|
-
this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && this.minimapEl && (this.columnsEl.innerHTML = "", this.columns.forEach((
|
|
515
|
-
const
|
|
516
|
-
|
|
598
|
+
this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && this.minimapEl && (this.columnsEl.innerHTML = "", this.columns.forEach(() => {
|
|
599
|
+
const t = document.createElement("div");
|
|
600
|
+
t.className = "tm-column", this.columnsEl.appendChild(t);
|
|
517
601
|
})), this.rafId = null;
|
|
518
602
|
}));
|
|
519
603
|
}
|
|
@@ -521,9 +605,9 @@ class A {
|
|
|
521
605
|
* Handles table mutation events
|
|
522
606
|
*/
|
|
523
607
|
onTableMutation() {
|
|
524
|
-
this.isDestroyed || (this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && (this.columnsEl.innerHTML = "", this.columns.forEach((
|
|
525
|
-
const
|
|
526
|
-
|
|
608
|
+
this.isDestroyed || (this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && (this.columnsEl.innerHTML = "", this.columns.forEach(() => {
|
|
609
|
+
const t = document.createElement("div");
|
|
610
|
+
t.className = "tm-column", this.columnsEl.appendChild(t);
|
|
527
611
|
})));
|
|
528
612
|
}
|
|
529
613
|
/**
|
|
@@ -551,9 +635,9 @@ class A {
|
|
|
551
635
|
scrollToColumn(t, e = !0) {
|
|
552
636
|
if (!this.scrollContainer || t < 0 || t >= this.columns.length)
|
|
553
637
|
return;
|
|
554
|
-
const
|
|
638
|
+
const o = this.columns.slice(0, t).reduce((a, s) => a + s.width, 0);
|
|
555
639
|
this.scrollContainer.scrollTo({
|
|
556
|
-
left:
|
|
640
|
+
left: o,
|
|
557
641
|
behavior: e ? "smooth" : "auto"
|
|
558
642
|
});
|
|
559
643
|
}
|
|
@@ -561,9 +645,9 @@ class A {
|
|
|
561
645
|
* Forces a refresh of the minimap
|
|
562
646
|
*/
|
|
563
647
|
refresh() {
|
|
564
|
-
this.isDestroyed || (this.scrollContainer = this.findScrollContainer(), this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && (this.columnsEl.innerHTML = "", this.columns.forEach((
|
|
565
|
-
const
|
|
566
|
-
|
|
648
|
+
this.isDestroyed || (this.scrollContainer = this.findScrollContainer(), this.detectColumns(), this.updateScrollState(), this.render(), this.options.mode === "columns" && this.columnsEl && (this.columnsEl.innerHTML = "", this.columns.forEach(() => {
|
|
649
|
+
const t = document.createElement("div");
|
|
650
|
+
t.className = "tm-column", this.columnsEl.appendChild(t);
|
|
567
651
|
})));
|
|
568
652
|
}
|
|
569
653
|
/**
|
|
@@ -578,21 +662,26 @@ class A {
|
|
|
578
662
|
* Sets the zoom level programmatically (canvas mode only)
|
|
579
663
|
*
|
|
580
664
|
* @param level - Zoom level (1 = no zoom)
|
|
581
|
-
* @param panX - Optional pan position (0-1)
|
|
665
|
+
* @param panX - Optional pan position (0-1), controls which part of table is visible
|
|
582
666
|
*/
|
|
583
667
|
setZoom(t, e) {
|
|
584
|
-
if (this.isDestroyed || this.options.mode !== "canvas") return;
|
|
668
|
+
if (this.isDestroyed || this.options.mode !== "canvas" || !this.scrollContainer) return;
|
|
585
669
|
const i = Math.max(
|
|
586
670
|
this.options.minZoom,
|
|
587
671
|
Math.min(this.options.maxZoom, t)
|
|
588
|
-
),
|
|
589
|
-
let
|
|
590
|
-
|
|
672
|
+
), o = 1 / i, a = 1 - o;
|
|
673
|
+
let s = e !== void 0 ? e : 0;
|
|
674
|
+
if (s = Math.max(0, Math.min(a, s)), this.zoomState = {
|
|
591
675
|
level: i,
|
|
592
|
-
panX:
|
|
676
|
+
panX: 0,
|
|
677
|
+
// Not used - panX is derived from scroll position
|
|
593
678
|
isMinZoom: i <= this.options.minZoom,
|
|
594
679
|
isMaxZoom: i >= this.options.maxZoom
|
|
595
|
-
},
|
|
680
|
+
}, i > 1 && s > 0) {
|
|
681
|
+
const { scrollWidth: l, clientWidth: r } = this.scrollContainer, c = Math.max(l - r, 1), h = s / (1 - o);
|
|
682
|
+
this.scrollContainer.scrollLeft = Math.max(0, Math.min(c, h * c));
|
|
683
|
+
} else i <= 1 && (this.scrollContainer.scrollLeft = 0);
|
|
684
|
+
this.updateScrollState(), this.render();
|
|
596
685
|
}
|
|
597
686
|
/**
|
|
598
687
|
* Resets zoom to default (shows full table overview)
|
|
@@ -610,17 +699,26 @@ class A {
|
|
|
610
699
|
if (this.isDestroyed || this.options.mode !== "canvas") return;
|
|
611
700
|
const i = this.columns.length;
|
|
612
701
|
if (i === 0) return;
|
|
613
|
-
const
|
|
702
|
+
const o = Math.max(0, Math.min(i - 1, t)), s = Math.max(o + 1, Math.min(i, e)) - o, l = i / s, r = o / i;
|
|
614
703
|
this.setZoom(l, r);
|
|
615
704
|
}
|
|
616
705
|
/**
|
|
617
706
|
* Destroys the minimap instance and cleans up resources
|
|
618
707
|
*/
|
|
619
708
|
destroy() {
|
|
620
|
-
this.isDestroyed || (this.isDestroyed = !0, this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollContainer && this.scrollContainer.removeEventListener("scroll", this.boundHandlers.onScroll), this.minimapEl && this.minimapEl.removeEventListener("click", this.boundHandlers.onMinimapClick), this.viewportEl && (this.viewportEl.removeEventListener("pointerdown", this.boundHandlers.onPointerDown), this.viewportEl.removeEventListener("wheel", this.boundHandlers.onWheel)), this.canvasEl && (this.canvasEl.removeEventListener("wheel", this.boundHandlers.onWheel), this.canvasEl.removeEventListener("pointerdown", this.boundHandlers.onCanvasPointerDown), this.canvasEl.removeEventListener("mousemove", this.boundHandlers.onCanvasMouseMove), this.canvasEl.removeEventListener("mouseleave", this.boundHandlers.onCanvasMouseLeave)), document.removeEventListener("pointermove", this.boundHandlers.onPointerMove), document.removeEventListener("pointerup", this.boundHandlers.onPointerUp), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.mutationObserver && (this.mutationObserver.disconnect(), this.mutationObserver = null), this.minimapEl && this.minimapEl.parentNode && this.minimapEl.parentNode.removeChild(this.minimapEl), this.minimapEl = null, this.columnsEl = null, this.canvasEl = null, this.canvasCtx = null, this.viewportEl = null, this.scrollContainer = null, this.columns = []);
|
|
709
|
+
this.isDestroyed || (this.isDestroyed = !0, this.clearCompactCollapseTimer(), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollContainer && this.scrollContainer.removeEventListener("scroll", this.boundHandlers.onScroll), this.minimapEl && (this.minimapEl.removeEventListener("click", this.boundHandlers.onMinimapClick), this.minimapEl.removeEventListener("focusin", this.boundHandlers.onCompactFocusIn), this.minimapEl.removeEventListener("focusout", this.boundHandlers.onCompactFocusOut), this.minimapEl.removeEventListener("keydown", this.boundHandlers.onCompactKeyDown)), document.removeEventListener("click", this.boundHandlers.onDocumentClick), this.viewportEl && (this.viewportEl.removeEventListener("pointerdown", this.boundHandlers.onPointerDown), this.viewportEl.removeEventListener("wheel", this.boundHandlers.onWheel)), this.canvasEl && (this.canvasEl.removeEventListener("wheel", this.boundHandlers.onWheel), this.canvasEl.removeEventListener("pointerdown", this.boundHandlers.onCanvasPointerDown), this.canvasEl.removeEventListener("mousemove", this.boundHandlers.onCanvasMouseMove), this.canvasEl.removeEventListener("mouseleave", this.boundHandlers.onCanvasMouseLeave)), document.removeEventListener("pointermove", this.boundHandlers.onPointerMove), document.removeEventListener("pointerup", this.boundHandlers.onPointerUp), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.mutationObserver && (this.mutationObserver.disconnect(), this.mutationObserver = null), this.minimapEl && this.minimapEl.parentNode && this.minimapEl.parentNode.removeChild(this.minimapEl), this.minimapEl = null, this.columnsEl = null, this.canvasEl = null, this.canvasCtx = null, this.viewportEl = null, this.scrollContainer = null, this.columns = []);
|
|
621
710
|
}
|
|
622
711
|
}
|
|
712
|
+
const I = ':root{--tm-background: #e3f2fd;--tm-border: #90caf9;--tm-viewport-color: rgba(25, 118, 210, .3);--tm-viewport-border: #1976d2;--tm-height: 40px;--tm-column-color: #64b5f6;--tm-column-gap: 1px;--tm-border-radius: 4px;--tm-canvas-empty: #bbdefb;--tm-canvas-filled: #1565c0;--tm-compact-dot-size: 5px;--tm-compact-transition-duration: .18s}@media (prefers-color-scheme: dark){:root{--tm-background: #1a237e;--tm-border: #3949ab;--tm-viewport-color: rgba(100, 180, 255, .3);--tm-viewport-border: #64b5f6;--tm-column-color: #3f51b5;--tm-canvas-empty: #283593;--tm-canvas-filled: #90caf9}}.tm-minimap{position:relative;width:var(--tm-minimap-width, 100%);height:var(--tm-minimap-height, var(--tm-height));background:var(--tm-background);border:1px solid var(--tm-border);border-radius:var(--tm-border-radius);box-sizing:border-box;overflow:hidden;user-select:none;-webkit-user-select:none;cursor:pointer;transition:width var(--tm-compact-transition-duration) ease-in-out,height var(--tm-compact-transition-duration) ease-in-out,opacity var(--tm-compact-transition-duration) ease-in-out,transform var(--tm-compact-transition-duration) ease-in-out,background-color var(--tm-compact-transition-duration) ease-in-out,border-color var(--tm-compact-transition-duration) ease-in-out,box-shadow var(--tm-compact-transition-duration) ease-in-out;will-change:width,height,opacity,transform}.tm-minimap--top{margin-bottom:8px}.tm-minimap--bottom{margin-top:8px}.tm-minimap--fixed{z-index:100;box-shadow:0 4px 12px #00000026;border-radius:8px}.tm-minimap--compact-collapsed{border-radius:999px}.tm-minimap--compact-expanded{border-radius:8px}.tm-minimap--compact>*{transition:opacity var(--tm-compact-transition-duration) ease-in-out}.tm-minimap--compact-collapsed{background:color-mix(in srgb,var(--tm-background) 60%,transparent);border-color:color-mix(in srgb,var(--tm-border) 45%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--tm-border) 20%,transparent);opacity:.92;transform:translate(2px,2px)}.tm-minimap--compact-collapsed>*{opacity:0;pointer-events:none}.tm-minimap--compact-collapsed:after{content:"";position:absolute;right:calc((var(--tm-minimap-width, 24px) - var(--tm-compact-dot-size)) / 2);bottom:calc((var(--tm-minimap-height, 24px) - var(--tm-compact-dot-size)) / 2);width:var(--tm-compact-dot-size);height:var(--tm-compact-dot-size);border-radius:999px;background:color-mix(in srgb,var(--tm-viewport-border) 72%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--tm-viewport-border) 24%,transparent);opacity:.78;pointer-events:none;transition:opacity var(--tm-compact-transition-duration) ease-in-out,transform var(--tm-compact-transition-duration) ease-in-out,background-color var(--tm-compact-transition-duration) ease-in-out}.tm-minimap--compact-expanded{transform:translate(0)}.tm-minimap--compact-expanded:after{opacity:0;transform:scale(.7)}.tm-columns{display:flex;align-items:stretch;height:100%;gap:var(--tm-column-gap);padding:4px;box-sizing:border-box}.tm-column{flex:1 1 0;min-width:0;height:100%;background:var(--tm-column-color);border-radius:2px;transition:background-color .15s ease;cursor:pointer}.tm-column:hover{background:color-mix(in srgb,var(--tm-column-color) 80%,black)}.tm-canvas{width:100%;height:100%;display:block;cursor:pointer}.tm-viewport{position:absolute;top:0;height:100%;background:var(--tm-viewport-color);border-left:2px solid var(--tm-viewport-border);border-right:2px solid var(--tm-viewport-border);box-sizing:border-box;cursor:grab;transition:background-color .15s ease;z-index:10}.tm-viewport:hover{background:color-mix(in srgb,var(--tm-viewport-color) 100%,black 10%)}.tm-viewport--dragging{cursor:grabbing;background:color-mix(in srgb,var(--tm-viewport-color) 100%,black 20%);transition:none}.tm-viewport--disabled{cursor:default;pointer-events:none}.tm-minimap:focus-visible{outline:2px solid var(--tm-viewport-border);outline-offset:2px}.tm-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}';
|
|
713
|
+
let W = !1;
|
|
714
|
+
function Z() {
|
|
715
|
+
if (W || typeof document > "u") return;
|
|
716
|
+
const v = document.createElement("style");
|
|
717
|
+
v.id = "table-minimap-styles", v.textContent = I, document.head.appendChild(v), W = !0;
|
|
718
|
+
}
|
|
719
|
+
Z();
|
|
623
720
|
export {
|
|
624
|
-
|
|
721
|
+
F as TableMinimap,
|
|
722
|
+
Z as injectStyles
|
|
625
723
|
};
|
|
626
724
|
//# sourceMappingURL=table-minimap.js.map
|