@bigplay/tree-view-core 0.3.0 → 0.3.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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +123 -123
- package/dist/index.js.map +1 -1
- package/dist/scroll.d.ts +9 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,41 +12,41 @@ function Y(e) {
|
|
|
12
12
|
function X(e) {
|
|
13
13
|
return e?.children;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function W(e) {
|
|
16
16
|
return e?.id;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function at(e, t = {}) {
|
|
19
19
|
if (e == null) return [];
|
|
20
20
|
const n = Array.isArray(e) ? e : [e];
|
|
21
|
-
return n.length === 0 ? [] : t.getParentId ?
|
|
21
|
+
return n.length === 0 ? [] : t.getParentId ? F(n, t) : G(n, t);
|
|
22
22
|
}
|
|
23
23
|
function G(e, t) {
|
|
24
|
-
const n = t.getId ??
|
|
25
|
-
function s(r,
|
|
26
|
-
const d =
|
|
24
|
+
const n = t.getId ?? W, i = t.getChildren ?? X, o = /* @__PURE__ */ new Set();
|
|
25
|
+
function s(r, h, c, l) {
|
|
26
|
+
const d = k(n(r), l);
|
|
27
27
|
A(d, o);
|
|
28
|
-
const p = (i(r) ?? []).map((a, f) => s(a,
|
|
29
|
-
return { id: d, data: r, depth:
|
|
28
|
+
const p = (i(r) ?? []).map((a, f) => s(a, h + 1, d, `${l}.${f}`));
|
|
29
|
+
return { id: d, data: r, depth: h, parentId: c, children: p, hasChildren: p.length > 0, collapsed: !1 };
|
|
30
30
|
}
|
|
31
|
-
return e.map((r,
|
|
32
|
-
}
|
|
33
|
-
function
|
|
34
|
-
const n = t.getId ??
|
|
35
|
-
const d =
|
|
36
|
-
return A(d, i), { id: d, data:
|
|
37
|
-
}), s = new Map(o.map((
|
|
38
|
-
if (o.forEach((
|
|
31
|
+
return e.map((r, h) => s(r, 0, null, String(h)));
|
|
32
|
+
}
|
|
33
|
+
function F(e, t) {
|
|
34
|
+
const n = t.getId ?? W, i = /* @__PURE__ */ new Set(), o = e.map((c, l) => {
|
|
35
|
+
const d = k(n(c), String(l));
|
|
36
|
+
return A(d, i), { id: d, data: c, depth: 0, parentId: null, children: [], hasChildren: !1, collapsed: !1 };
|
|
37
|
+
}), s = new Map(o.map((c) => [c.id, c])), r = [];
|
|
38
|
+
if (o.forEach((c, l) => {
|
|
39
39
|
const d = t.getParentId(e[l]), u = d == null ? void 0 : s.get(String(d));
|
|
40
40
|
if (!u) {
|
|
41
|
-
r.push(
|
|
41
|
+
r.push(c);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
}),
|
|
44
|
+
c.parentId = u.id, u.children.push(c), u.hasChildren = !0;
|
|
45
|
+
}), N(r) !== o.length)
|
|
46
46
|
throw new Error("[tree-view] В данных есть цикл: часть узлов ссылается друг на друга по кругу.");
|
|
47
47
|
return r;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function N(e) {
|
|
50
50
|
const t = [...e];
|
|
51
51
|
for (let n = 0; n < t.length; n += 1) {
|
|
52
52
|
const i = t[n];
|
|
@@ -55,7 +55,7 @@ function V(e) {
|
|
|
55
55
|
}
|
|
56
56
|
return t.length;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function k(e, t) {
|
|
59
59
|
return e == null || e === "" ? t : String(e);
|
|
60
60
|
}
|
|
61
61
|
function A(e, t) {
|
|
@@ -63,13 +63,13 @@ function A(e, t) {
|
|
|
63
63
|
throw new Error(`[tree-view] Повторяющийся id узла: "${e}". Идентификаторы должны быть уникальными.`);
|
|
64
64
|
t.add(e);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function dt(e, t = {}) {
|
|
67
67
|
const n = e.filter((s) => s.length > 0);
|
|
68
68
|
if (n.length === 0) return [];
|
|
69
69
|
const i = n.length - 1, o = n.map(
|
|
70
|
-
(s, r) => s.map((
|
|
71
|
-
id:
|
|
72
|
-
data:
|
|
70
|
+
(s, r) => s.map((h, c) => ({
|
|
71
|
+
id: V(h, r, c, t.getId),
|
|
72
|
+
data: h,
|
|
73
73
|
// Финал — корень, поэтому глубина считается от последнего уровня.
|
|
74
74
|
depth: i - r,
|
|
75
75
|
parentId: null,
|
|
@@ -79,19 +79,19 @@ function at(e, t = {}) {
|
|
|
79
79
|
}))
|
|
80
80
|
);
|
|
81
81
|
for (let s = 0; s < i; s += 1) {
|
|
82
|
-
const r = o[s],
|
|
82
|
+
const r = o[s], h = o[s + 1], c = Math.ceil(r.length / h.length);
|
|
83
83
|
r.forEach((l, d) => {
|
|
84
|
-
const u =
|
|
84
|
+
const u = h[Math.min(Math.floor(d / c), h.length - 1)];
|
|
85
85
|
l.parentId = u.id, u.children.push(l), u.hasChildren = !0;
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
return o[i];
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function V(e, t, n, i) {
|
|
91
91
|
const o = i ? i(e, t, n) : e?.id;
|
|
92
92
|
return o == null || o === "" ? `${t}.${n}` : String(o);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function ut(e, t) {
|
|
95
95
|
if (t.size === 0) return e;
|
|
96
96
|
function n(i) {
|
|
97
97
|
const o = t.has(i.id);
|
|
@@ -103,22 +103,22 @@ function dt(e, t) {
|
|
|
103
103
|
}
|
|
104
104
|
return e.map(n);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ft(e, t) {
|
|
107
107
|
const n = new Set(e);
|
|
108
108
|
return n.delete(t) || n.add(t), n;
|
|
109
109
|
}
|
|
110
110
|
const _ = 2, Z = 40;
|
|
111
|
-
function
|
|
112
|
-
const n = e?.teams ?? [], i = Math.max(t.rows ?? _, n.length), o = t.techDefeatLabel ?? "ТП", s = n.map((r,
|
|
113
|
-
const
|
|
111
|
+
function pt(e, t = {}) {
|
|
112
|
+
const n = e?.teams ?? [], i = Math.max(t.rows ?? _, n.length), o = t.techDefeatLabel ?? "ТП", s = n.map((r, h) => {
|
|
113
|
+
const c = r.isTechDefeat === !0, l = r.isWinner === !0;
|
|
114
114
|
return {
|
|
115
|
-
key: String(r.id ?? `team-${
|
|
115
|
+
key: String(r.id ?? `team-${h}`),
|
|
116
116
|
team: r,
|
|
117
|
-
score:
|
|
117
|
+
score: c ? o : String(r.score ?? ""),
|
|
118
118
|
isWinner: l,
|
|
119
119
|
isLoser: !l,
|
|
120
120
|
isMyTeam: r.isMyTeam === !0,
|
|
121
|
-
isTechDefeat:
|
|
121
|
+
isTechDefeat: c,
|
|
122
122
|
isEmpty: !1
|
|
123
123
|
};
|
|
124
124
|
});
|
|
@@ -135,48 +135,48 @@ function ft(e, t = {}) {
|
|
|
135
135
|
});
|
|
136
136
|
return { rows: s, hasMyTeam: n.some((r) => r.isMyTeam === !0) };
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function mt(e, t = {}) {
|
|
139
139
|
const n = e?.teams ?? [];
|
|
140
140
|
return Math.max(t.rows ?? _, n.length) * (t.rowHeight ?? Z);
|
|
141
141
|
}
|
|
142
|
-
const $ = { min: 0.2, max: 3 },
|
|
142
|
+
const $ = { min: 0.2, max: 3 }, M = { x: 0, y: 0, scale: 1 };
|
|
143
143
|
function v(e, t, n) {
|
|
144
144
|
return Math.min(Math.max(e, t), n);
|
|
145
145
|
}
|
|
146
146
|
function q(e, t, n = 24, i = $) {
|
|
147
147
|
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
148
|
-
return { ...
|
|
149
|
-
const o = Math.max(t.width - n * 2, 1), s = Math.max(t.height - n * 2, 1), r = Math.min(o / e.width, s / e.height, 1),
|
|
148
|
+
return { ...M };
|
|
149
|
+
const o = Math.max(t.width - n * 2, 1), s = Math.max(t.height - n * 2, 1), r = Math.min(o / e.width, s / e.height, 1), h = v(r, i.min, i.max);
|
|
150
150
|
return {
|
|
151
|
-
scale:
|
|
152
|
-
x: (t.width - e.width *
|
|
153
|
-
y: (t.height - e.height *
|
|
151
|
+
scale: h,
|
|
152
|
+
x: (t.width - e.width * h) / 2,
|
|
153
|
+
y: (t.height - e.height * h) / 2
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
function K(e, t, n) {
|
|
157
157
|
return { ...e, x: e.x + t, y: e.y + n };
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function L(e, t, n, i = $) {
|
|
160
160
|
const o = v(e.scale * t, i.min, i.max);
|
|
161
161
|
if (o === e.scale) return e;
|
|
162
162
|
const s = (n.x - e.x) / e.scale, r = (n.y - e.y) / e.scale;
|
|
163
163
|
return { scale: o, x: n.x - s * o, y: n.y - r * o };
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function gt(e) {
|
|
166
166
|
return `translate(${e.x}px, ${e.y}px) scale(${e.scale})`;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function wt(e, t) {
|
|
169
169
|
const n = t.nodeWidth + t.levelGap, i = (e ?? []).map((o, s) => {
|
|
170
170
|
const r = o.id ?? s;
|
|
171
171
|
return { key: String(r), id: r, name: o.name, index: s, width: n };
|
|
172
172
|
});
|
|
173
173
|
return { columns: i, width: n * i.length, offset: t.levelGap / 2 };
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function yt(e) {
|
|
176
176
|
const t = e.left + e.width / 2 - e.viewport / 2;
|
|
177
177
|
return v(t, 0, Math.max(0, e.scrollWidth - e.viewport));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function xt(e) {
|
|
180
180
|
if (typeof window > "u") return null;
|
|
181
181
|
let t = e?.parentElement ?? null;
|
|
182
182
|
for (; t; ) {
|
|
@@ -186,28 +186,28 @@ function yt(e) {
|
|
|
186
186
|
}
|
|
187
187
|
return null;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function Et(e, t) {
|
|
190
190
|
if (typeof e.scrollTo == "function") {
|
|
191
191
|
e.scrollTo({ left: t, behavior: "smooth" });
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
e.scrollLeft = t;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function j(e, t) {
|
|
197
197
|
return e.getBoundingClientRect().left - t.getBoundingClientRect().left + t.scrollLeft;
|
|
198
198
|
}
|
|
199
|
-
const
|
|
200
|
-
function
|
|
199
|
+
const Q = ".tree-view__node";
|
|
200
|
+
function Ct(e, t, n, i) {
|
|
201
201
|
const o = e.getBoundingClientRect().left + i;
|
|
202
|
-
return Array.from(e.querySelectorAll(
|
|
203
|
-
const
|
|
204
|
-
return Math.floor((
|
|
202
|
+
return Array.from(e.querySelectorAll(Q)).filter((r) => {
|
|
203
|
+
const h = r.getBoundingClientRect();
|
|
204
|
+
return Math.floor((h.left + h.width / 2 - o) / n) === t;
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
207
|
+
function Lt(e, t) {
|
|
208
|
+
return { left: j(e, t), width: e.getBoundingClientRect().width };
|
|
209
209
|
}
|
|
210
|
-
const
|
|
210
|
+
const Mt = "(max-width: 768px)";
|
|
211
211
|
function $t(e, t) {
|
|
212
212
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
|
|
213
213
|
};
|
|
@@ -217,10 +217,10 @@ function $t(e, t) {
|
|
|
217
217
|
function m(e) {
|
|
218
218
|
return Math.round(e * 100) / 100;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function J(e) {
|
|
221
221
|
return e === "top-to-bottom" || e === "bottom-to-top";
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function tt(e, t, n) {
|
|
224
224
|
const i = e.x + e.width / 2, o = e.y + e.height / 2, s = t.x + t.width / 2, r = t.y + t.height / 2;
|
|
225
225
|
switch (n) {
|
|
226
226
|
case "top-to-bottom":
|
|
@@ -233,24 +233,24 @@ function J(e, t, n) {
|
|
|
233
233
|
return { from: { x: e.x, y: o }, to: { x: t.x + t.width, y: r } };
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const o = m(e.x), s = m(e.y), r = m(t.x),
|
|
236
|
+
function et(e, t, n, i) {
|
|
237
|
+
const o = m(e.x), s = m(e.y), r = m(t.x), h = m(t.y);
|
|
238
238
|
if (n === "straight")
|
|
239
|
-
return `M ${o} ${s} L ${r} ${
|
|
240
|
-
const
|
|
241
|
-
return n === "elbow" ?
|
|
239
|
+
return `M ${o} ${s} L ${r} ${h}`;
|
|
240
|
+
const c = J(i), l = m((o + r) / 2), d = m((s + h) / 2);
|
|
241
|
+
return n === "elbow" ? c ? `M ${o} ${s} L ${o} ${d} L ${r} ${d} L ${r} ${h}` : `M ${o} ${s} L ${l} ${s} L ${l} ${h} L ${r} ${h}` : c ? `M ${o} ${s} C ${o} ${d} ${r} ${d} ${r} ${h}` : `M ${o} ${s} C ${l} ${s} ${l} ${h} ${r} ${h}`;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function nt(e, t) {
|
|
244
244
|
const n = new Map(e.map((o) => [o.id, o])), i = [];
|
|
245
245
|
for (const o of e) {
|
|
246
246
|
const s = o.parentId == null ? void 0 : n.get(o.parentId);
|
|
247
247
|
if (!s) continue;
|
|
248
|
-
const { from: r, to:
|
|
248
|
+
const { from: r, to: h } = tt(s, o, t.direction);
|
|
249
249
|
i.push({
|
|
250
250
|
id: `${s.id}->${o.id}`,
|
|
251
251
|
source: s,
|
|
252
252
|
target: o,
|
|
253
|
-
path:
|
|
253
|
+
path: et(r, h, t.linkStyle, t.direction)
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
return i;
|
|
@@ -258,41 +258,41 @@ function et(e, t) {
|
|
|
258
258
|
function R(e, t) {
|
|
259
259
|
return typeof e == "function" ? e(t) : e;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function it(e, t) {
|
|
262
262
|
const n = t.direction === "top-to-bottom" || t.direction === "bottom-to-top", i = /* @__PURE__ */ new Map(), o = [];
|
|
263
263
|
let s = 0;
|
|
264
264
|
const r = [];
|
|
265
|
-
function
|
|
265
|
+
function h(a) {
|
|
266
266
|
const f = R(t.nodeWidth, a), I = R(t.nodeHeight, a), S = n ? I : f, y = n ? f : I;
|
|
267
267
|
r[a.depth] = Math.max(r[a.depth] ?? 0, S);
|
|
268
268
|
const T = s, O = o.length;
|
|
269
269
|
let g = s;
|
|
270
270
|
if (a.children.length > 0) {
|
|
271
|
-
const E = a.children.map(
|
|
271
|
+
const E = a.children.map(h), P = E[0], b = E[E.length - 1], B = P.across + P.acrossSize / 2, H = b.across + b.acrossSize / 2;
|
|
272
272
|
g = (B + H) / 2 - y / 2;
|
|
273
273
|
const D = T - g;
|
|
274
274
|
if (D > 0) {
|
|
275
|
-
for (let
|
|
275
|
+
for (let C = O; C < o.length; C += 1) o[C].across += D;
|
|
276
276
|
g = T;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
const x = { depth: a.depth, along: 0, across: g, alongSize: S, acrossSize: y };
|
|
280
280
|
return i.set(a.id, x), o.push(x), s = Math.max(s, g + y + t.siblingGap), x;
|
|
281
281
|
}
|
|
282
|
-
e.forEach(
|
|
283
|
-
const
|
|
282
|
+
e.forEach(h);
|
|
283
|
+
const c = [];
|
|
284
284
|
let l = 0;
|
|
285
285
|
for (let a = 0; a < r.length; a += 1)
|
|
286
|
-
|
|
286
|
+
c[a] = l, l += (r[a] ?? 0) + t.levelGap;
|
|
287
287
|
let d = 0;
|
|
288
288
|
for (const a of o) {
|
|
289
289
|
const f = r[a.depth] ?? a.alongSize;
|
|
290
|
-
a.along =
|
|
290
|
+
a.along = c[a.depth] + (f - a.alongSize) / 2, d = Math.max(d, a.across + a.acrossSize);
|
|
291
291
|
}
|
|
292
|
-
const u = r.length - 1, p = u < 0 ? 0 :
|
|
292
|
+
const u = r.length - 1, p = u < 0 ? 0 : c[u] + r[u];
|
|
293
293
|
return { byId: i, alongExtent: p, acrossExtent: d };
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function ot(e) {
|
|
296
296
|
const t = [];
|
|
297
297
|
function n(i) {
|
|
298
298
|
t.push(i), i.children.forEach(n);
|
|
@@ -303,8 +303,8 @@ function vt(e, t) {
|
|
|
303
303
|
const n = Y(t);
|
|
304
304
|
if (e.length === 0)
|
|
305
305
|
return { nodes: [], links: [], width: 0, height: 0 };
|
|
306
|
-
const i = n.direction === "top-to-bottom" || n.direction === "bottom-to-top", { byId: o, alongExtent: s, acrossExtent: r } =
|
|
307
|
-
const { along: d, across: u, alongSize: p, acrossSize: a } = o.get(l.id), f =
|
|
306
|
+
const i = n.direction === "top-to-bottom" || n.direction === "bottom-to-top", { byId: o, alongExtent: s, acrossExtent: r } = it(e, n), h = n.direction === "bottom-to-top" || n.direction === "right-to-left", c = ot(e).map((l) => {
|
|
307
|
+
const { along: d, across: u, alongSize: p, acrossSize: a } = o.get(l.id), f = h ? s - p - d : d;
|
|
308
308
|
return {
|
|
309
309
|
id: l.id,
|
|
310
310
|
data: l.data,
|
|
@@ -319,8 +319,8 @@ function vt(e, t) {
|
|
|
319
319
|
};
|
|
320
320
|
});
|
|
321
321
|
return {
|
|
322
|
-
nodes:
|
|
323
|
-
links:
|
|
322
|
+
nodes: c,
|
|
323
|
+
links: nt(c, n),
|
|
324
324
|
width: i ? r : s,
|
|
325
325
|
height: i ? s : r
|
|
326
326
|
};
|
|
@@ -328,7 +328,7 @@ function vt(e, t) {
|
|
|
328
328
|
const w = 1.2;
|
|
329
329
|
class It {
|
|
330
330
|
constructor(t) {
|
|
331
|
-
this.params = t, this.transform = { ...
|
|
331
|
+
this.params = t, this.transform = { ...M }, this.element = null, this.pointers = /* @__PURE__ */ new Map(), this.lastPinchDistance = 0, this.onPointerDown = (n) => {
|
|
332
332
|
this.isPannable() && (n.target?.closest?.("[data-tv-no-pan]") || (this.pointers.set(n.pointerId, { x: n.clientX, y: n.clientY }), this.element?.setPointerCapture?.(n.pointerId)));
|
|
333
333
|
}, this.onPointerMove = (n) => {
|
|
334
334
|
const i = this.pointers.get(n.pointerId);
|
|
@@ -345,7 +345,7 @@ class It {
|
|
|
345
345
|
if (!this.isZoomable()) return;
|
|
346
346
|
n.preventDefault();
|
|
347
347
|
const i = n.deltaY < 0 ? w : 1 / w;
|
|
348
|
-
this.set(
|
|
348
|
+
this.set(L(this.transform, i, this.toLocalPoint(n), this.limits));
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
/** Подписывается на события элемента. Повторный вызов сначала отписывается. */
|
|
@@ -376,7 +376,7 @@ class It {
|
|
|
376
376
|
this.zoomToCenter(1 / w);
|
|
377
377
|
}
|
|
378
378
|
reset() {
|
|
379
|
-
this.set({ ...
|
|
379
|
+
this.set({ ...M });
|
|
380
380
|
}
|
|
381
381
|
/** Устанавливает состояние напрямую (например, восстановление после перезагрузки). */
|
|
382
382
|
set(t) {
|
|
@@ -398,7 +398,7 @@ class It {
|
|
|
398
398
|
}
|
|
399
399
|
zoomToCenter(t) {
|
|
400
400
|
const n = this.element, i = { x: (n?.clientWidth ?? 0) / 2, y: (n?.clientHeight ?? 0) / 2 };
|
|
401
|
-
this.set(
|
|
401
|
+
this.set(L(this.transform, t, i, this.limits));
|
|
402
402
|
}
|
|
403
403
|
/** Два пальца: масштабируем вокруг точки ровно между ними. */
|
|
404
404
|
pinch() {
|
|
@@ -411,7 +411,7 @@ class It {
|
|
|
411
411
|
clientX: (t.x + n.x) / 2,
|
|
412
412
|
clientY: (t.y + n.y) / 2
|
|
413
413
|
});
|
|
414
|
-
this.set(
|
|
414
|
+
this.set(L(this.transform, i / this.lastPinchDistance, o, this.limits));
|
|
415
415
|
}
|
|
416
416
|
this.lastPinchDistance = i;
|
|
417
417
|
}
|
|
@@ -421,11 +421,11 @@ function St(e, t = "tree-view-styles") {
|
|
|
421
421
|
const n = document.createElement("style");
|
|
422
422
|
n.id = t, n.textContent = e, document.head.appendChild(n);
|
|
423
423
|
}
|
|
424
|
-
const
|
|
425
|
-
function
|
|
424
|
+
const rt = 400, st = 150;
|
|
425
|
+
function z(e, t) {
|
|
426
426
|
return e.x <= t.x + t.width && e.x + e.width >= t.x && e.y <= t.y + t.height && e.y + e.height >= t.y;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function ht(e) {
|
|
429
429
|
const { source: t, target: n } = e, i = Math.min(t.x, n.x), o = Math.min(t.y, n.y);
|
|
430
430
|
return {
|
|
431
431
|
x: i,
|
|
@@ -437,21 +437,21 @@ function st(e) {
|
|
|
437
437
|
function ct(e, t) {
|
|
438
438
|
return { x: e.x - t, y: e.y - t, width: e.width + t * 2, height: e.height + t * 2 };
|
|
439
439
|
}
|
|
440
|
-
function Tt(e, t, n =
|
|
441
|
-
if (!t || e.nodes.length <
|
|
440
|
+
function Tt(e, t, n = rt) {
|
|
441
|
+
if (!t || e.nodes.length < st) return e;
|
|
442
442
|
if (t.width <= 0 || t.height <= 0)
|
|
443
443
|
return { nodes: [], links: [], width: e.width, height: e.height };
|
|
444
444
|
const i = ct(t, n), o = [], s = [];
|
|
445
445
|
for (const r of e.nodes)
|
|
446
|
-
|
|
446
|
+
z(i, r) && o.push(r);
|
|
447
447
|
for (const r of e.links)
|
|
448
|
-
|
|
448
|
+
z(i, ht(r)) && s.push(r);
|
|
449
449
|
return { nodes: o, links: s, width: e.width, height: e.height };
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function Pt() {
|
|
452
452
|
return typeof window > "u" ? null : { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function bt(e, t) {
|
|
455
455
|
if (!e || typeof window > "u" || t <= 0) return null;
|
|
456
456
|
const n = e.getBoundingClientRect(), i = Math.max(n.left, 0), o = Math.max(n.top, 0), s = Math.min(n.right, window.innerWidth), r = Math.min(n.bottom, window.innerHeight);
|
|
457
457
|
return s <= i || r <= o ? { x: 0, y: 0, width: 0, height: 0 } : {
|
|
@@ -465,44 +465,44 @@ export {
|
|
|
465
465
|
_ as DEFAULT_BRACKET_ROWS,
|
|
466
466
|
Z as DEFAULT_BRACKET_ROW_HEIGHT,
|
|
467
467
|
U as DEFAULT_OPTIONS,
|
|
468
|
-
|
|
468
|
+
rt as DEFAULT_OVERSCAN,
|
|
469
469
|
$ as DEFAULT_SCALE_LIMITS,
|
|
470
|
-
|
|
471
|
-
|
|
470
|
+
M as IDENTITY_TRANSFORM,
|
|
471
|
+
Mt as MOBILE_MEDIA_QUERY,
|
|
472
472
|
It as PanZoomController,
|
|
473
|
-
|
|
474
|
-
|
|
473
|
+
Q as TREE_NODE_SELECTOR,
|
|
474
|
+
st as VIRTUALIZE_THRESHOLD,
|
|
475
475
|
w as ZOOM_STEP,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
476
|
+
ut as applyCollapsed,
|
|
477
|
+
mt as bracketCardHeight,
|
|
478
|
+
pt as buildBracketCard,
|
|
479
|
+
wt as buildBracketRounds,
|
|
480
|
+
nt as buildLinks,
|
|
481
|
+
et as buildPath,
|
|
482
482
|
v as clamp,
|
|
483
|
-
|
|
483
|
+
Pt as estimateVisibleRect,
|
|
484
484
|
ct as expandRect,
|
|
485
|
-
|
|
485
|
+
xt as findScrollParent,
|
|
486
486
|
q as fitToViewport,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
ot as flatten,
|
|
488
|
+
dt as fromLevels,
|
|
489
|
+
tt as getAnchors,
|
|
490
|
+
Lt as horizontalBox,
|
|
490
491
|
St as injectStyles,
|
|
491
492
|
vt as layoutTree,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
bt as measureVisibleRect,
|
|
494
|
+
Ct as nodesInColumn,
|
|
495
|
+
j as offsetWithin,
|
|
495
496
|
K as panBy,
|
|
496
|
-
|
|
497
|
+
it as placeNodes,
|
|
497
498
|
Y as resolveOptions,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
ut as toggleCollapsed,
|
|
499
|
+
yt as roundScrollLeft,
|
|
500
|
+
Et as smoothScrollLeft,
|
|
501
|
+
gt as toCssTransform,
|
|
502
|
+
at as toTree,
|
|
503
|
+
ft as toggleCollapsed,
|
|
504
504
|
Tt as visibleLayout,
|
|
505
505
|
$t as watchMedia,
|
|
506
|
-
|
|
506
|
+
L as zoomAtPoint
|
|
507
507
|
};
|
|
508
508
|
//# sourceMappingURL=index.js.map
|