@dynamix-layout/core 1.0.1 → 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/CHANGELOG.md +30 -0
- package/dist/core.cjs.js +4 -4
- package/dist/core.es.js +820 -583
- package/dist/core.iife.js +4 -4
- package/dist/core.umd.js +4 -4
- package/dist/types/app/dom.d.ts +17 -0
- package/dist/types/app/drop-preview.d.ts +27 -0
- package/dist/types/app/dynamix.d.ts +23 -51
- package/dist/types/app/geometry.d.ts +9 -0
- package/dist/types/app/index.d.ts +2 -0
- package/dist/types/app/node.d.ts +40 -0
- package/dist/types/app/slider.d.ts +10 -0
- package/dist/types/app/state.d.ts +20 -0
- package/dist/types/app/tree-builder.d.ts +13 -0
- package/dist/types/app/tree-mutations.d.ts +17 -0
- package/package.json +4 -4
package/dist/core.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
class
|
|
1
|
+
class b {
|
|
2
2
|
buffer;
|
|
3
3
|
head = 0;
|
|
4
4
|
tail = 0;
|
|
5
5
|
count = 0;
|
|
6
6
|
capacity;
|
|
7
7
|
constructor(t = 16, e = []) {
|
|
8
|
-
this.capacity = Math.max(t, e.length), this.buffer = new Array(this.capacity), e.forEach((
|
|
9
|
-
this.enqueue(
|
|
8
|
+
this.capacity = Math.max(t, e.length), this.buffer = new Array(this.capacity), e.forEach((n) => {
|
|
9
|
+
this.enqueue(n);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
enqueue(t) {
|
|
@@ -23,8 +23,8 @@ class N {
|
|
|
23
23
|
if (t === this.count)
|
|
24
24
|
return this.enqueue(e), !0;
|
|
25
25
|
this.count === this.capacity && this.resize();
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
const n = t, i = this.count - t;
|
|
27
|
+
return n <= i ? this.shiftLeft(t, e) : this.shiftRight(t, e), this.count++, !0;
|
|
28
28
|
}
|
|
29
29
|
insertArray(t, e) {
|
|
30
30
|
if (t < 0 || t > this.count)
|
|
@@ -32,38 +32,38 @@ class N {
|
|
|
32
32
|
if (e.length === 0)
|
|
33
33
|
return !0;
|
|
34
34
|
if (t === 0) {
|
|
35
|
-
for (let
|
|
36
|
-
this.enqueueFront(e[
|
|
35
|
+
for (let r = e.length - 1; r >= 0; r--)
|
|
36
|
+
this.enqueueFront(e[r]);
|
|
37
37
|
return !0;
|
|
38
38
|
}
|
|
39
39
|
if (t === this.count)
|
|
40
|
-
return e.forEach((
|
|
40
|
+
return e.forEach((r) => this.enqueue(r)), !0;
|
|
41
41
|
for (; this.count + e.length > this.capacity; )
|
|
42
42
|
this.resize();
|
|
43
|
-
const
|
|
44
|
-
return
|
|
43
|
+
const n = t, i = this.count - t, s = e.length;
|
|
44
|
+
return n <= i ? this.shiftLeftArray(t, e) : this.shiftRightArray(t, e), this.count += s, !0;
|
|
45
45
|
}
|
|
46
46
|
insertQueue(t, e) {
|
|
47
47
|
if (t < 0 || t > this.count)
|
|
48
48
|
return !1;
|
|
49
49
|
if (e.isEmpty())
|
|
50
50
|
return !0;
|
|
51
|
-
const
|
|
51
|
+
const n = e.size();
|
|
52
52
|
if (t === 0) {
|
|
53
|
-
const
|
|
54
|
-
for (let
|
|
55
|
-
this.enqueueFront(
|
|
53
|
+
const c = e.toArray();
|
|
54
|
+
for (let d = c.length - 1; d >= 0; d--)
|
|
55
|
+
this.enqueueFront(c[d]);
|
|
56
56
|
return !0;
|
|
57
57
|
}
|
|
58
58
|
if (t === this.count) {
|
|
59
|
-
for (const
|
|
60
|
-
this.enqueue(
|
|
59
|
+
for (const c of e)
|
|
60
|
+
this.enqueue(c);
|
|
61
61
|
return !0;
|
|
62
62
|
}
|
|
63
|
-
for (; this.count +
|
|
63
|
+
for (; this.count + n > this.capacity; )
|
|
64
64
|
this.resize();
|
|
65
|
-
const
|
|
66
|
-
return s <=
|
|
65
|
+
const i = e.toArray(), s = t, r = this.count - t;
|
|
66
|
+
return s <= r ? this.shiftLeftArray(t, i) : this.shiftRightArray(t, i), this.count += n, !0;
|
|
67
67
|
}
|
|
68
68
|
push(t) {
|
|
69
69
|
this.enqueue(t);
|
|
@@ -86,8 +86,8 @@ class N {
|
|
|
86
86
|
}
|
|
87
87
|
indexOf(t) {
|
|
88
88
|
for (let e = 0; e < this.count; e++) {
|
|
89
|
-
const
|
|
90
|
-
if (this.buffer[
|
|
89
|
+
const n = (this.head + e) % this.capacity;
|
|
90
|
+
if (this.buffer[n] === t)
|
|
91
91
|
return e;
|
|
92
92
|
}
|
|
93
93
|
return -1;
|
|
@@ -103,8 +103,8 @@ class N {
|
|
|
103
103
|
return this.dequeue();
|
|
104
104
|
if (t === this.count - 1)
|
|
105
105
|
return this.dequeueBack();
|
|
106
|
-
const e = (this.head + t) % this.capacity,
|
|
107
|
-
return
|
|
106
|
+
const e = (this.head + t) % this.capacity, n = this.buffer[e], i = t, s = this.count - t - 1;
|
|
107
|
+
return i <= s ? this.shiftRightForRemoval(t) : this.shiftLeftForRemoval(t), this.count--, n;
|
|
108
108
|
}
|
|
109
109
|
shift() {
|
|
110
110
|
return this.dequeue();
|
|
@@ -145,8 +145,8 @@ class N {
|
|
|
145
145
|
set(t, e) {
|
|
146
146
|
if (t < 0 || t >= this.count)
|
|
147
147
|
return !1;
|
|
148
|
-
const
|
|
149
|
-
return this.buffer[
|
|
148
|
+
const n = (this.head + t) % this.capacity;
|
|
149
|
+
return this.buffer[n] = e, !0;
|
|
150
150
|
}
|
|
151
151
|
peek() {
|
|
152
152
|
return this.count > 0 ? this.buffer[this.head] : void 0;
|
|
@@ -180,8 +180,8 @@ class N {
|
|
|
180
180
|
toArray() {
|
|
181
181
|
const t = [];
|
|
182
182
|
for (let e = 0; e < this.count; e++) {
|
|
183
|
-
const
|
|
184
|
-
t.push(this.buffer[
|
|
183
|
+
const n = (this.head + e) % this.capacity;
|
|
184
|
+
t.push(this.buffer[n]);
|
|
185
185
|
}
|
|
186
186
|
return t;
|
|
187
187
|
}
|
|
@@ -224,137 +224,150 @@ class N {
|
|
|
224
224
|
}
|
|
225
225
|
resize() {
|
|
226
226
|
const t = this.capacity * 2, e = new Array(t);
|
|
227
|
-
for (let
|
|
228
|
-
const
|
|
229
|
-
e[
|
|
227
|
+
for (let n = 0; n < this.count; n++) {
|
|
228
|
+
const i = (this.head + n) % this.capacity;
|
|
229
|
+
e[n] = this.buffer[i];
|
|
230
230
|
}
|
|
231
231
|
this.buffer = e, this.capacity = t, this.head = 0, this.tail = this.count;
|
|
232
232
|
}
|
|
233
233
|
shiftLeft(t, e) {
|
|
234
234
|
this.head = (this.head - 1 + this.capacity) % this.capacity;
|
|
235
|
-
for (let
|
|
236
|
-
const s = (this.head + 1 +
|
|
237
|
-
this.buffer[
|
|
235
|
+
for (let i = 0; i < t; i++) {
|
|
236
|
+
const s = (this.head + 1 + i) % this.capacity, r = (this.head + i) % this.capacity;
|
|
237
|
+
this.buffer[r] = this.buffer[s];
|
|
238
238
|
}
|
|
239
|
-
const
|
|
240
|
-
this.buffer[
|
|
239
|
+
const n = (this.head + t) % this.capacity;
|
|
240
|
+
this.buffer[n] = e;
|
|
241
241
|
}
|
|
242
242
|
shiftRight(t, e) {
|
|
243
|
-
for (let
|
|
244
|
-
const s = (this.head +
|
|
245
|
-
this.buffer[
|
|
243
|
+
for (let i = this.count - 1; i >= t; i--) {
|
|
244
|
+
const s = (this.head + i) % this.capacity, r = (this.head + i + 1) % this.capacity;
|
|
245
|
+
this.buffer[r] = this.buffer[s];
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
this.buffer[
|
|
247
|
+
const n = (this.head + t) % this.capacity;
|
|
248
|
+
this.buffer[n] = e, this.tail = (this.tail + 1) % this.capacity;
|
|
249
249
|
}
|
|
250
250
|
shiftRightForRemoval(t) {
|
|
251
251
|
for (let e = t; e > 0; e--) {
|
|
252
|
-
const
|
|
253
|
-
this.buffer[
|
|
252
|
+
const n = (this.head + e - 1) % this.capacity, i = (this.head + e) % this.capacity;
|
|
253
|
+
this.buffer[i] = this.buffer[n];
|
|
254
254
|
}
|
|
255
255
|
this.head = (this.head + 1) % this.capacity;
|
|
256
256
|
}
|
|
257
257
|
shiftLeftForRemoval(t) {
|
|
258
258
|
for (let e = t; e < this.count - 1; e++) {
|
|
259
|
-
const
|
|
260
|
-
this.buffer[
|
|
259
|
+
const n = (this.head + e + 1) % this.capacity, i = (this.head + e) % this.capacity;
|
|
260
|
+
this.buffer[i] = this.buffer[n];
|
|
261
261
|
}
|
|
262
262
|
this.tail = (this.tail - 1 + this.capacity) % this.capacity;
|
|
263
263
|
}
|
|
264
264
|
shiftLeftArray(t, e) {
|
|
265
|
-
const
|
|
266
|
-
this.head = (this.head -
|
|
267
|
-
for (let
|
|
268
|
-
const s = (this.head +
|
|
269
|
-
this.buffer[
|
|
265
|
+
const n = e.length;
|
|
266
|
+
this.head = (this.head - n + this.capacity) % this.capacity;
|
|
267
|
+
for (let i = 0; i < t; i++) {
|
|
268
|
+
const s = (this.head + n + i) % this.capacity, r = (this.head + i) % this.capacity;
|
|
269
|
+
this.buffer[r] = this.buffer[s];
|
|
270
270
|
}
|
|
271
|
-
for (let
|
|
272
|
-
const s = (this.head + t +
|
|
273
|
-
this.buffer[s] = e[
|
|
271
|
+
for (let i = 0; i < n; i++) {
|
|
272
|
+
const s = (this.head + t + i) % this.capacity;
|
|
273
|
+
this.buffer[s] = e[i];
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
shiftRightArray(t, e) {
|
|
277
|
-
const
|
|
278
|
-
for (let
|
|
279
|
-
const s = (this.head +
|
|
280
|
-
this.buffer[
|
|
277
|
+
const n = e.length;
|
|
278
|
+
for (let i = this.count - 1; i >= t; i--) {
|
|
279
|
+
const s = (this.head + i) % this.capacity, r = (this.head + i + n) % this.capacity;
|
|
280
|
+
this.buffer[r] = this.buffer[s];
|
|
281
281
|
}
|
|
282
|
-
for (let
|
|
283
|
-
const s = (this.head + t +
|
|
284
|
-
this.buffer[s] = e[
|
|
282
|
+
for (let i = 0; i < n; i++) {
|
|
283
|
+
const s = (this.head + t + i) % this.capacity;
|
|
284
|
+
this.buffer[s] = e[i];
|
|
285
285
|
}
|
|
286
|
-
this.tail = (this.tail +
|
|
286
|
+
this.tail = (this.tail + n) % this.capacity;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
let e =
|
|
291
|
-
const
|
|
292
|
-
let
|
|
293
|
-
const s = () => e,
|
|
294
|
-
if (
|
|
295
|
-
e =
|
|
289
|
+
function x(o, t = (e, n) => e === n) {
|
|
290
|
+
let e = o;
|
|
291
|
+
const n = /* @__PURE__ */ new Set();
|
|
292
|
+
let i = [];
|
|
293
|
+
const s = () => e, r = (f, m = !1) => {
|
|
294
|
+
if (m) {
|
|
295
|
+
e = f;
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
t(e,
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
},
|
|
302
|
-
|
|
298
|
+
t(e, f) || (e = f, n.forEach((p) => p(e)), i.forEach((p) => p(e)), i = []);
|
|
299
|
+
}, c = () => {
|
|
300
|
+
n.forEach((f) => f(e)), i.forEach((f) => f(e)), i = [];
|
|
301
|
+
}, d = (f) => (n.add(f), () => n.delete(f)), l = () => new Promise((f) => {
|
|
302
|
+
i.push(f);
|
|
303
303
|
});
|
|
304
304
|
return {
|
|
305
305
|
get: s,
|
|
306
|
-
set:
|
|
307
|
-
onChange:
|
|
308
|
-
nextChange:
|
|
309
|
-
triggerChange:
|
|
310
|
-
onChangePromise: (
|
|
311
|
-
let
|
|
306
|
+
set: r,
|
|
307
|
+
onChange: d,
|
|
308
|
+
nextChange: l,
|
|
309
|
+
triggerChange: c,
|
|
310
|
+
onChangePromise: (f) => {
|
|
311
|
+
let m = !0;
|
|
312
312
|
return (async () => {
|
|
313
|
-
for (;
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
316
|
-
|
|
313
|
+
for (; m; ) {
|
|
314
|
+
const I = await l();
|
|
315
|
+
if (!m) break;
|
|
316
|
+
f(I);
|
|
317
317
|
}
|
|
318
318
|
})(), () => {
|
|
319
|
-
|
|
319
|
+
m = !1;
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function E(
|
|
325
|
-
if (
|
|
326
|
-
for (const [e,
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
324
|
+
function E(o, t) {
|
|
325
|
+
if (o.size !== t.size) return !1;
|
|
326
|
+
for (const [e, n] of o.entries()) {
|
|
327
|
+
const i = t.get(e);
|
|
328
|
+
if (!i || !A(n, i))
|
|
329
329
|
return !1;
|
|
330
330
|
}
|
|
331
331
|
return !0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
if (
|
|
335
|
-
const e =
|
|
336
|
-
return e.x ===
|
|
333
|
+
function A(o, t) {
|
|
334
|
+
if (o.typNode !== t.typNode || o.nodName !== t.nodName || o.uidNode !== t.uidNode || o.nodPart !== t.nodPart) return !1;
|
|
335
|
+
const e = o.nodDims, n = t.nodDims;
|
|
336
|
+
return e.x === n.x && e.y === n.y && e.w === n.w && e.h === n.h;
|
|
337
337
|
}
|
|
338
|
+
const v = () => crypto.randomUUID(), T = {
|
|
339
|
+
set: (o, t) => setTimeout(o, t),
|
|
340
|
+
clear: (o) => clearTimeout(o)
|
|
341
|
+
}, u = {
|
|
342
|
+
createId: v,
|
|
343
|
+
timer: T,
|
|
344
|
+
root: void 0,
|
|
345
|
+
tree: null,
|
|
346
|
+
minW: 40,
|
|
347
|
+
minH: 40,
|
|
348
|
+
bond: 10,
|
|
349
|
+
inst: null
|
|
350
|
+
};
|
|
338
351
|
class a {
|
|
339
352
|
static cache = {
|
|
340
353
|
dimMins: /* @__PURE__ */ new Map(),
|
|
341
354
|
mapDirs: /* @__PURE__ */ new Map(),
|
|
342
355
|
tabCnts: /* @__PURE__ */ new Map(),
|
|
343
356
|
mapElem: /* @__PURE__ */ new Map(),
|
|
344
|
-
tabOpts:
|
|
357
|
+
tabOpts: x(
|
|
345
358
|
/* @__PURE__ */ new Map(),
|
|
346
359
|
E
|
|
347
360
|
),
|
|
348
|
-
nodOpts:
|
|
361
|
+
nodOpts: x(
|
|
349
362
|
/* @__PURE__ */ new Map(),
|
|
350
363
|
E
|
|
351
364
|
),
|
|
352
|
-
bndOpts:
|
|
365
|
+
bndOpts: x(
|
|
353
366
|
/* @__PURE__ */ new Map(),
|
|
354
367
|
E
|
|
355
368
|
)
|
|
356
369
|
};
|
|
357
|
-
kids = new
|
|
370
|
+
kids = new b();
|
|
358
371
|
dims = { w: 0, h: 0, x: 0, y: 0 };
|
|
359
372
|
unId;
|
|
360
373
|
next = null;
|
|
@@ -371,76 +384,73 @@ class a {
|
|
|
371
384
|
name: "",
|
|
372
385
|
part: 100,
|
|
373
386
|
dims: { w: 0, h: 0, x: 0, y: 0 },
|
|
374
|
-
unId:
|
|
387
|
+
unId: u.createId(),
|
|
375
388
|
open: ""
|
|
376
389
|
};
|
|
377
390
|
this.type = t.type ?? e.type, this.host = t.host ?? e.host, this.name = t.name ?? e.name, this.part = t.part ?? e.part, this.dims = t.dims ?? e.dims, this.open = t.open ?? e.open, this.unId = t.unId || e.unId;
|
|
378
391
|
}
|
|
379
392
|
addBond(t, e = null) {
|
|
380
393
|
if (!e) return;
|
|
381
|
-
const
|
|
382
|
-
a.cache.mapElem.set(
|
|
394
|
+
const n = new O(t, this, e);
|
|
395
|
+
a.cache.mapElem.set(n.unId, n);
|
|
383
396
|
}
|
|
384
397
|
getReqDimension() {
|
|
385
|
-
const t = a.cache.dimMins.get(this.unId), e = a.cache.tabCnts.get(this.unId),
|
|
398
|
+
const t = a.cache.dimMins.get(this.unId), e = a.cache.tabCnts.get(this.unId), n = Math.max(
|
|
386
399
|
t.minWidth,
|
|
387
|
-
e.horizontal *
|
|
388
|
-
),
|
|
400
|
+
e.horizontal * u.minW + Math.max(0, e.horizontal - 1) * u.bond
|
|
401
|
+
), i = Math.max(
|
|
389
402
|
t.minHeight,
|
|
390
|
-
e.vertical *
|
|
403
|
+
e.vertical * u.minH + Math.max(0, e.vertical - 1) * u.bond
|
|
391
404
|
);
|
|
392
405
|
return {
|
|
393
|
-
width:
|
|
394
|
-
height:
|
|
406
|
+
width: n,
|
|
407
|
+
height: i
|
|
395
408
|
};
|
|
396
409
|
}
|
|
397
410
|
calcDimensions() {
|
|
398
411
|
const t = a.cache.mapDirs.get(this.unId);
|
|
399
412
|
if (!this.kids) return;
|
|
400
413
|
let e = 0;
|
|
401
|
-
const
|
|
414
|
+
const n = a.cache.dimMins.get(this.unId) || {
|
|
402
415
|
minWidth: 0,
|
|
403
416
|
minHeight: 0
|
|
404
417
|
};
|
|
405
|
-
let
|
|
406
|
-
for (const
|
|
407
|
-
e +=
|
|
418
|
+
let i = 0;
|
|
419
|
+
for (const h of this.kids)
|
|
420
|
+
e += h.part;
|
|
408
421
|
if (e === 0) return;
|
|
409
422
|
let s;
|
|
410
|
-
t ? s = this.dims.w -
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
423
|
+
t ? s = this.dims.w - n.minWidth : s = this.dims.h - n.minHeight;
|
|
424
|
+
const r = s < 0, c = this.kids.peekBack();
|
|
425
|
+
let d = 0, l = 0;
|
|
426
|
+
for (const h of this.kids) {
|
|
427
|
+
const f = a.cache.dimMins.get(h.unId) || {
|
|
414
428
|
minWidth: 0,
|
|
415
429
|
minHeight: 0
|
|
416
430
|
};
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
t ? (o.dims.w = h.minWidth + d, o.dims.h = this.dims.h, o.dims.x = this.dims.x + n, o.dims.y = this.dims.y, n += o.dims.w + c._bond) : (o.dims.h = h.minHeight + d, o.dims.w = this.dims.w, o.dims.y = this.dims.y + n, o.dims.x = this.dims.x, n += o.dims.h + c._bond);
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
t ? (o.dims.w = h.minWidth + u, o.dims.h = this.dims.h, o.dims.x = this.dims.x + n, o.dims.y = this.dims.y, n += o.dims.w + c._bond) : (o.dims.h = h.minHeight + u, o.dims.w = this.dims.w, o.dims.y = this.dims.y + n, o.dims.x = this.dims.x, n += o.dims.h + c._bond), d -= u;
|
|
431
|
+
let m = 0;
|
|
432
|
+
if (!r) {
|
|
433
|
+
d += h.part;
|
|
434
|
+
const p = h === c ? s : Math.round(s * d / e);
|
|
435
|
+
m = p - l, l = p;
|
|
426
436
|
}
|
|
427
|
-
|
|
428
|
-
w:
|
|
429
|
-
h:
|
|
430
|
-
x:
|
|
431
|
-
y:
|
|
432
|
-
} :
|
|
433
|
-
w:
|
|
434
|
-
h:
|
|
435
|
-
x:
|
|
436
|
-
y:
|
|
437
|
+
t ? (h.dims.w = f.minWidth + m, h.dims.h = this.dims.h, h.dims.x = this.dims.x + i, h.dims.y = this.dims.y, i += h.dims.w + u.bond) : (h.dims.h = f.minHeight + m, h.dims.w = this.dims.w, h.dims.y = this.dims.y + i, h.dims.x = this.dims.x, i += h.dims.h + u.bond), h.next && (t ? h.next.dims = {
|
|
438
|
+
w: u.bond,
|
|
439
|
+
h: h.dims.h,
|
|
440
|
+
x: h.dims.x + h.dims.w,
|
|
441
|
+
y: h.dims.y
|
|
442
|
+
} : h.next.dims = {
|
|
443
|
+
w: h.dims.w,
|
|
444
|
+
h: u.bond,
|
|
445
|
+
x: h.dims.x,
|
|
446
|
+
y: h.dims.y + h.dims.h
|
|
437
447
|
});
|
|
438
448
|
}
|
|
439
449
|
}
|
|
440
450
|
toJSON() {
|
|
441
451
|
const t = [];
|
|
442
|
-
for (const
|
|
443
|
-
t.push(
|
|
452
|
+
for (const n of this.kids)
|
|
453
|
+
t.push(n.toJSON());
|
|
444
454
|
const e = {
|
|
445
455
|
typNode: this.type,
|
|
446
456
|
nodPart: this.part,
|
|
@@ -450,13 +460,493 @@ class a {
|
|
|
450
460
|
return this.open && (e.nodOpen = this.open), t.length > 0 && (e.nodKids = t), e;
|
|
451
461
|
}
|
|
452
462
|
}
|
|
453
|
-
class
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
463
|
+
class O {
|
|
464
|
+
dims = { w: 0, h: 0, x: 0, y: 0 };
|
|
465
|
+
unId = u.createId();
|
|
466
|
+
next = null;
|
|
467
|
+
prev = null;
|
|
468
|
+
host = null;
|
|
469
|
+
constructor(t = null, e = null, n = null) {
|
|
470
|
+
this.host = t, this.next = e, this.prev = n, this.next && (this.next.prev = this), this.prev && (this.prev.next = this);
|
|
471
|
+
}
|
|
472
|
+
toJSON() {
|
|
473
|
+
return {
|
|
474
|
+
nodName: this.host?.name || "",
|
|
475
|
+
typNode: "bond",
|
|
476
|
+
uidNode: this.unId,
|
|
477
|
+
nodPart: 0,
|
|
478
|
+
nodOpen: "",
|
|
479
|
+
nodKids: []
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function* S(o) {
|
|
484
|
+
const t = new b();
|
|
485
|
+
for (t.enqueue(o); !t.isEmpty(); ) {
|
|
486
|
+
const e = t.dequeue();
|
|
487
|
+
if (e && (yield e, e.nodKids && e.nodKids.length > 0))
|
|
488
|
+
for (const n of e.nodKids)
|
|
489
|
+
t.enqueue(n);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function* R(o) {
|
|
493
|
+
const t = new b();
|
|
494
|
+
for (t.enqueue(o); !t.isEmpty(); ) {
|
|
495
|
+
const e = t.dequeue();
|
|
496
|
+
if (e && (a.cache.mapElem.set(e.unId, e), yield e, e.kids.size() > 0))
|
|
497
|
+
for (const n of e.kids)
|
|
498
|
+
t.enqueue(n);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function* H(o, t) {
|
|
502
|
+
for (const e of t.kids)
|
|
503
|
+
yield* o.NodeLayoutRecursiveIterator(e);
|
|
504
|
+
yield t;
|
|
505
|
+
}
|
|
506
|
+
function q(o, t) {
|
|
507
|
+
const e = a.cache.mapDirs.get(t.unId);
|
|
508
|
+
if (e === void 0) {
|
|
509
|
+
console.warn(
|
|
510
|
+
`Cannot update child directions for node ${t.unId}; its own direction is not set.`
|
|
511
|
+
);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
for (const n of t.kids)
|
|
515
|
+
a.cache.mapDirs.set(n.unId, !e), n.kids.size() > 0 && (n.host = t, o.updateChildDirections(n), n.next && a.cache.mapDirs.set(n.next.unId, !e));
|
|
516
|
+
}
|
|
517
|
+
function B(o, t = u.tree) {
|
|
518
|
+
if (!t) return;
|
|
519
|
+
const e = o.JSONLayoutIterator(t), n = o.NodeLayoutIterator(u.root);
|
|
520
|
+
for (a.cache.mapDirs.set(u.root.unId, !0); ; ) {
|
|
521
|
+
const i = e.next(), s = n.next();
|
|
522
|
+
if (i.done || s.done)
|
|
523
|
+
break;
|
|
524
|
+
const r = i.value, c = s.value;
|
|
525
|
+
!r || !c || o.createNodeTreeFromJSONTree(r, c);
|
|
526
|
+
}
|
|
527
|
+
o.calcTabsetCountAndMinDim();
|
|
528
|
+
}
|
|
529
|
+
function M(o, t, e) {
|
|
530
|
+
const n = a.cache.mapDirs.get(e.unId);
|
|
531
|
+
for (const i of t.nodKids || []) {
|
|
532
|
+
const s = o.createNodeFromJSON(i), r = e.kids.peekBack();
|
|
533
|
+
s.host = e, s.addBond(s.host, r), e.kids.enqueue(s), a.cache.mapDirs.set(s.unId, !n);
|
|
534
|
+
}
|
|
535
|
+
e.type === "tabset" && a.cache.mapElem.set(e.unId, e), e.type === "tab" && a.cache.mapElem.set(e.unId, e);
|
|
536
|
+
}
|
|
537
|
+
function C(o, t, e = u.root) {
|
|
538
|
+
const n = new b();
|
|
539
|
+
for (n.enqueue(e), a.cache.mapDirs.set(u.root.unId, !0); !t.isEmpty(); ) {
|
|
540
|
+
const i = n.dequeue();
|
|
541
|
+
if (!i)
|
|
542
|
+
break;
|
|
543
|
+
const s = a.cache.mapDirs.get(i.unId);
|
|
544
|
+
if (t.size() == 2) {
|
|
545
|
+
const h = t.dequeue(), f = t.dequeue(), m = new a({ type: "tabset", host: i }), p = new a({ type: "tabset", host: i }), I = new a({
|
|
546
|
+
type: "tab",
|
|
547
|
+
host: m,
|
|
548
|
+
name: h,
|
|
549
|
+
unId: o.tabsIds.get(h ?? "") ?? u.createId()
|
|
550
|
+
}), y = new a({
|
|
551
|
+
type: "tab",
|
|
552
|
+
host: p,
|
|
553
|
+
name: f,
|
|
554
|
+
unId: o.tabsIds.get(f ?? "") ?? u.createId()
|
|
555
|
+
});
|
|
556
|
+
m.open = I.name, p.open = y.name, m.kids.enqueue(I), p.kids.enqueue(y), i.kids.enqueue(m), i.kids.enqueue(p), p.addBond(i, m), a.cache.mapDirs.set(m.unId, !s), a.cache.mapDirs.set(p.unId, !s), a.cache.mapElem.set(m.unId, m), a.cache.mapElem.set(p.unId, p), a.cache.mapDirs.set(I.unId, s), a.cache.mapDirs.set(y.unId, s), a.cache.mapElem.set(I.unId, I), a.cache.mapElem.set(y.unId, y);
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
const r = t.dequeue(), c = new a({ type: "tabset", host: i }), d = new a({ type: "row", host: i }), l = new a({
|
|
560
|
+
type: "tab",
|
|
561
|
+
host: c,
|
|
562
|
+
name: r,
|
|
563
|
+
unId: o.tabsIds.get(r ?? "") ?? u.createId()
|
|
564
|
+
});
|
|
565
|
+
c.open = l.name, c.kids.enqueue(l), i.kids.enqueue(c), i.kids.enqueue(d), d.addBond(i, c), a.cache.mapDirs.set(c.unId, !s), a.cache.mapDirs.set(d.unId, !s), a.cache.mapElem.set(c.unId, c), a.cache.mapDirs.set(l.unId, s), a.cache.mapElem.set(l.unId, l), n.enqueue(d);
|
|
566
|
+
}
|
|
567
|
+
o.calcTabsetCountAndMinDim();
|
|
568
|
+
}
|
|
569
|
+
function F(o, t) {
|
|
570
|
+
const e = new a({
|
|
571
|
+
type: t.typNode,
|
|
572
|
+
name: t.nodName,
|
|
573
|
+
unId: t.uidNode,
|
|
574
|
+
part: t.nodPart,
|
|
575
|
+
dims: { w: 0, h: 0, x: 0, y: 0 },
|
|
576
|
+
open: typeof t.nodOpen == "string" ? t.nodOpen : ""
|
|
577
|
+
});
|
|
578
|
+
return t.typNode === "tab" && (e.unId = o.tabsIds.get(t.nodName) || t.uidNode), e;
|
|
579
|
+
}
|
|
580
|
+
function W(o, t = u.root, e = !0) {
|
|
581
|
+
t === u.root && e && (a.cache.tabCnts.clear(), a.cache.dimMins.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear());
|
|
582
|
+
for (const n of o.NodeLayoutRecursiveIterator(t)) {
|
|
583
|
+
const i = a.cache.tabCnts, s = a.cache.dimMins;
|
|
584
|
+
a.cache.mapElem.set(n.unId, n);
|
|
585
|
+
const r = i.set(n.unId, {
|
|
586
|
+
horizontal: 0,
|
|
587
|
+
vertical: 0
|
|
588
|
+
}).get(n.unId), c = s.set(n.unId, {
|
|
589
|
+
minWidth: 0,
|
|
590
|
+
minHeight: 0
|
|
591
|
+
}).get(n.unId), d = a.cache.mapDirs.get(n.unId);
|
|
592
|
+
if (n.type === "tab" && (a.cache.mapElem.set(n.unId, n), s.set(n.unId, {
|
|
593
|
+
minWidth: 0,
|
|
594
|
+
minHeight: 0
|
|
595
|
+
})), n.next && a.cache.mapElem.set(n.next.unId, n.next), n.type === "tabset" && (a.cache.mapElem.set(n.unId, n), s.set(n.unId, {
|
|
596
|
+
minWidth: u.minW,
|
|
597
|
+
minHeight: u.minH
|
|
598
|
+
}), d ? i.set(n.unId, {
|
|
599
|
+
horizontal: 0,
|
|
600
|
+
vertical: 1
|
|
601
|
+
}) : i.set(n.unId, {
|
|
602
|
+
horizontal: 1,
|
|
603
|
+
vertical: 0
|
|
604
|
+
})), n.type === "row") {
|
|
605
|
+
for (const l of n.kids) {
|
|
606
|
+
const h = i.get(l.unId), f = s.get(l.unId);
|
|
607
|
+
h && (r.horizontal += h.horizontal, r.vertical += h.vertical, d ? (c.minHeight = Math.max(
|
|
608
|
+
c.minHeight,
|
|
609
|
+
f.minHeight
|
|
610
|
+
), c.minWidth += f.minWidth) : (c.minHeight += f.minHeight, c.minWidth = Math.max(
|
|
611
|
+
c.minWidth,
|
|
612
|
+
f.minWidth
|
|
613
|
+
)));
|
|
614
|
+
}
|
|
615
|
+
d ? c.minWidth += (n.kids.size() - 1) * u.bond : c.minHeight += (n.kids.size() - 1) * u.bond;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
t === u.root && e && o.pruneStaleDirections();
|
|
619
|
+
}
|
|
620
|
+
function L() {
|
|
621
|
+
for (const o of a.cache.mapDirs.keys())
|
|
622
|
+
a.cache.mapElem.has(o) || a.cache.mapDirs.delete(o);
|
|
623
|
+
}
|
|
624
|
+
function P() {
|
|
625
|
+
const o = u.root.getReqDimension();
|
|
626
|
+
let t = !1, e = u.root.dims.w, n = u.root.dims.h;
|
|
627
|
+
return u.root.dims.w < o.width && (e = o.width, t = !0), u.root.dims.h < o.height && (n = o.height, t = !0), t && (u.root.dims.w = e, u.root.dims.h = n), {
|
|
628
|
+
adjustedW: e,
|
|
629
|
+
adjustedH: n,
|
|
630
|
+
wasAdjusted: t
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function z(o, t = u.root, e = !1) {
|
|
634
|
+
const n = t === u.root, i = (d) => n ? /* @__PURE__ */ new Map() : new Map(d.get()), s = i(a.cache.nodOpts), r = i(a.cache.bndOpts), c = i(a.cache.tabOpts);
|
|
635
|
+
n && o.calculateRootAdjustment();
|
|
636
|
+
for (const d of o.NodeLayoutIterator(t)) {
|
|
637
|
+
d.calcDimensions();
|
|
638
|
+
const l = a.cache.mapDirs.get(d.unId);
|
|
639
|
+
if (d.type === "tabset") {
|
|
640
|
+
const h = {
|
|
641
|
+
typNode: d.type,
|
|
642
|
+
nodName: d.name,
|
|
643
|
+
uidNode: d.unId,
|
|
644
|
+
nodPart: d.part,
|
|
645
|
+
nodOpen: d.open,
|
|
646
|
+
nodeDir: l,
|
|
647
|
+
nodKids: Array.from(d.kids).map((f) => {
|
|
648
|
+
const m = {
|
|
649
|
+
typNode: f.type,
|
|
650
|
+
nodName: f.name,
|
|
651
|
+
uidNode: f.unId,
|
|
652
|
+
nodPart: f.part,
|
|
653
|
+
nodOpen: d.open === f.name,
|
|
654
|
+
nodeDir: !l,
|
|
655
|
+
nodDims: {
|
|
656
|
+
...d.dims
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
return c.set(f.unId, m), m;
|
|
660
|
+
}),
|
|
661
|
+
nodDims: {
|
|
662
|
+
...d.dims
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
s.set(d.unId, h);
|
|
666
|
+
}
|
|
667
|
+
if (d.next && d.type !== "tab") {
|
|
668
|
+
const h = {
|
|
669
|
+
typNode: "bond",
|
|
670
|
+
nodName: d.name,
|
|
671
|
+
uidNode: d.next.unId,
|
|
672
|
+
nodeDir: l,
|
|
673
|
+
nodPart: 0,
|
|
674
|
+
nodDims: {
|
|
675
|
+
...d.next.dims
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
r.set(d.next.unId, h);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
a.cache.nodOpts.set(s, e), a.cache.bndOpts.set(r, e), a.cache.tabOpts.set(c, e);
|
|
682
|
+
}
|
|
683
|
+
function K(o, t, e = !1, n = 2) {
|
|
684
|
+
if (u.root.dims = t, e) {
|
|
685
|
+
o.calcDimensions(u.root);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
o.cntdown && (u.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = u.timer.set(() => {
|
|
689
|
+
o.cntdown = null, o.calcDimensions();
|
|
690
|
+
}, n);
|
|
691
|
+
}
|
|
692
|
+
function U(o, t, e, n = !1, i = 2) {
|
|
693
|
+
if (n) {
|
|
694
|
+
o.updateSliderDimension(t, e);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
o.cntdown && (u.timer.clear(o.cntdown), o.cntdown = null), o.cntdown = u.timer.set(() => {
|
|
698
|
+
o.cntdown = null, o.updateSliderDimension(t, e);
|
|
699
|
+
}, i);
|
|
700
|
+
}
|
|
701
|
+
function $(o, t, e) {
|
|
702
|
+
const n = a.cache.mapElem.get(t);
|
|
703
|
+
if (!n || !(n instanceof O)) {
|
|
704
|
+
console.warn(`Bond with id ${t} not found or is not a Bond instance`);
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
const i = a.cache.mapDirs.get(n.host.unId), s = n.prev, r = n.next, c = n.host;
|
|
708
|
+
if (!s || !r || !c) {
|
|
709
|
+
console.warn("Missing prev, next, or host node", s, r, c);
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
const d = a.cache.dimMins.get(s.unId) || {
|
|
713
|
+
minWidth: 0,
|
|
714
|
+
minHeight: 0
|
|
715
|
+
}, l = a.cache.dimMins.get(r.unId) || {
|
|
716
|
+
minWidth: 0,
|
|
717
|
+
minHeight: 0
|
|
718
|
+
}, h = u.bond / 2;
|
|
719
|
+
if (i) {
|
|
720
|
+
const f = r.dims.x + r.dims.w, m = s.dims.x + d.minWidth + h, p = f - l.minWidth - h, I = Math.max(m, Math.min(p, e.x));
|
|
721
|
+
n.dims.x = I - h, s.dims.w = n.dims.x - s.dims.x, r.dims.x = I + h, r.dims.w = f - r.dims.x;
|
|
722
|
+
const y = Math.max(0, s.dims.w - d.minWidth), g = Math.max(0, r.dims.w - l.minWidth), N = y + g, k = s.part + r.part;
|
|
723
|
+
N > 0 ? (s.part = y / N * k, r.part = g / N * k) : (s.part = k / 2, r.part = k / 2);
|
|
724
|
+
} else {
|
|
725
|
+
const f = r.dims.y + r.dims.h, m = s.dims.y + d.minHeight + h, p = f - l.minHeight - h, I = Math.max(m, Math.min(p, e.y));
|
|
726
|
+
n.dims.y = I - h, s.dims.h = n.dims.y - s.dims.y, r.dims.y = I + h, r.dims.h = f - r.dims.y;
|
|
727
|
+
const y = Math.max(0, s.dims.h - d.minHeight), g = Math.max(0, r.dims.h - l.minHeight), N = y + g, k = s.part + r.part;
|
|
728
|
+
N > 0 ? (s.part = y / N * k, r.part = g / N * k) : (s.part = k / 2, r.part = k / 2);
|
|
729
|
+
}
|
|
730
|
+
o.calcDimensions(c);
|
|
731
|
+
}
|
|
732
|
+
function _(o, t, e, n) {
|
|
733
|
+
const i = a.cache.mapElem.get(t);
|
|
734
|
+
let s = a.cache.mapElem.get(e);
|
|
735
|
+
return !i || !(i instanceof a) || !s || !(s instanceof a) ? (console.warn(`Source node ${t} not found or is not a Node instance`), !1) : i?.type == "tab" && i.host === s && s.kids.size() < 2 ? (console.warn("Cannot move to self as it has only one tab"), !1) : i?.type == "tabset" && s?.host === i ? (console.warn("Cannot move tabset to self as it is already a child"), !1) : !i || !s ? (console.warn(`Source or destination node not found: ${t}, ${e}`), !1) : i === s ? (console.warn(
|
|
736
|
+
"Source and destination nodes are the same, no action taken."
|
|
737
|
+
), !1) : !i.host || !s.host && s.type !== "row" ? (console.warn(
|
|
738
|
+
`Source node or destination node's host is null: ${i.unId}, ${s.unId}`
|
|
739
|
+
), !1) : s.type === "row" && s !== u.root ? (console.warn(`Cannot move relative to a nested row: ${s.unId}`), !1) : s.type === "row" && n === "contain" ? (console.warn(
|
|
740
|
+
`Cannot move to a row with 'contain' layout: ${s.unId}`
|
|
741
|
+
), !1) : i.type === "row" || (s.type === "tabset" && n === "contain" && (s = s.kids.peekBack() || s), i === s) ? !1 : o.isOnlyContent(i) ? (console.warn("Cannot move the only tabset or tab in the layout"), !1) : (s.type === "tab" && (n === "contain" || n === "left" || n === "right") ? o.moveNodeAsTab(i, s, n) : s.type === "row" && n !== "contain" ? o.moveRelativeToRoot(i, s, n) : s.type === "tabset" && n !== "contain" && o.moveRelativeToTabset(i, s, n), o.calcTabsetCountAndMinDim(), o.calcDimensions(u.root, !0), !0);
|
|
742
|
+
}
|
|
743
|
+
function Y(o, t) {
|
|
744
|
+
let e = 0;
|
|
745
|
+
for (const n of o.NodeLayoutRecursiveIterator(u.root))
|
|
746
|
+
n.type === "tabset" && e++;
|
|
747
|
+
return e !== 1 ? !1 : t.type === "tabset" || t.type === "tab" && t.host?.kids.size() === 1;
|
|
748
|
+
}
|
|
749
|
+
function G(o, t, e, n) {
|
|
750
|
+
if (!e || !e.host) {
|
|
751
|
+
console.warn(`Destination node ${e.unId} has no host, cannot move.`);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
o.removeNode(t);
|
|
755
|
+
const i = e.host, s = i.kids.indexOf(e);
|
|
756
|
+
if (s === void 0 || s === -1)
|
|
757
|
+
return;
|
|
758
|
+
const r = n === "contain" || n === "left", c = r ? s : s + 1, d = i.kids.get(c + 1), l = i.kids.get(c - 1), h = e.next, f = e.prev;
|
|
759
|
+
if (!r && h ? a.cache.mapElem.delete(h.unId) : r && f && a.cache.mapElem.delete(f.unId), t.type == "tab")
|
|
760
|
+
r ? (l && t.addBond(i, l), e.addBond(i, t)) : (t.addBond(i, e), d && d.addBond(i, t)), i.kids.insert(c, t), t.host = i, i.open = t.name;
|
|
761
|
+
else if (t.type == "tabset") {
|
|
762
|
+
const m = t.kids.peek(), p = t.kids.peekBack();
|
|
763
|
+
r ? (m && l && m.addBond(i, l), p && e && e.addBond(i, p)) : (m && e && m.addBond(i, e), p && d && d.addBond(i, p)), i.kids.insertQueue(c, t.kids);
|
|
764
|
+
for (const I of t.kids)
|
|
765
|
+
I.host = i, I.next && (I.next.host = i);
|
|
766
|
+
i.open = p ? p.name : "";
|
|
767
|
+
}
|
|
768
|
+
o.updateChildDirections(i);
|
|
769
|
+
}
|
|
770
|
+
const J = {
|
|
771
|
+
root: (o, t) => o === t,
|
|
772
|
+
tabset: (o, t) => o !== t
|
|
773
|
+
};
|
|
774
|
+
function D(o, t, e, n, i) {
|
|
775
|
+
if (o.removeNode(t), t.type !== "tab" && t.type !== "tabset") return;
|
|
776
|
+
const s = a.cache.mapDirs.get(e.unId) === !1, r = n === "left" || n === "right", c = n === "top" || n === "left";
|
|
777
|
+
let d = t;
|
|
778
|
+
t.type === "tab" && (d = new a({ type: "tabset", host: e.host }), d.kids.enqueue(t), d.open = t.name, t.host = d), J[i](s, r) ? o.insertNodeWithNewParent(d, e, c) : o.insertNode(e, d, c);
|
|
779
|
+
}
|
|
780
|
+
function Q(o, t, e, n) {
|
|
781
|
+
D(o, t, e, n, "root");
|
|
782
|
+
}
|
|
783
|
+
function j(o, t, e, n) {
|
|
784
|
+
D(o, t, e, n, "tabset");
|
|
785
|
+
}
|
|
786
|
+
function X(o, t, e, n) {
|
|
787
|
+
const i = t.host;
|
|
788
|
+
if (t == u.root) {
|
|
789
|
+
const f = u.root.kids.peek(), m = u.root.kids.peekBack();
|
|
790
|
+
n ? (u.root.kids.enqueueFront(e), f && f.addBond(u.root, e)) : (u.root.kids.enqueue(e), m && e.addBond(u.root, m)), e.host = u.root, o.updateChildDirections(u.root);
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
if (!i) {
|
|
794
|
+
console.warn(`Destination node ${t.unId} has no host, cannot insert.`);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const s = i.kids.indexOf(t);
|
|
798
|
+
if (s === -1) {
|
|
799
|
+
console.warn(
|
|
800
|
+
`Destination node ${t.unId} not found in its host's kids.`
|
|
801
|
+
);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
const r = a.cache.mapDirs.get(i.unId);
|
|
805
|
+
r && a.cache.mapDirs.set(e.unId, !r);
|
|
806
|
+
const c = i.kids.get(s + 1), d = i.kids.get(s - 1), l = t.next, h = t.prev;
|
|
807
|
+
e.host = i, n ? (i.kids.insert(s, e), t.addBond(i, e), d && e.addBond(i, d), h && a.cache.mapElem.delete(h.unId)) : (i.kids.insert(s + 1, e), e.addBond(i, t), c && c.addBond(i, e), l && a.cache.mapElem.delete(l.unId)), o.updateChildDirections(i);
|
|
808
|
+
}
|
|
809
|
+
function V(o, t, e, n) {
|
|
810
|
+
const i = new b(), s = new a({ type: "tabset", host: e.host });
|
|
811
|
+
if (!e || !t) {
|
|
812
|
+
console.warn(`Destination node ${e.unId} has no host, cannot insert.`);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (e === u.root) {
|
|
816
|
+
const c = new a({ type: "row", host: e });
|
|
817
|
+
if (e.kids.size() === 0)
|
|
818
|
+
e.kids.enqueue(t), t.host = e;
|
|
819
|
+
else if (e.kids.size() == 1 && e.kids.peek()?.type === "tabset") {
|
|
820
|
+
const d = e.kids.dequeue();
|
|
821
|
+
if (!d) {
|
|
822
|
+
console.warn(
|
|
823
|
+
`No kid found in destination node ${e.unId}, cannot insert.`
|
|
824
|
+
);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
n ? (c.kids.enqueue(t), c.kids.enqueue(d), e.kids.enqueue(c), d.addBond(c, t)) : (c.kids.enqueue(d), c.kids.enqueue(t), t.addBond(c, d), e.kids.enqueue(c)), t.host = c, d.host = c;
|
|
828
|
+
} else if (e.kids.size() == 1 && e.kids.peek()?.type === "row") {
|
|
829
|
+
const d = e.kids.peek(), l = d?.kids.peek(), h = d?.kids.peekBack();
|
|
830
|
+
n && d ? (d.kids.enqueueFront(t), l && l.addBond(d, t)) : d && (d.kids.enqueue(t), h && t.addBond(d, h)), t.host = d;
|
|
831
|
+
} else if (e.kids.size() > 1) {
|
|
832
|
+
const d = new a({ type: "row", host: e }), l = new a({ type: "row", host: d });
|
|
833
|
+
for (const h of e.kids)
|
|
834
|
+
l.kids.enqueue(h), h.host = l, h.next && (h.next.host = l);
|
|
835
|
+
t.host = d, e.kids.clear(), n ? (d.kids.enqueueFront(t), d.kids.enqueue(l), l.addBond(d, t)) : (d.kids.enqueue(l), d.kids.enqueue(t), t.addBond(d, l)), e.kids.enqueue(d);
|
|
836
|
+
}
|
|
837
|
+
o.updateChildDirections(e);
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
t.host = e, s.host = e, s.kids = e.kids, s.open = e.open;
|
|
841
|
+
const r = a.cache.mapDirs.get(e.unId);
|
|
842
|
+
for (const c of s.kids)
|
|
843
|
+
c.host = s, c.next && (c.next.host = s), a.cache.mapDirs.set(c.unId, r);
|
|
844
|
+
for (const c of t.kids)
|
|
845
|
+
c.host = t, c.next && (c.next.host = t), a.cache.mapDirs.set(c.unId, r);
|
|
846
|
+
a.cache.mapDirs.set(s.unId, !r), a.cache.mapDirs.set(t.unId, !r), n ? (i.enqueue(t), i.enqueue(s), e.kids = i, e.type = "row", s.addBond(e, t)) : (i.enqueue(s), i.enqueue(t), e.kids = i, e.type = "row", t.addBond(e, s));
|
|
847
|
+
}
|
|
848
|
+
function Z(o, t) {
|
|
849
|
+
if (!t.host || !t.host.host) {
|
|
850
|
+
console.warn(`Source node ${t.unId} has no host, cannot move.`);
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
const e = t.host, n = t.host.host, i = n.kids.indexOf(e), s = n.kids.get(i - 1), r = n.kids.get(i + 1), c = t.kids.peek(), d = t.kids.peekBack();
|
|
854
|
+
o.removeKid(e);
|
|
855
|
+
let l = i;
|
|
856
|
+
if (t.type == "row" && e) {
|
|
857
|
+
s && c && c.addBond(n, s), r && d && r.addBond(n, d);
|
|
858
|
+
for (const h of t.kids)
|
|
859
|
+
h.host = n, h.next && (h.next.host = n), n.kids.insert(l, h), a.cache.mapDirs.set(
|
|
860
|
+
h.unId,
|
|
861
|
+
!a.cache.mapDirs.get(n.unId)
|
|
862
|
+
), a.cache.dimMins.delete(h.unId), l++;
|
|
863
|
+
} else if (t.type == "tabset") {
|
|
864
|
+
s && t.addBond(n, s), r && r.addBond(n, t), n.kids.insert(l, t), t.host = n, a.cache.mapDirs.set(t.unId, !a.cache.mapDirs.get(n.unId));
|
|
865
|
+
for (const h of t.kids)
|
|
866
|
+
a.cache.mapDirs.set(
|
|
867
|
+
h.unId,
|
|
868
|
+
a.cache.mapDirs.get(n.unId)
|
|
869
|
+
), a.cache.dimMins.delete(h.unId);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function tt(o, t = !0) {
|
|
873
|
+
const e = o.host, n = o.prev, i = o.next;
|
|
874
|
+
if (o.host = null, o.next = null, o.prev = null, n && (n.next = null), i && (i.prev = null), !t)
|
|
875
|
+
return o;
|
|
876
|
+
n && i && n.prev && i.next ? n.prev.addBond(e, i.next) : n && n.prev ? n.prev.next = null : i && i.next && (i.next.prev = null);
|
|
877
|
+
}
|
|
878
|
+
function et(o, t) {
|
|
879
|
+
if (!t.host) {
|
|
880
|
+
console.warn("Kid node has no host, cannot remove.");
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const e = t?.host, n = e?.host;
|
|
884
|
+
if (o.removeKid(t), t.type === "tabset" && e.kids.size() === 1) {
|
|
885
|
+
const i = e.kids.peek();
|
|
886
|
+
i && o.moveAdjacentNodeToGrandParent(i);
|
|
887
|
+
} else if (t.type === "tab" && e.kids.size() === 0 && n.kids.size() === 2) {
|
|
888
|
+
o.removeKid(e);
|
|
889
|
+
const i = n?.kids.peek();
|
|
890
|
+
i && o.moveAdjacentNodeToGrandParent(i);
|
|
891
|
+
} else if (t.type === "tab" && e.kids.size() === 0 && n.kids.size() > 2)
|
|
892
|
+
o.removeKid(e);
|
|
893
|
+
else if (t.type === "tab" && e.open === t.name && e.kids.size() > 0) {
|
|
894
|
+
const i = e.kids.peek();
|
|
895
|
+
i && (e.open = i.name);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
function nt(o) {
|
|
899
|
+
if (!o.host) {
|
|
900
|
+
console.warn("Kid node has no host, cannot remove.");
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
const t = o.host, e = t.kids.indexOf(o), n = t.kids.get(e + 1), i = t.kids.get(e - 1), s = o.next, r = o.prev;
|
|
904
|
+
if (e === -1) {
|
|
905
|
+
console.warn("Kid node not found in its host's kids.");
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
s && a.cache.mapElem.delete(s.unId), r && a.cache.mapElem.delete(r.unId), n && i ? n.addBond(t, i) : n ? n.prev = null : i && (i.next = null), t.kids.removeAt(e), a.cache.mapElem.delete(o.unId), a.cache.dimMins.delete(o.unId), a.cache.mapDirs.delete(o.unId), a.cache.tabCnts.delete(o.unId), o.type === "tabset" && a.cache.mapElem.delete(o.unId), o.type === "tab" && a.cache.mapElem.delete(o.unId), o.host = null, o.next = null, o.prev = null;
|
|
909
|
+
}
|
|
910
|
+
function it() {
|
|
911
|
+
a.cache.dimMins.clear(), a.cache.mapDirs.clear(), a.cache.tabCnts.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear();
|
|
912
|
+
}
|
|
913
|
+
class w {
|
|
914
|
+
static get _root() {
|
|
915
|
+
return u.root;
|
|
916
|
+
}
|
|
917
|
+
static set _root(t) {
|
|
918
|
+
u.root = t;
|
|
919
|
+
}
|
|
920
|
+
static get _tree() {
|
|
921
|
+
return u.tree;
|
|
922
|
+
}
|
|
923
|
+
static set _tree(t) {
|
|
924
|
+
u.tree = t;
|
|
925
|
+
}
|
|
926
|
+
static get _minW() {
|
|
927
|
+
return u.minW;
|
|
928
|
+
}
|
|
929
|
+
static set _minW(t) {
|
|
930
|
+
u.minW = t;
|
|
931
|
+
}
|
|
932
|
+
static get _minH() {
|
|
933
|
+
return u.minH;
|
|
934
|
+
}
|
|
935
|
+
static set _minH(t) {
|
|
936
|
+
u.minH = t;
|
|
937
|
+
}
|
|
938
|
+
static get _bond() {
|
|
939
|
+
return u.bond;
|
|
940
|
+
}
|
|
941
|
+
static set _bond(t) {
|
|
942
|
+
u.bond = t;
|
|
943
|
+
}
|
|
944
|
+
static get _inst() {
|
|
945
|
+
return u.inst;
|
|
946
|
+
}
|
|
947
|
+
static set _inst(t) {
|
|
948
|
+
u.inst = t;
|
|
949
|
+
}
|
|
460
950
|
nodeOps;
|
|
461
951
|
cntdown = null;
|
|
462
952
|
tabsIds = /* @__PURE__ */ new Map();
|
|
@@ -471,482 +961,222 @@ class c {
|
|
|
471
961
|
tabsIds: /* @__PURE__ */ new Map(),
|
|
472
962
|
...t
|
|
473
963
|
};
|
|
474
|
-
this.tabsIds = e.tabsIds, e.
|
|
964
|
+
this.tabsIds = e.tabsIds, u.createId = e.createId ?? v, u.timer = e.timer ?? T, w._tree = e.tree ?? null, w._root = new a({
|
|
475
965
|
unId: e.uqid,
|
|
476
966
|
name: e.uqid,
|
|
477
967
|
type: "row"
|
|
478
|
-
}), this.nodeOps =
|
|
968
|
+
}), this.nodeOps = x(
|
|
479
969
|
/* @__PURE__ */ new Map(),
|
|
480
970
|
E
|
|
481
|
-
),
|
|
482
|
-
const
|
|
483
|
-
|
|
971
|
+
), w._minW = e.minW, w._minH = e.minH, w._bond = e.bond;
|
|
972
|
+
const n = new b(e.tabs.length, e.tabs);
|
|
973
|
+
w._tree ? this.createNodeLayout() : this.createBinaryNodeTreeFromQueue(n), w._inst = this;
|
|
484
974
|
}
|
|
485
975
|
*JSONLayoutIterator(t) {
|
|
486
|
-
|
|
487
|
-
for (e.enqueue(t); !e.isEmpty(); ) {
|
|
488
|
-
const i = e.dequeue();
|
|
489
|
-
if (i && (yield i, i.nodKids && i.nodKids.length > 0))
|
|
490
|
-
for (const n of i.nodKids)
|
|
491
|
-
e.enqueue(n);
|
|
492
|
-
}
|
|
976
|
+
yield* S(t);
|
|
493
977
|
}
|
|
494
978
|
*NodeLayoutIterator(t) {
|
|
495
|
-
|
|
496
|
-
for (e.enqueue(t); !e.isEmpty(); ) {
|
|
497
|
-
const i = e.dequeue();
|
|
498
|
-
if (i && (a.cache.mapElem.set(i.unId, i), yield i, i.kids.size() > 0))
|
|
499
|
-
for (const n of i.kids)
|
|
500
|
-
e.enqueue(n);
|
|
501
|
-
}
|
|
979
|
+
yield* R(t);
|
|
502
980
|
}
|
|
503
981
|
*NodeLayoutRecursiveIterator(t) {
|
|
504
|
-
|
|
505
|
-
yield* this.NodeLayoutRecursiveIterator(e);
|
|
506
|
-
yield t;
|
|
982
|
+
yield* H(this, t);
|
|
507
983
|
}
|
|
508
984
|
updateChildDirections(t) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
);
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
for (const i of t.kids)
|
|
517
|
-
a.cache.mapDirs.set(i.unId, !e), i.kids.size() > 0 && (i.host = t, this.updateChildDirections(i), i.next && a.cache.mapDirs.set(i.next.unId, !e));
|
|
518
|
-
}
|
|
519
|
-
createNodeLayout(t = c._tree) {
|
|
520
|
-
const e = this.JSONLayoutIterator(t), i = this.NodeLayoutIterator(c._root);
|
|
521
|
-
for (a.cache.mapDirs.set(c._root.unId, !0); ; ) {
|
|
522
|
-
const n = e.next(), s = i.next();
|
|
523
|
-
if (n.done || s.done)
|
|
524
|
-
break;
|
|
525
|
-
const d = n.value, o = s.value;
|
|
526
|
-
!d || !o || this.createNodeTreeFromJSONTree(d, o);
|
|
527
|
-
}
|
|
528
|
-
this.calcTabsetCountAndMinDim();
|
|
985
|
+
return q(this, t);
|
|
986
|
+
}
|
|
987
|
+
createNodeLayout(t = w._tree) {
|
|
988
|
+
return B(this, t);
|
|
529
989
|
}
|
|
530
990
|
createNodeTreeFromJSONTree(t, e) {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
e.type === "tabset" && a.cache.mapElem.set(e.unId, e), e.type === "tab" && a.cache.mapElem.set(e.unId, e);
|
|
537
|
-
}
|
|
538
|
-
createBinaryNodeTreeFromQueue(t, e = c._root) {
|
|
539
|
-
const i = new N();
|
|
540
|
-
for (i.enqueue(e), a.cache.mapDirs.set(c._root.unId, !0); !t.isEmpty(); ) {
|
|
541
|
-
const n = i.dequeue();
|
|
542
|
-
if (!n)
|
|
543
|
-
break;
|
|
544
|
-
const s = a.cache.mapDirs.get(n.unId);
|
|
545
|
-
if (t.size() == 2) {
|
|
546
|
-
const u = t.dequeue(), l = t.dequeue(), f = new a({ type: "tabset", host: n }), m = new a({ type: "tabset", host: n }), p = new a({
|
|
547
|
-
type: "tab",
|
|
548
|
-
host: f,
|
|
549
|
-
name: u,
|
|
550
|
-
unId: this.tabsIds.get(u ?? "") ?? crypto.randomUUID()
|
|
551
|
-
}), w = new a({
|
|
552
|
-
type: "tab",
|
|
553
|
-
host: m,
|
|
554
|
-
name: l,
|
|
555
|
-
unId: this.tabsIds.get(l ?? "") ?? crypto.randomUUID()
|
|
556
|
-
});
|
|
557
|
-
f.open = p.name, m.open = w.name, f.kids.enqueue(p), m.kids.enqueue(w), n.kids.enqueue(f), n.kids.enqueue(m), m.addBond(n, f), a.cache.mapDirs.set(f.unId, !s), a.cache.mapDirs.set(m.unId, !s), a.cache.mapElem.set(f.unId, f), a.cache.mapElem.set(m.unId, m), a.cache.mapDirs.set(p.unId, s), a.cache.mapDirs.set(w.unId, s), a.cache.mapElem.set(p.unId, p), a.cache.mapElem.set(w.unId, w);
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
const d = t.dequeue(), o = new a({ type: "tabset", host: n }), h = new a({ type: "row", host: n }), r = new a({
|
|
561
|
-
type: "tab",
|
|
562
|
-
host: o,
|
|
563
|
-
name: d,
|
|
564
|
-
unId: this.tabsIds.get(d ?? "") ?? crypto.randomUUID()
|
|
565
|
-
});
|
|
566
|
-
o.open = r.name, o.kids.enqueue(r), n.kids.enqueue(o), n.kids.enqueue(h), h.addBond(n, o), a.cache.mapDirs.set(o.unId, !s), a.cache.mapDirs.set(h.unId, !s), a.cache.mapElem.set(o.unId, o), a.cache.mapDirs.set(r.unId, s), a.cache.mapElem.set(r.unId, r), i.enqueue(h);
|
|
567
|
-
}
|
|
568
|
-
this.calcTabsetCountAndMinDim();
|
|
991
|
+
return M(this, t, e);
|
|
992
|
+
}
|
|
993
|
+
createBinaryNodeTreeFromQueue(t, e = w._root) {
|
|
994
|
+
return C(this, t, e);
|
|
569
995
|
}
|
|
570
996
|
createNodeFromJSON(t) {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
});
|
|
579
|
-
return t.typNode === "tab" && (e.unId = this.tabsIds.get(t.nodName) || t.uidNode), e;
|
|
580
|
-
}
|
|
581
|
-
calcTabsetCountAndMinDim(t = c._root, e = !0) {
|
|
582
|
-
t === c._root && e && (a.cache.tabCnts.clear(), a.cache.dimMins.clear(), a.cache.mapElem.clear(), a.cache.mapElem.clear(), a.cache.mapElem.clear(), a.cache.mapElem.clear(), a.cache.nodOpts.get().clear(), a.cache.bndOpts.get().clear());
|
|
583
|
-
for (const i of this.NodeLayoutRecursiveIterator(t)) {
|
|
584
|
-
const n = a.cache.tabCnts, s = a.cache.dimMins;
|
|
585
|
-
a.cache.mapElem.set(i.unId, i);
|
|
586
|
-
const d = n.set(i.unId, {
|
|
587
|
-
horizontal: 0,
|
|
588
|
-
vertical: 0
|
|
589
|
-
}).get(i.unId), o = s.set(i.unId, {
|
|
590
|
-
minWidth: 0,
|
|
591
|
-
minHeight: 0
|
|
592
|
-
}).get(i.unId), h = a.cache.mapDirs.get(i.unId);
|
|
593
|
-
if (i.type === "tab" && (a.cache.mapElem.set(i.unId, i), s.set(i.unId, {
|
|
594
|
-
minWidth: 0,
|
|
595
|
-
minHeight: 0
|
|
596
|
-
})), i.next && a.cache.mapElem.set(i.next.unId, i.next), i.type === "tabset" && (a.cache.mapElem.set(i.unId, i), s.set(i.unId, {
|
|
597
|
-
minWidth: c._minW,
|
|
598
|
-
minHeight: c._minH
|
|
599
|
-
}), h ? n.set(i.unId, {
|
|
600
|
-
horizontal: 0,
|
|
601
|
-
vertical: 1
|
|
602
|
-
}) : n.set(i.unId, {
|
|
603
|
-
horizontal: 1,
|
|
604
|
-
vertical: 0
|
|
605
|
-
})), i.type === "row") {
|
|
606
|
-
for (const r of i.kids) {
|
|
607
|
-
const u = n.get(r.unId), l = s.get(r.unId);
|
|
608
|
-
u && (d.horizontal += u.horizontal, d.vertical += u.vertical, h ? (o.minHeight = Math.max(
|
|
609
|
-
o.minHeight,
|
|
610
|
-
l.minHeight
|
|
611
|
-
), o.minWidth += l.minWidth) : (o.minHeight += l.minHeight, o.minWidth = Math.max(
|
|
612
|
-
o.minWidth,
|
|
613
|
-
l.minWidth
|
|
614
|
-
)));
|
|
615
|
-
}
|
|
616
|
-
h ? o.minWidth += (i.kids.size() - 1) * c._bond : o.minHeight += (i.kids.size() - 1) * c._bond;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
997
|
+
return F(this, t);
|
|
998
|
+
}
|
|
999
|
+
calcTabsetCountAndMinDim(t = w._root, e = !0) {
|
|
1000
|
+
return W(this, t, e);
|
|
1001
|
+
}
|
|
1002
|
+
pruneStaleDirections() {
|
|
1003
|
+
return L();
|
|
619
1004
|
}
|
|
620
1005
|
calculateRootAdjustment() {
|
|
621
|
-
|
|
622
|
-
let e = !1, i = c._root.dims.w, n = c._root.dims.h;
|
|
623
|
-
return c._root.dims.w < t.width && (i = t.width, e = !0), c._root.dims.h < t.height && (n = t.height, e = !0), e && (c._root.dims.w = i, c._root.dims.h = n), {
|
|
624
|
-
adjustedW: i,
|
|
625
|
-
adjustedH: n,
|
|
626
|
-
wasAdjusted: e
|
|
627
|
-
};
|
|
1006
|
+
return P();
|
|
628
1007
|
}
|
|
629
|
-
calcDimensions(t =
|
|
630
|
-
|
|
631
|
-
t === c._root && this.calculateRootAdjustment();
|
|
632
|
-
for (const d of this.NodeLayoutIterator(t)) {
|
|
633
|
-
d.calcDimensions();
|
|
634
|
-
const o = a.cache.mapDirs.get(d.unId);
|
|
635
|
-
if (d.type === "tabset") {
|
|
636
|
-
const h = {
|
|
637
|
-
typNode: d.type,
|
|
638
|
-
nodName: d.name,
|
|
639
|
-
uidNode: d.unId,
|
|
640
|
-
nodPart: d.part,
|
|
641
|
-
nodOpen: d.open,
|
|
642
|
-
nodeDir: o,
|
|
643
|
-
nodKids: Array.from(d.kids).map((r) => {
|
|
644
|
-
const u = {
|
|
645
|
-
typNode: r.type,
|
|
646
|
-
nodName: r.name,
|
|
647
|
-
uidNode: r.unId,
|
|
648
|
-
nodPart: r.part,
|
|
649
|
-
nodOpen: d.open === r.name,
|
|
650
|
-
nodeDir: !o,
|
|
651
|
-
nodDims: {
|
|
652
|
-
...d.dims
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
return s.set(r.unId, u), u;
|
|
656
|
-
}),
|
|
657
|
-
nodDims: {
|
|
658
|
-
...d.dims
|
|
659
|
-
}
|
|
660
|
-
};
|
|
661
|
-
i.set(d.unId, h);
|
|
662
|
-
}
|
|
663
|
-
if (d.next && d.type !== "tab") {
|
|
664
|
-
const h = {
|
|
665
|
-
typNode: "bond",
|
|
666
|
-
nodName: d.name,
|
|
667
|
-
uidNode: d.next.unId,
|
|
668
|
-
nodeDir: o,
|
|
669
|
-
nodPart: 0,
|
|
670
|
-
nodDims: {
|
|
671
|
-
...d.next.dims
|
|
672
|
-
}
|
|
673
|
-
};
|
|
674
|
-
n.set(d.next.unId, h);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
a.cache.nodOpts.set(i, e), a.cache.bndOpts.set(n, e), a.cache.tabOpts.set(s, e);
|
|
1008
|
+
calcDimensions(t = w._root, e = !1) {
|
|
1009
|
+
return z(this, t, e);
|
|
678
1010
|
}
|
|
679
|
-
updateDimension(t, e = !1,
|
|
680
|
-
|
|
681
|
-
this.calcDimensions(c._root);
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
this.cntdown && (clearTimeout(this.cntdown), this.cntdown = null), this.cntdown = setTimeout(() => {
|
|
685
|
-
this.cntdown = null, this.calcDimensions();
|
|
686
|
-
}, i);
|
|
1011
|
+
updateDimension(t, e = !1, n = 2) {
|
|
1012
|
+
return K(this, t, e, n);
|
|
687
1013
|
}
|
|
688
|
-
updateSlider(t, e,
|
|
689
|
-
|
|
690
|
-
this.updateSliderDimension(t, e);
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
this.cntdown && (clearTimeout(this.cntdown), this.cntdown = null), this.cntdown = setTimeout(() => {
|
|
694
|
-
this.cntdown = null, this.updateSliderDimension(t, e);
|
|
695
|
-
}, n);
|
|
1014
|
+
updateSlider(t, e, n = !1, i = 2) {
|
|
1015
|
+
return U(this, t, e, n, i);
|
|
696
1016
|
}
|
|
697
1017
|
updateSliderDimension(t, e) {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
const w = Math.max(
|
|
721
|
-
0,
|
|
722
|
-
s.dims.w - h.minWidth
|
|
723
|
-
), k = Math.max(
|
|
724
|
-
0,
|
|
725
|
-
d.dims.w - r.minWidth
|
|
726
|
-
), b = w + k, y = s.part + d.part;
|
|
727
|
-
b > 0 ? (s.part = w / b * y, d.part = k / b * y) : (s.part = y / 2, d.part = y / 2);
|
|
728
|
-
} else {
|
|
729
|
-
const l = d.dims.y + d.dims.h, f = s.dims.y + h.minHeight + u, m = l - r.minHeight - u, p = Math.max(f, Math.min(m, e.y));
|
|
730
|
-
i.dims.y = p - u, s.dims.h = i.dims.y - s.dims.y, d.dims.y = p + u, d.dims.h = l - d.dims.y;
|
|
731
|
-
const w = Math.max(
|
|
732
|
-
0,
|
|
733
|
-
s.dims.h - h.minHeight
|
|
734
|
-
), k = Math.max(
|
|
735
|
-
0,
|
|
736
|
-
d.dims.h - r.minHeight
|
|
737
|
-
), b = w + k, y = s.part + d.part;
|
|
738
|
-
b > 0 ? (s.part = w / b * y, d.part = k / b * y) : (s.part = y / 2, d.part = y / 2);
|
|
739
|
-
}
|
|
740
|
-
this.calcDimensions(o);
|
|
741
|
-
}
|
|
742
|
-
updateTree(t, e, i) {
|
|
743
|
-
const n = a.cache.mapElem.get(t);
|
|
744
|
-
let s = a.cache.mapElem.get(e);
|
|
745
|
-
return !n || !(n instanceof a) || !s || !(s instanceof a) ? (console.warn(
|
|
746
|
-
`Source node ${t} not found or is not a Node instance`
|
|
747
|
-
), !1) : n?.type == "tab" && n.host === s && s.kids.size() < 2 ? (console.warn("Cannot move to self as it has only one tab"), !1) : n?.type == "tabset" && s?.host === n ? (console.warn("Cannot move tabset to self as it is already a child"), !1) : !n || !s ? (console.warn(`Source or destination node not found: ${t}, ${e}`), !1) : n === s ? (console.warn(
|
|
748
|
-
"Source and destination nodes are the same, no action taken."
|
|
749
|
-
), !1) : !n.host || !s.host && s.type !== "row" ? (console.warn(
|
|
750
|
-
`Source node or destination node's host is null: ${n.unId}, ${s.unId}`
|
|
751
|
-
), !1) : s.type === "row" && i === "contain" ? (console.warn(
|
|
752
|
-
`Cannot move to a row with 'contain' layout: ${s.unId}`
|
|
753
|
-
), !1) : n.type === "row" ? !1 : (s.type === "tabset" && i === "contain" && (s = s.kids.peekBack() || s), s.type === "tab" && (i === "contain" || i === "left" || i === "right") ? this.moveNodeAsTab(n, s, i) : s.type === "row" && i !== "contain" ? this.moveRelativeToRoot(n, s, i) : s.type === "tabset" && i !== "contain" && this.moveRelativeToTabset(n, s, i), this.calcTabsetCountAndMinDim(), this.calcDimensions(c._root, !0), !0);
|
|
754
|
-
}
|
|
755
|
-
moveNodeAsTab(t, e, i) {
|
|
756
|
-
if (!e || !e.host) {
|
|
757
|
-
console.warn(
|
|
758
|
-
`Destination node ${e.unId} has no host, cannot move.`
|
|
759
|
-
);
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
this.removeNode(t);
|
|
763
|
-
const n = e.host, s = n.kids.indexOf(e);
|
|
764
|
-
if (s === void 0 || s === -1)
|
|
765
|
-
return;
|
|
766
|
-
const d = i === "contain" || i === "left", o = d ? s : s + 1, h = n.kids.get(o + 1), r = n.kids.get(o - 1), u = e.next, l = e.prev;
|
|
767
|
-
if (!d && u ? (a.cache.mapElem.delete(u.unId), a.cache.nodOpts.get().delete(u.unId)) : d && l && (a.cache.mapElem.delete(l.unId), a.cache.nodOpts.get().delete(l.unId)), t.type == "tab")
|
|
768
|
-
d ? (r && t.addBond(n, r), e.addBond(n, t)) : (t.addBond(n, e), h && h.addBond(n, t)), n.kids.insert(o, t), t.host = n, n.open = t.name;
|
|
769
|
-
else if (t.type == "tabset") {
|
|
770
|
-
const f = t.kids.peek(), m = t.kids.peekBack();
|
|
771
|
-
d ? (f && r && f.addBond(n, r), m && e && e.addBond(n, m)) : (f && e && f.addBond(n, e), m && h && h.addBond(n, m)), n.kids.insertQueue(o, t.kids);
|
|
772
|
-
for (const p of t.kids)
|
|
773
|
-
p.host = n, p.next && (p.next.host = n);
|
|
774
|
-
n.open = m ? m.name : "";
|
|
775
|
-
}
|
|
776
|
-
this.updateChildDirections(n);
|
|
777
|
-
}
|
|
778
|
-
moveRelativeToRoot(t, e, i) {
|
|
779
|
-
this.removeNode(t);
|
|
780
|
-
const n = a.cache.mapDirs.get(e.unId), s = i === "top" || i === "left";
|
|
781
|
-
if (t.type === "tab") {
|
|
782
|
-
const d = new a({ type: "tabset", host: e.host });
|
|
783
|
-
d.kids.enqueue(t), t.host = d, d.open = t.name, n == !1 ? i === "left" || i === "right" ? this.insertNodeWithNewParent(d, e, s) : this.insertNode(e, d, s) : i === "top" || i === "bottom" ? this.insertNodeWithNewParent(d, e, s) : this.insertNode(e, d, s);
|
|
784
|
-
} else t.type === "tabset" && (n == !1 ? i === "left" || i === "right" ? this.insertNodeWithNewParent(t, e, s) : this.insertNode(e, t, s) : i === "top" || i === "bottom" ? this.insertNodeWithNewParent(t, e, s) : this.insertNode(e, t, s));
|
|
785
|
-
}
|
|
786
|
-
moveRelativeToTabset(t, e, i) {
|
|
787
|
-
this.removeNode(t);
|
|
788
|
-
const n = a.cache.mapDirs.get(e.unId), s = i === "top" || i === "left";
|
|
789
|
-
if (t.type === "tab") {
|
|
790
|
-
const d = new a({ type: "tabset", host: e.host });
|
|
791
|
-
d.kids.enqueue(t), t.host = d, d.open = t.name, n == !1 ? i === "top" || i === "bottom" ? this.insertNodeWithNewParent(d, e, s) : this.insertNode(e, d, s) : i === "left" || i === "right" ? this.insertNodeWithNewParent(d, e, s) : this.insertNode(e, d, s);
|
|
792
|
-
} else t.type === "tabset" && (n == !1 ? i === "top" || i === "bottom" ? this.insertNodeWithNewParent(t, e, s) : this.insertNode(e, t, s) : i === "left" || i === "right" ? this.insertNodeWithNewParent(t, e, s) : this.insertNode(e, t, s));
|
|
793
|
-
}
|
|
794
|
-
insertNode(t, e, i) {
|
|
795
|
-
const n = t.host;
|
|
796
|
-
if (t == c._root) {
|
|
797
|
-
const l = c._root.kids.peek(), f = c._root.kids.peekBack();
|
|
798
|
-
i ? (c._root.kids.enqueueFront(e), l && l.addBond(c._root, e)) : (c._root.kids.enqueue(e), f && e.addBond(c._root, f)), e.host = c._root, this.updateChildDirections(c._root);
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
if (!n) {
|
|
802
|
-
console.warn(
|
|
803
|
-
`Destination node ${t.unId} has no host, cannot insert.`
|
|
804
|
-
);
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
const s = n.kids.indexOf(t);
|
|
808
|
-
if (s === -1) {
|
|
809
|
-
console.warn(
|
|
810
|
-
`Destination node ${t.unId} not found in its host's kids.`
|
|
811
|
-
);
|
|
812
|
-
return;
|
|
813
|
-
}
|
|
814
|
-
const d = a.cache.mapDirs.get(n.unId);
|
|
815
|
-
d && a.cache.mapDirs.set(e.unId, !d);
|
|
816
|
-
const o = n.kids.get(s + 1), h = n.kids.get(s - 1), r = t.next, u = t.prev;
|
|
817
|
-
e.host = n, i ? (n.kids.insert(s, e), t.addBond(n, e), h && e.addBond(n, h), u && (a.cache.mapElem.delete(u.unId), a.cache.nodOpts.get().delete(u.unId))) : (n.kids.insert(s + 1, e), e.addBond(n, t), o && o.addBond(n, e), r && (a.cache.mapElem.delete(r.unId), a.cache.nodOpts.get().delete(r.unId))), this.updateChildDirections(n);
|
|
818
|
-
}
|
|
819
|
-
insertNodeWithNewParent(t, e, i) {
|
|
820
|
-
const n = new N(), s = new a({ type: "tabset", host: e.host });
|
|
821
|
-
if (!e || !t) {
|
|
822
|
-
console.warn(
|
|
823
|
-
`Destination node ${e.unId} has no host, cannot insert.`
|
|
824
|
-
);
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
if (e === c._root) {
|
|
828
|
-
const o = new a({ type: "row", host: e });
|
|
829
|
-
if (e.kids.size() == 1 && e.kids.peek()?.type === "tabset") {
|
|
830
|
-
const h = e.kids.dequeue();
|
|
831
|
-
if (!h) {
|
|
832
|
-
console.warn(
|
|
833
|
-
`No kid found in destination node ${e.unId}, cannot insert.`
|
|
834
|
-
);
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
i ? (o.kids.enqueue(t), o.kids.enqueue(h), e.kids.enqueue(o), h.addBond(o, t)) : (o.kids.enqueue(h), o.kids.enqueue(t), t.addBond(o, h), e.kids.enqueue(o)), t.host = o, h.host = o;
|
|
838
|
-
} else if (e.kids.size() == 1 && e.kids.peek()?.type === "row") {
|
|
839
|
-
const h = e.kids.peek(), r = h?.kids.peek(), u = h?.kids.peekBack();
|
|
840
|
-
i && h ? (h.kids.enqueueFront(t), r && r.addBond(h, t)) : h && (h.kids.enqueue(t), u && t.addBond(h, u)), t.host = h;
|
|
841
|
-
} else if (e.kids.size() > 1) {
|
|
842
|
-
const h = new a({ type: "row", host: e }), r = new a({ type: "row", host: h });
|
|
843
|
-
for (const u of e.kids)
|
|
844
|
-
r.kids.enqueue(u), u.host = r, u.next && (u.next.host = r);
|
|
845
|
-
t.host = h, e.kids.clear(), i ? (h.kids.enqueueFront(t), h.kids.enqueue(r), r.addBond(h, t)) : (h.kids.enqueue(r), h.kids.enqueue(t), t.addBond(h, r)), e.kids.enqueue(h);
|
|
846
|
-
}
|
|
847
|
-
this.updateChildDirections(e);
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
t.host = e, s.host = e, s.kids = e.kids, s.open = e.open;
|
|
851
|
-
const d = a.cache.mapDirs.get(e.unId);
|
|
852
|
-
for (const o of s.kids)
|
|
853
|
-
o.host = s, o.next && (o.next.host = s), a.cache.mapDirs.set(o.unId, d);
|
|
854
|
-
for (const o of t.kids)
|
|
855
|
-
o.host = t, o.next && (o.next.host = t), a.cache.mapDirs.set(o.unId, d);
|
|
856
|
-
a.cache.mapDirs.set(s.unId, !d), a.cache.mapDirs.set(t.unId, !d), i ? (n.enqueue(t), n.enqueue(s), e.kids = n, e.type = "row", s.addBond(e, t)) : (n.enqueue(s), n.enqueue(t), e.kids = n, e.type = "row", t.addBond(e, s));
|
|
1018
|
+
return $(this, t, e);
|
|
1019
|
+
}
|
|
1020
|
+
updateTree(t, e, n) {
|
|
1021
|
+
return _(this, t, e, n);
|
|
1022
|
+
}
|
|
1023
|
+
isOnlyContent(t) {
|
|
1024
|
+
return Y(this, t);
|
|
1025
|
+
}
|
|
1026
|
+
moveNodeAsTab(t, e, n) {
|
|
1027
|
+
return G(this, t, e, n);
|
|
1028
|
+
}
|
|
1029
|
+
moveRelativeToRoot(t, e, n) {
|
|
1030
|
+
return Q(this, t, e, n);
|
|
1031
|
+
}
|
|
1032
|
+
moveRelativeToTabset(t, e, n) {
|
|
1033
|
+
return j(this, t, e, n);
|
|
1034
|
+
}
|
|
1035
|
+
insertNode(t, e, n) {
|
|
1036
|
+
return X(this, t, e, n);
|
|
1037
|
+
}
|
|
1038
|
+
insertNodeWithNewParent(t, e, n) {
|
|
1039
|
+
return V(this, t, e, n);
|
|
857
1040
|
}
|
|
858
1041
|
moveAdjacentNodeToGrandParent(t) {
|
|
859
|
-
|
|
860
|
-
console.warn(`Source node ${t.unId} has no host, cannot move.`);
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
const e = t.host, i = t.host.host, n = i.kids.indexOf(e), s = i.kids.get(n - 1), d = i.kids.get(n + 1), o = t.kids.peek(), h = t.kids.peekBack();
|
|
864
|
-
this.removeKid(e);
|
|
865
|
-
let r = n;
|
|
866
|
-
if (t.type == "row" && e) {
|
|
867
|
-
s && o && o.addBond(i, s), d && h && d.addBond(i, h);
|
|
868
|
-
for (const u of t.kids)
|
|
869
|
-
u.host = i, u.next && (u.next.host = i), i.kids.insert(r, u), a.cache.mapDirs.set(
|
|
870
|
-
u.unId,
|
|
871
|
-
!a.cache.mapDirs.get(i.unId)
|
|
872
|
-
), a.cache.dimMins.delete(u.unId), r++;
|
|
873
|
-
} else if (t.type == "tabset") {
|
|
874
|
-
s && t.addBond(i, s), d && d.addBond(i, t), i.kids.insert(r, t), t.host = i, a.cache.mapDirs.set(
|
|
875
|
-
t.unId,
|
|
876
|
-
!a.cache.mapDirs.get(i.unId)
|
|
877
|
-
);
|
|
878
|
-
for (const u of t.kids)
|
|
879
|
-
a.cache.mapDirs.set(
|
|
880
|
-
u.unId,
|
|
881
|
-
a.cache.mapDirs.get(i.unId)
|
|
882
|
-
), a.cache.dimMins.delete(u.unId);
|
|
883
|
-
}
|
|
1042
|
+
return Z(this, t);
|
|
884
1043
|
}
|
|
885
1044
|
removeRelation(t, e = !0) {
|
|
886
|
-
|
|
887
|
-
if (t.host = null, t.next = null, t.prev = null, n && (n.next = null), s && (s.prev = null), !e)
|
|
888
|
-
return t;
|
|
889
|
-
n && s && n.prev && s.next ? n.prev.addBond(i, s.next) : n && n.prev ? n.prev.next = null : s && s.next && (s.next.prev = null);
|
|
1045
|
+
return tt(t, e);
|
|
890
1046
|
}
|
|
891
1047
|
removeNode(t) {
|
|
892
|
-
|
|
893
|
-
console.warn("Kid node has no host, cannot remove.");
|
|
894
|
-
return;
|
|
895
|
-
}
|
|
896
|
-
const e = t?.host, i = e?.host;
|
|
897
|
-
if (this.removeKid(t), t.type === "tabset" && e.kids.size() === 1) {
|
|
898
|
-
const n = e.kids.peek();
|
|
899
|
-
n && this.moveAdjacentNodeToGrandParent(n);
|
|
900
|
-
} else if (t.type === "tab" && e.kids.size() === 0 && i.kids.size() === 2) {
|
|
901
|
-
this.removeKid(e);
|
|
902
|
-
const n = i?.kids.peek();
|
|
903
|
-
n && this.moveAdjacentNodeToGrandParent(n);
|
|
904
|
-
} else if (t.type === "tab" && e.kids.size() === 0 && i.kids.size() > 2)
|
|
905
|
-
this.removeKid(e);
|
|
906
|
-
else if (t.type === "tab" && e.open === t.name && e.kids.size() > 0) {
|
|
907
|
-
const n = e.kids.peek();
|
|
908
|
-
n && (e.open = n.name);
|
|
909
|
-
}
|
|
1048
|
+
return et(this, t);
|
|
910
1049
|
}
|
|
911
1050
|
removeKid(t) {
|
|
912
|
-
|
|
913
|
-
console.warn("Kid node has no host, cannot remove.");
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
const e = t.host, i = e.kids.indexOf(t), n = e.kids.get(i + 1), s = e.kids.get(i - 1), d = t.next, o = t.prev;
|
|
917
|
-
if (i === -1) {
|
|
918
|
-
console.warn("Kid node not found in its host's kids.");
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
d && (a.cache.mapElem.delete(d.unId), a.cache.nodOpts.get().delete(d.unId)), o && (a.cache.mapElem.delete(o.unId), a.cache.nodOpts.get().delete(o.unId)), n && s ? n.addBond(e, s) : n ? n.prev = null : s && (s.next = null), e.kids.removeAt(i), a.cache.mapElem.delete(t.unId), a.cache.dimMins.delete(t.unId), a.cache.mapDirs.delete(t.unId), a.cache.tabCnts.delete(t.unId), t.type === "tabset" && a.cache.mapElem.delete(t.unId), t.type === "tab" && a.cache.mapElem.delete(t.unId), t.host = null, t.next = null, t.prev = null;
|
|
1051
|
+
return nt(t);
|
|
922
1052
|
}
|
|
923
1053
|
clearAllCache() {
|
|
924
|
-
|
|
1054
|
+
return it();
|
|
925
1055
|
}
|
|
926
1056
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1057
|
+
const ot = 6;
|
|
1058
|
+
function st(o, t, e) {
|
|
1059
|
+
const { left: n, top: i, width: s, height: r } = o, c = t - n, d = e - i;
|
|
1060
|
+
return c < s / 3 ? { area: "left", left: n, top: i, width: s / 2, height: r } : c > 2 * s / 3 ? {
|
|
1061
|
+
area: "right",
|
|
1062
|
+
left: n + s / 2,
|
|
1063
|
+
top: i,
|
|
1064
|
+
width: s / 2,
|
|
1065
|
+
height: r
|
|
1066
|
+
} : d < r / 3 ? { area: "top", left: n, top: i, width: s, height: r / 2 } : d > 2 * r / 3 ? {
|
|
1067
|
+
area: "bottom",
|
|
1068
|
+
left: n,
|
|
1069
|
+
top: i + r / 2,
|
|
1070
|
+
width: s,
|
|
1071
|
+
height: r / 2
|
|
1072
|
+
} : {
|
|
1073
|
+
area: "contain",
|
|
1074
|
+
left: n + s * 0.1,
|
|
1075
|
+
top: i + r * 0.1,
|
|
1076
|
+
width: s * 0.8,
|
|
1077
|
+
height: r * 0.8
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function at(o, t) {
|
|
1081
|
+
const { x: e, y: n, w: i, h: s } = o;
|
|
1082
|
+
switch (t) {
|
|
1083
|
+
case "left":
|
|
1084
|
+
return { area: t, left: e, top: n, width: i / 2, height: s };
|
|
1085
|
+
case "right":
|
|
1086
|
+
return {
|
|
1087
|
+
area: t,
|
|
1088
|
+
left: e + i / 2,
|
|
1089
|
+
top: n,
|
|
1090
|
+
width: i / 2,
|
|
1091
|
+
height: s
|
|
1092
|
+
};
|
|
1093
|
+
case "top":
|
|
1094
|
+
return { area: t, left: e, top: n, width: i, height: s / 2 };
|
|
1095
|
+
case "bottom":
|
|
1096
|
+
return {
|
|
1097
|
+
area: t,
|
|
1098
|
+
left: e,
|
|
1099
|
+
top: n + s / 2,
|
|
1100
|
+
width: i,
|
|
1101
|
+
height: s / 2
|
|
1102
|
+
};
|
|
935
1103
|
}
|
|
936
|
-
|
|
1104
|
+
}
|
|
1105
|
+
function rt(o, t, e, n) {
|
|
1106
|
+
if (t.length === 0 || n < o.top || n > o.bottom) return null;
|
|
1107
|
+
const i = t[0], s = t[t.length - 1];
|
|
1108
|
+
let r = ot;
|
|
1109
|
+
if (e > s.right)
|
|
937
1110
|
return {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1111
|
+
index: t.length - 1,
|
|
1112
|
+
area: "right",
|
|
1113
|
+
left: s.right + 1,
|
|
1114
|
+
top: s.top,
|
|
1115
|
+
width: r - 2,
|
|
1116
|
+
height: s.height
|
|
944
1117
|
};
|
|
945
|
-
|
|
1118
|
+
if (e < i.left)
|
|
1119
|
+
return {
|
|
1120
|
+
index: 0,
|
|
1121
|
+
area: "left",
|
|
1122
|
+
left: i.left - r + 1,
|
|
1123
|
+
top: i.top,
|
|
1124
|
+
width: r - 2,
|
|
1125
|
+
height: i.height
|
|
1126
|
+
};
|
|
1127
|
+
let c = 0, d = 1 / 0, l = !1;
|
|
1128
|
+
t.forEach((m, p) => {
|
|
1129
|
+
const I = m.left + m.width / 2, y = Math.abs(e - I);
|
|
1130
|
+
y < d && (d = y, c = p, l = e < I);
|
|
1131
|
+
});
|
|
1132
|
+
const h = l ? c > 0 : c < t.length - 1;
|
|
1133
|
+
t.length > 1 && h && (r = t[1].left - i.right);
|
|
1134
|
+
const f = t[c];
|
|
1135
|
+
return {
|
|
1136
|
+
index: c,
|
|
1137
|
+
area: l ? "left" : "right",
|
|
1138
|
+
left: l ? f.left - r + 1 : f.right + 1,
|
|
1139
|
+
top: f.top,
|
|
1140
|
+
width: r - 2,
|
|
1141
|
+
height: f.height
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
function dt(o, t) {
|
|
1145
|
+
return o.area === t.area && o.left === t.left && o.top === t.top && o.width === t.width && o.height === t.height;
|
|
1146
|
+
}
|
|
1147
|
+
function ct(o, { x: t, y: e, w: n, h: i }) {
|
|
1148
|
+
o.style.left = `${t}px`, o.style.top = `${e}px`, o.style.width = `${n}px`, o.style.height = `${i}px`;
|
|
1149
|
+
}
|
|
1150
|
+
function ht(o, t) {
|
|
1151
|
+
return {
|
|
1152
|
+
x: o.x,
|
|
1153
|
+
y: o.y + t,
|
|
1154
|
+
w: o.w,
|
|
1155
|
+
h: Math.max(0, o.h - t)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function ut(o) {
|
|
1159
|
+
let t = null, e = null;
|
|
1160
|
+
const n = () => {
|
|
1161
|
+
e = null;
|
|
1162
|
+
const i = t;
|
|
1163
|
+
t = null, i && o(i.value);
|
|
1164
|
+
};
|
|
1165
|
+
return {
|
|
1166
|
+
schedule(i) {
|
|
1167
|
+
t = { value: i }, e === null && (e = requestAnimationFrame(n));
|
|
1168
|
+
},
|
|
1169
|
+
flush() {
|
|
1170
|
+
e !== null && (cancelAnimationFrame(e), n());
|
|
1171
|
+
},
|
|
1172
|
+
cancel() {
|
|
1173
|
+
e !== null && cancelAnimationFrame(e), e = null, t = null;
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
946
1176
|
}
|
|
947
1177
|
(() => {
|
|
948
1178
|
if (typeof window > "u") return;
|
|
949
|
-
const
|
|
1179
|
+
const o = "color: #03A9F4; font-weight: bold; line-height: 1.2;", t = "color: #E0E0E0; font-size: 12px;", e = "color: #42a5f5; font-size: 12px;", n = "color: #9E9E9E; font-size: 10px;", i = `
|
|
950
1180
|
██████╗ ██╗ ██╗ ███╗ ██╗ █████╗ ███╗ ███╗ ██████╗ ██╗ ██╗
|
|
951
1181
|
██╔══██╗╚██╗ ██╔╝ ████╗ ██║ ██╔══██╗ ████╗ ████║ ╚═██╔═╝ ╚██╗██╔╝
|
|
952
1182
|
██║ ██║ ╚████╔╝ ██╔██╗ ██║ ███████║ ██╔████╔██║ ██║ ╚███╔╝
|
|
@@ -963,7 +1193,7 @@ class x {
|
|
|
963
1193
|
console.groupCollapsed(
|
|
964
1194
|
"%cDYNAMIX LAYOUT (click to expand)",
|
|
965
1195
|
"color: #03A9F4; font-weight: bold; font-size: 14px;"
|
|
966
|
-
), console.log(`%c${
|
|
1196
|
+
), console.log(`%c${i}`, o), console.log("%c A powerful, dynamic layout system 🚀", t), console.log(
|
|
967
1197
|
`%c ⚡ For docs and more info,
|
|
968
1198
|
⚡ visit: https://github.com/akash-aman/dynamix-layout`,
|
|
969
1199
|
e
|
|
@@ -988,7 +1218,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
988
1218
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
989
1219
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
990
1220
|
SOFTWARE.
|
|
991
|
-
`,
|
|
1221
|
+
`, n), console.groupEnd(), typeof window < "u" && (window.__DYNAMIX_LAYOUT__ = {
|
|
992
1222
|
__LICENSE__: `MIT License
|
|
993
1223
|
|
|
994
1224
|
Copyright (c) 2025 Akash Aman <sir.akashaman@gmail.com> (https://akash.cx)
|
|
@@ -1011,15 +1241,22 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
1011
1241
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1012
1242
|
SOFTWARE.
|
|
1013
1243
|
`,
|
|
1014
|
-
__LAYOUT__:
|
|
1244
|
+
__LAYOUT__: w
|
|
1015
1245
|
});
|
|
1016
1246
|
})();
|
|
1017
1247
|
export {
|
|
1018
|
-
|
|
1019
|
-
|
|
1248
|
+
O as Bond,
|
|
1249
|
+
w as DynamixLayoutCore,
|
|
1020
1250
|
a as Node,
|
|
1021
|
-
|
|
1022
|
-
|
|
1251
|
+
b as Queue,
|
|
1252
|
+
A as areNodeOptionsEqual,
|
|
1023
1253
|
E as areNodeOptionsMapEqual,
|
|
1024
|
-
|
|
1254
|
+
ut as createFrameScheduler,
|
|
1255
|
+
x as createReactiveState,
|
|
1256
|
+
rt as getNavbarDropPreview,
|
|
1257
|
+
at as getRootSplitPreview,
|
|
1258
|
+
ht as getTabBodyRect,
|
|
1259
|
+
st as getTabsetDropPreview,
|
|
1260
|
+
dt as isSameDropPreview,
|
|
1261
|
+
ct as setElementRect
|
|
1025
1262
|
};
|