@dynamix-layout/core 1.1.1 → 2.0.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/dist/core.es.js DELETED
@@ -1,1262 +0,0 @@
1
- class b {
2
- buffer;
3
- head = 0;
4
- tail = 0;
5
- count = 0;
6
- capacity;
7
- constructor(t = 16, e = []) {
8
- this.capacity = Math.max(t, e.length), this.buffer = new Array(this.capacity), e.forEach((n) => {
9
- this.enqueue(n);
10
- });
11
- }
12
- enqueue(t) {
13
- this.count === this.capacity && this.resize(), this.buffer[this.tail] = t, this.tail = (this.tail + 1) % this.capacity, this.count++;
14
- }
15
- enqueueFront(t) {
16
- this.count === this.capacity && this.resize(), this.head = (this.head - 1 + this.capacity) % this.capacity, this.buffer[this.head] = t, this.count++;
17
- }
18
- insert(t, e) {
19
- if (t < 0 || t > this.count)
20
- return !1;
21
- if (t === 0)
22
- return this.enqueueFront(e), !0;
23
- if (t === this.count)
24
- return this.enqueue(e), !0;
25
- this.count === this.capacity && this.resize();
26
- const n = t, i = this.count - t;
27
- return n <= i ? this.shiftLeft(t, e) : this.shiftRight(t, e), this.count++, !0;
28
- }
29
- insertArray(t, e) {
30
- if (t < 0 || t > this.count)
31
- return !1;
32
- if (e.length === 0)
33
- return !0;
34
- if (t === 0) {
35
- for (let r = e.length - 1; r >= 0; r--)
36
- this.enqueueFront(e[r]);
37
- return !0;
38
- }
39
- if (t === this.count)
40
- return e.forEach((r) => this.enqueue(r)), !0;
41
- for (; this.count + e.length > this.capacity; )
42
- this.resize();
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
- }
46
- insertQueue(t, e) {
47
- if (t < 0 || t > this.count)
48
- return !1;
49
- if (e.isEmpty())
50
- return !0;
51
- const n = e.size();
52
- if (t === 0) {
53
- const c = e.toArray();
54
- for (let d = c.length - 1; d >= 0; d--)
55
- this.enqueueFront(c[d]);
56
- return !0;
57
- }
58
- if (t === this.count) {
59
- for (const c of e)
60
- this.enqueue(c);
61
- return !0;
62
- }
63
- for (; this.count + n > this.capacity; )
64
- this.resize();
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
- }
68
- push(t) {
69
- this.enqueue(t);
70
- }
71
- unshift(t) {
72
- this.enqueueFront(t);
73
- }
74
- dequeue() {
75
- if (this.count === 0)
76
- return;
77
- const t = this.buffer[this.head];
78
- return this.head = (this.head + 1) % this.capacity, this.count--, t;
79
- }
80
- dequeueBack() {
81
- if (this.count === 0)
82
- return;
83
- this.tail = (this.tail - 1 + this.capacity) % this.capacity;
84
- const t = this.buffer[this.tail];
85
- return this.count--, t;
86
- }
87
- indexOf(t) {
88
- for (let e = 0; e < this.count; e++) {
89
- const n = (this.head + e) % this.capacity;
90
- if (this.buffer[n] === t)
91
- return e;
92
- }
93
- return -1;
94
- }
95
- remove(t) {
96
- const e = this.indexOf(t);
97
- return e === -1 ? !1 : (this.removeAt(e), !0);
98
- }
99
- removeAt(t) {
100
- if (t < 0 || t >= this.count)
101
- return;
102
- if (t === 0)
103
- return this.dequeue();
104
- if (t === this.count - 1)
105
- return this.dequeueBack();
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
- }
109
- shift() {
110
- return this.dequeue();
111
- }
112
- pop() {
113
- return this.dequeueBack();
114
- }
115
- fifoAdd(t) {
116
- this.enqueue(t);
117
- }
118
- fifoRemove() {
119
- return this.dequeue();
120
- }
121
- filoAdd(t) {
122
- this.enqueue(t);
123
- }
124
- filoRemove() {
125
- return this.dequeueBack();
126
- }
127
- lifoAdd(t) {
128
- this.enqueueFront(t);
129
- }
130
- lifoRemove() {
131
- return this.dequeue();
132
- }
133
- liloAdd(t) {
134
- this.enqueueFront(t);
135
- }
136
- liloRemove() {
137
- return this.dequeueBack();
138
- }
139
- get(t) {
140
- if (t < 0 || t >= this.count)
141
- return;
142
- const e = (this.head + t) % this.capacity;
143
- return this.buffer[e];
144
- }
145
- set(t, e) {
146
- if (t < 0 || t >= this.count)
147
- return !1;
148
- const n = (this.head + t) % this.capacity;
149
- return this.buffer[n] = e, !0;
150
- }
151
- peek() {
152
- return this.count > 0 ? this.buffer[this.head] : void 0;
153
- }
154
- peekBack() {
155
- if (this.count === 0) return;
156
- const t = (this.tail - 1 + this.capacity) % this.capacity;
157
- return this.buffer[t];
158
- }
159
- front() {
160
- return this.peek();
161
- }
162
- back() {
163
- return this.peekBack();
164
- }
165
- size() {
166
- return this.count;
167
- }
168
- getCapacity() {
169
- return this.capacity;
170
- }
171
- isEmpty() {
172
- return this.count === 0;
173
- }
174
- isFull() {
175
- return this.count === this.capacity;
176
- }
177
- clear() {
178
- this.head = 0, this.tail = 0, this.count = 0;
179
- }
180
- toArray() {
181
- const t = [];
182
- for (let e = 0; e < this.count; e++) {
183
- const n = (this.head + e) % this.capacity;
184
- t.push(this.buffer[n]);
185
- }
186
- return t;
187
- }
188
- *[Symbol.iterator]() {
189
- for (let t = 0; t < this.count; t++) {
190
- const e = (this.head + t) % this.capacity;
191
- yield this.buffer[e];
192
- }
193
- }
194
- *forward() {
195
- for (let t = 0; t < this.count; t++) {
196
- const e = (this.head + t) % this.capacity;
197
- yield this.buffer[e];
198
- }
199
- }
200
- *reverse() {
201
- for (let t = this.count - 1; t >= 0; t--) {
202
- const e = (this.head + t) % this.capacity;
203
- yield this.buffer[e];
204
- }
205
- }
206
- *entries() {
207
- for (let t = 0; t < this.count; t++) {
208
- const e = (this.head + t) % this.capacity;
209
- yield [t, this.buffer[e]];
210
- }
211
- }
212
- *keys() {
213
- for (let t = 0; t < this.count; t++)
214
- yield t;
215
- }
216
- *values() {
217
- for (let t = 0; t < this.count; t++) {
218
- const e = (this.head + t) % this.capacity;
219
- yield this.buffer[e];
220
- }
221
- }
222
- toString() {
223
- return `Queue(${this.toArray().join(", ")})`;
224
- }
225
- resize() {
226
- const t = this.capacity * 2, e = new Array(t);
227
- for (let n = 0; n < this.count; n++) {
228
- const i = (this.head + n) % this.capacity;
229
- e[n] = this.buffer[i];
230
- }
231
- this.buffer = e, this.capacity = t, this.head = 0, this.tail = this.count;
232
- }
233
- shiftLeft(t, e) {
234
- this.head = (this.head - 1 + this.capacity) % this.capacity;
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
- }
239
- const n = (this.head + t) % this.capacity;
240
- this.buffer[n] = e;
241
- }
242
- shiftRight(t, e) {
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
- }
247
- const n = (this.head + t) % this.capacity;
248
- this.buffer[n] = e, this.tail = (this.tail + 1) % this.capacity;
249
- }
250
- shiftRightForRemoval(t) {
251
- for (let e = t; e > 0; e--) {
252
- const n = (this.head + e - 1) % this.capacity, i = (this.head + e) % this.capacity;
253
- this.buffer[i] = this.buffer[n];
254
- }
255
- this.head = (this.head + 1) % this.capacity;
256
- }
257
- shiftLeftForRemoval(t) {
258
- for (let e = t; e < this.count - 1; e++) {
259
- const n = (this.head + e + 1) % this.capacity, i = (this.head + e) % this.capacity;
260
- this.buffer[i] = this.buffer[n];
261
- }
262
- this.tail = (this.tail - 1 + this.capacity) % this.capacity;
263
- }
264
- shiftLeftArray(t, e) {
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
- }
271
- for (let i = 0; i < n; i++) {
272
- const s = (this.head + t + i) % this.capacity;
273
- this.buffer[s] = e[i];
274
- }
275
- }
276
- shiftRightArray(t, e) {
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
- }
282
- for (let i = 0; i < n; i++) {
283
- const s = (this.head + t + i) % this.capacity;
284
- this.buffer[s] = e[i];
285
- }
286
- this.tail = (this.tail + n) % this.capacity;
287
- }
288
- }
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
- return;
297
- }
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
- });
304
- return {
305
- get: s,
306
- set: r,
307
- onChange: d,
308
- nextChange: l,
309
- triggerChange: c,
310
- onChangePromise: (f) => {
311
- let m = !0;
312
- return (async () => {
313
- for (; m; ) {
314
- const I = await l();
315
- if (!m) break;
316
- f(I);
317
- }
318
- })(), () => {
319
- m = !1;
320
- };
321
- }
322
- };
323
- }
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
- return !1;
330
- }
331
- return !0;
332
- }
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
- }
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
- };
351
- class a {
352
- static cache = {
353
- dimMins: /* @__PURE__ */ new Map(),
354
- mapDirs: /* @__PURE__ */ new Map(),
355
- tabCnts: /* @__PURE__ */ new Map(),
356
- mapElem: /* @__PURE__ */ new Map(),
357
- tabOpts: x(
358
- /* @__PURE__ */ new Map(),
359
- E
360
- ),
361
- nodOpts: x(
362
- /* @__PURE__ */ new Map(),
363
- E
364
- ),
365
- bndOpts: x(
366
- /* @__PURE__ */ new Map(),
367
- E
368
- )
369
- };
370
- kids = new b();
371
- dims = { w: 0, h: 0, x: 0, y: 0 };
372
- unId;
373
- next = null;
374
- prev = null;
375
- type = "row";
376
- name = "";
377
- part = 0;
378
- host = null;
379
- open = "";
380
- constructor(t = {}) {
381
- const e = {
382
- type: "row",
383
- host: null,
384
- name: "",
385
- part: 100,
386
- dims: { w: 0, h: 0, x: 0, y: 0 },
387
- unId: u.createId(),
388
- open: ""
389
- };
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;
391
- }
392
- addBond(t, e = null) {
393
- if (!e) return;
394
- const n = new O(t, this, e);
395
- a.cache.mapElem.set(n.unId, n);
396
- }
397
- getReqDimension() {
398
- const t = a.cache.dimMins.get(this.unId), e = a.cache.tabCnts.get(this.unId), n = Math.max(
399
- t.minWidth,
400
- e.horizontal * u.minW + Math.max(0, e.horizontal - 1) * u.bond
401
- ), i = Math.max(
402
- t.minHeight,
403
- e.vertical * u.minH + Math.max(0, e.vertical - 1) * u.bond
404
- );
405
- return {
406
- width: n,
407
- height: i
408
- };
409
- }
410
- calcDimensions() {
411
- const t = a.cache.mapDirs.get(this.unId);
412
- if (!this.kids) return;
413
- let e = 0;
414
- const n = a.cache.dimMins.get(this.unId) || {
415
- minWidth: 0,
416
- minHeight: 0
417
- };
418
- let i = 0;
419
- for (const h of this.kids)
420
- e += h.part;
421
- if (e === 0) return;
422
- let s;
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) || {
428
- minWidth: 0,
429
- minHeight: 0
430
- };
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;
436
- }
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
447
- });
448
- }
449
- }
450
- toJSON() {
451
- const t = [];
452
- for (const n of this.kids)
453
- t.push(n.toJSON());
454
- const e = {
455
- typNode: this.type,
456
- nodPart: this.part,
457
- nodName: this.name,
458
- uidNode: this.unId
459
- };
460
- return this.open && (e.nodOpen = this.open), t.length > 0 && (e.nodKids = t), e;
461
- }
462
- }
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), k = y + g, N = s.part + r.part;
723
- k > 0 ? (s.part = y / k * N, r.part = g / k * N) : (s.part = N / 2, r.part = N / 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), k = y + g, N = s.part + r.part;
728
- k > 0 ? (s.part = y / k * N, r.part = g / k * N) : (s.part = N / 2, r.part = N / 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
- }
950
- nodeOps;
951
- cntdown = null;
952
- tabsIds = /* @__PURE__ */ new Map();
953
- constructor(t = {}) {
954
- const e = {
955
- tabs: [],
956
- tree: null,
957
- minW: 40,
958
- minH: 40,
959
- bond: 10,
960
- uqid: "dynamix-layout-root",
961
- tabsIds: /* @__PURE__ */ new Map(),
962
- ...t
963
- };
964
- this.tabsIds = e.tabsIds, u.createId = e.createId ?? v, u.timer = e.timer ?? T, w._tree = e.tree ?? null, w._root = new a({
965
- unId: e.uqid,
966
- name: e.uqid,
967
- type: "row"
968
- }), this.nodeOps = x(
969
- /* @__PURE__ */ new Map(),
970
- E
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;
974
- }
975
- *JSONLayoutIterator(t) {
976
- yield* S(t);
977
- }
978
- *NodeLayoutIterator(t) {
979
- yield* R(t);
980
- }
981
- *NodeLayoutRecursiveIterator(t) {
982
- yield* H(this, t);
983
- }
984
- updateChildDirections(t) {
985
- return q(this, t);
986
- }
987
- createNodeLayout(t = w._tree) {
988
- return B(this, t);
989
- }
990
- createNodeTreeFromJSONTree(t, e) {
991
- return M(this, t, e);
992
- }
993
- createBinaryNodeTreeFromQueue(t, e = w._root) {
994
- return C(this, t, e);
995
- }
996
- createNodeFromJSON(t) {
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();
1004
- }
1005
- calculateRootAdjustment() {
1006
- return P();
1007
- }
1008
- calcDimensions(t = w._root, e = !1) {
1009
- return z(this, t, e);
1010
- }
1011
- updateDimension(t, e = !1, n = 2) {
1012
- return K(this, t, e, n);
1013
- }
1014
- updateSlider(t, e, n = !1, i = 2) {
1015
- return U(this, t, e, n, i);
1016
- }
1017
- updateSliderDimension(t, e) {
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);
1040
- }
1041
- moveAdjacentNodeToGrandParent(t) {
1042
- return Z(this, t);
1043
- }
1044
- removeRelation(t, e = !0) {
1045
- return tt(t, e);
1046
- }
1047
- removeNode(t) {
1048
- return et(this, t);
1049
- }
1050
- removeKid(t) {
1051
- return nt(t);
1052
- }
1053
- clearAllCache() {
1054
- return it();
1055
- }
1056
- }
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
- };
1103
- }
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)
1110
- return {
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
1117
- };
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
- };
1176
- }
1177
- (() => {
1178
- if (typeof window > "u") return;
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 = `
1180
- ██████╗ ██╗ ██╗ ███╗ ██╗ █████╗ ███╗ ███╗ ██████╗ ██╗ ██╗
1181
- ██╔══██╗╚██╗ ██╔╝ ████╗ ██║ ██╔══██╗ ████╗ ████║ ╚═██╔═╝ ╚██╗██╔╝
1182
- ██║ ██║ ╚████╔╝ ██╔██╗ ██║ ███████║ ██╔████╔██║ ██║ ╚███╔╝
1183
- ██║ ██║ ╚██╔╝ ██║╚██╗██║ ██╔══██║ ██║╚██╔╝██║ ██║ ██╔██╗
1184
- ██████╔╝ ██║ ██║ ╚████║ ██║ ██║ ██║ ╚═╝ ██║ ██████╗ ██╔╝ ██╗
1185
- ╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
1186
- ██╗ █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗
1187
- ██║ ██╔══██╗ ╚██╗ ██╔╝ ██╔═══██╗ ██║ ██║╚══██╔══╝
1188
- ██║ ███████║ ╚████╔╝ ██║ ██║ ██║ ██║ ██║
1189
- ██║ ██╔══██║ ╚██╔╝ ██║ ██║ ██║ ██║ ██║
1190
- ███████╗ ██║ ██║ ██║ ╚██████╔╝ ╚█████╔╝ ██║
1191
- ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚════╝ ╚═╝
1192
- `;
1193
- console.groupCollapsed(
1194
- "%cDYNAMIX LAYOUT (click to expand)",
1195
- "color: #03A9F4; font-weight: bold; font-size: 14px;"
1196
- ), console.log(`%c${i}`, o), console.log("%c A powerful, dynamic layout system 🚀", t), console.log(
1197
- `%c ⚡ For docs and more info,
1198
- ⚡ visit: https://github.com/xcode-studio/dynamix-layout`,
1199
- e
1200
- ), console.log(`%cMIT License
1201
-
1202
- Copyright (c) 2025 Akash Aman <sir.akashaman@gmail.com> (https://akash.cx)
1203
-
1204
- Permission is hereby granted, free of charge, to any person obtaining a copy
1205
- of this software and associated documentation files (the "Software"), to deal
1206
- in the Software without restriction, including without limitation the rights
1207
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1208
- copies of the Software, and to permit persons to whom the Software is
1209
- furnished to do so, subject to the following conditions:
1210
-
1211
- The above copyright notice and this permission notice shall be included in all
1212
- copies or substantial portions of the Software.
1213
-
1214
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1215
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1216
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1217
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1218
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1219
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1220
- SOFTWARE.
1221
- `, n), console.groupEnd(), typeof window < "u" && (window.__DYNAMIX_LAYOUT__ = {
1222
- __LICENSE__: `MIT License
1223
-
1224
- Copyright (c) 2025 Akash Aman <sir.akashaman@gmail.com> (https://akash.cx)
1225
-
1226
- Permission is hereby granted, free of charge, to any person obtaining a copy
1227
- of this software and associated documentation files (the "Software"), to deal
1228
- in the Software without restriction, including without limitation the rights
1229
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1230
- copies of the Software, and to permit persons to whom the Software is
1231
- furnished to do so, subject to the following conditions:
1232
-
1233
- The above copyright notice and this permission notice shall be included in all
1234
- copies or substantial portions of the Software.
1235
-
1236
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1237
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1238
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1239
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1240
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1241
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1242
- SOFTWARE.
1243
- `,
1244
- __LAYOUT__: w
1245
- });
1246
- })();
1247
- export {
1248
- O as Bond,
1249
- w as DynamixLayoutCore,
1250
- a as Node,
1251
- b as Queue,
1252
- A as areNodeOptionsEqual,
1253
- E as areNodeOptionsMapEqual,
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
1262
- };