bwin 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bwin.js +31 -30
- package/package.json +1 -1
package/dist/bwin.js
CHANGED
|
@@ -21,15 +21,15 @@ function z(e = 2, t = 3) {
|
|
|
21
21
|
}
|
|
22
22
|
return s;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function b(e, t) {
|
|
25
25
|
for (; t.firstChild; )
|
|
26
26
|
e.append(t.firstChild);
|
|
27
27
|
}
|
|
28
28
|
function H(e, t) {
|
|
29
29
|
const i = document.createElement("div");
|
|
30
|
-
|
|
30
|
+
b(i, e), b(e, t), b(t, i);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function C(e) {
|
|
33
33
|
if (typeof e == "number" && !isNaN(e))
|
|
34
34
|
return e;
|
|
35
35
|
if (typeof e == "string") {
|
|
@@ -65,7 +65,7 @@ function G(e) {
|
|
|
65
65
|
const t = document.createElement("template");
|
|
66
66
|
return t.innerHTML = e.trim(), t.content;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function m(e) {
|
|
69
69
|
if (e == null || e === "")
|
|
70
70
|
return null;
|
|
71
71
|
if (typeof e == "string")
|
|
@@ -284,8 +284,8 @@ class p {
|
|
|
284
284
|
if (h && s) {
|
|
285
285
|
const l = h.width + s.width, a = i * (h.width / l), c = l + i;
|
|
286
286
|
let d = h.width + a, g = c - d, u = s.left + a;
|
|
287
|
-
const
|
|
288
|
-
d <
|
|
287
|
+
const E = h.calcMinWidth(), y = s.calcMinWidth();
|
|
288
|
+
i < 0 && (d < E && g > y ? (d = h.width, g = c - d, u = h.left + d) : g < y && d > E && (g = s.width, d = c - g, u = h.left + d)), h.width = d, s.width = g, s.left = u;
|
|
289
289
|
}
|
|
290
290
|
n && o && (n.width += i, o.width += i);
|
|
291
291
|
}
|
|
@@ -299,8 +299,11 @@ class p {
|
|
|
299
299
|
if (n && o) {
|
|
300
300
|
const l = n.height + o.height, a = i * (n.height / l), c = l + i;
|
|
301
301
|
let d = n.height + a, g = c - d, u = o.top + a;
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
if (i < 0) {
|
|
303
|
+
const E = n.calcMinHeight(), y = o.calcMinHeight();
|
|
304
|
+
d < E && g > y ? (d = n.height, g = c - d, u = n.top + d) : g < y && d > E && (g = o.height, d = c - g, u = n.top + d);
|
|
305
|
+
}
|
|
306
|
+
n.height = d, o.height = g, o.top = u;
|
|
304
307
|
}
|
|
305
308
|
h && s && (h.height += i, s.height += i);
|
|
306
309
|
}
|
|
@@ -339,7 +342,7 @@ class A {
|
|
|
339
342
|
}
|
|
340
343
|
getSize(t) {
|
|
341
344
|
if (!this.siblingConfigNode)
|
|
342
|
-
return
|
|
345
|
+
return C(t);
|
|
343
346
|
if (!t) {
|
|
344
347
|
if (this.siblingConfigNode.size < 1)
|
|
345
348
|
return 1 - this.siblingConfigNode.size;
|
|
@@ -348,7 +351,7 @@ class A {
|
|
|
348
351
|
if (this.siblingConfigNode.position === r.Top || this.siblingConfigNode.position === r.Bottom)
|
|
349
352
|
return this.parentRect.height - this.siblingConfigNode.height;
|
|
350
353
|
}
|
|
351
|
-
const i =
|
|
354
|
+
const i = C(t);
|
|
352
355
|
if (i < 1) {
|
|
353
356
|
if (i + this.siblingConfigNode.size !== 1)
|
|
354
357
|
throw new Error("[bwin] Sum of sibling sizes is not equal to 1");
|
|
@@ -398,7 +401,7 @@ class A {
|
|
|
398
401
|
children: t
|
|
399
402
|
};
|
|
400
403
|
if (typeof t == "string" || typeof t == "number") {
|
|
401
|
-
const i =
|
|
404
|
+
const i = C(t);
|
|
402
405
|
if (isNaN(i))
|
|
403
406
|
throw new Error(`[bwin] Invalid size value: ${i}`);
|
|
404
407
|
return {
|
|
@@ -492,7 +495,7 @@ function J(e) {
|
|
|
492
495
|
return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
|
|
493
496
|
}
|
|
494
497
|
function Q(e, { size: t }) {
|
|
495
|
-
const i =
|
|
498
|
+
const i = C(t);
|
|
496
499
|
let n = e.width / 2;
|
|
497
500
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
498
501
|
const s = new p({
|
|
@@ -508,10 +511,10 @@ function Q(e, { size: t }) {
|
|
|
508
511
|
height: e.height,
|
|
509
512
|
position: r.Right
|
|
510
513
|
}), h = M(o);
|
|
511
|
-
return o.domNode = h,
|
|
514
|
+
return o.domNode = h, b(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
512
515
|
}
|
|
513
516
|
function Z(e, { size: t }) {
|
|
514
|
-
const i =
|
|
517
|
+
const i = C(t);
|
|
515
518
|
let n = e.width / 2;
|
|
516
519
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
517
520
|
const s = new p({
|
|
@@ -527,10 +530,10 @@ function Z(e, { size: t }) {
|
|
|
527
530
|
height: e.height,
|
|
528
531
|
position: r.Right
|
|
529
532
|
}), h = M(s);
|
|
530
|
-
return s.domNode = h,
|
|
533
|
+
return s.domNode = h, b(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
531
534
|
}
|
|
532
535
|
function tt(e, { size: t }) {
|
|
533
|
-
const i =
|
|
536
|
+
const i = C(t);
|
|
534
537
|
let n = e.height / 2;
|
|
535
538
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
536
539
|
const s = new p({
|
|
@@ -546,10 +549,10 @@ function tt(e, { size: t }) {
|
|
|
546
549
|
height: e.height - n,
|
|
547
550
|
position: r.Bottom
|
|
548
551
|
}), h = M(o);
|
|
549
|
-
return o.domNode = h,
|
|
552
|
+
return o.domNode = h, b(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
550
553
|
}
|
|
551
554
|
function et(e, { size: t }) {
|
|
552
|
-
const i =
|
|
555
|
+
const i = C(t);
|
|
553
556
|
let n = e.height / 2;
|
|
554
557
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
555
558
|
const s = new p({
|
|
@@ -565,7 +568,7 @@ function et(e, { size: t }) {
|
|
|
565
568
|
height: n,
|
|
566
569
|
position: r.Bottom
|
|
567
570
|
}), h = M(s);
|
|
568
|
-
return s.domNode = h,
|
|
571
|
+
return s.domNode = h, b(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
569
572
|
}
|
|
570
573
|
function it(e, { position: t, size: i, minWidth: n, minHeight: s }) {
|
|
571
574
|
if (t === r.Left)
|
|
@@ -584,7 +587,7 @@ const nt = {
|
|
|
584
587
|
},
|
|
585
588
|
// Intended to be overridden
|
|
586
589
|
onPaneCreate(e, t) {
|
|
587
|
-
t.store.content && e.append(
|
|
590
|
+
t.store.content && e.append(m(t.store.content)), this != null && this.debug && (e.style.backgroundColor = W(), e.innerHTML = "", e.append(v(e)));
|
|
588
591
|
},
|
|
589
592
|
updatePane(e) {
|
|
590
593
|
return J(e);
|
|
@@ -700,13 +703,11 @@ const st = {
|
|
|
700
703
|
const [t, i, n, s] = this.activeMuntinSash.getChildren(), o = this.activeMuntinSash.isLeftRightSplit(), h = this.activeMuntinSash.isTopBottomSplit();
|
|
701
704
|
if (o && s && i) {
|
|
702
705
|
const l = e.pageX - this.lastX, a = s.width + l, c = i.width - l;
|
|
703
|
-
if (
|
|
704
|
-
return;
|
|
706
|
+
if (l > 0 && c <= i.calcMinWidth() || l < 0 && a <= s.calcMinWidth()) return;
|
|
705
707
|
s.width = a, i.width = c, i.left = i.left + l, this.update(), this.lastX = e.pageX;
|
|
706
708
|
} else if (h && t && n) {
|
|
707
709
|
const l = e.pageY - this.lastY, a = t.height + l, c = n.height - l;
|
|
708
|
-
if (
|
|
709
|
-
return;
|
|
710
|
+
if (l > 0 && c <= n.calcMinHeight() || l < 0 && a <= t.calcMinHeight()) return;
|
|
710
711
|
t.height = a, n.height = c, n.top = n.top + l, this.update(), this.lastY = e.pageY;
|
|
711
712
|
}
|
|
712
713
|
}), document.addEventListener("mouseup", () => {
|
|
@@ -787,7 +788,7 @@ const dt = {
|
|
|
787
788
|
onClick: (e, t) => {
|
|
788
789
|
const i = t.sillElement;
|
|
789
790
|
if (!i) throw new Error("[bwin] Sill element not found when minimizing");
|
|
790
|
-
const n =
|
|
791
|
+
const n = m('<button class="bw-minimized-glass" />');
|
|
791
792
|
i.append(n);
|
|
792
793
|
const s = e.target.closest("bw-pane"), o = e.target.closest("bw-glass"), h = s.getAttribute("sash-id"), l = s.getAttribute("position");
|
|
793
794
|
n.bwGlassElement = o, n.bwOriginalPosition = l, n.bwOriginalBoundingRect = P(s), t.removePane(h);
|
|
@@ -894,16 +895,16 @@ class x {
|
|
|
894
895
|
t.append(this.createTabs());
|
|
895
896
|
else if (this.title) {
|
|
896
897
|
const s = document.createElement("bw-glass-title");
|
|
897
|
-
s.append(
|
|
898
|
+
s.append(m(this.title)), t.append(s);
|
|
898
899
|
}
|
|
899
900
|
t.setAttribute("can-drag", this.draggable), t.append(this.createActions());
|
|
900
|
-
const i = document.createElement("bw-glass-content"), n =
|
|
901
|
+
const i = document.createElement("bw-glass-content"), n = m(this.content);
|
|
901
902
|
n && i.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(t, i);
|
|
902
903
|
}
|
|
903
904
|
createTabs() {
|
|
904
905
|
const t = document.createElement("bw-glass-tab-container");
|
|
905
906
|
for (const i of this.tabs) {
|
|
906
|
-
const n = (i == null ? void 0 : i.label) ?? i, s =
|
|
907
|
+
const n = (i == null ? void 0 : i.label) ?? i, s = m(`<button class="bw-glass-tab">${n}</button>`);
|
|
907
908
|
t.append(s);
|
|
908
909
|
}
|
|
909
910
|
return t;
|
|
@@ -911,7 +912,7 @@ class x {
|
|
|
911
912
|
createActions() {
|
|
912
913
|
const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ? ft : Array.isArray(this.actions) ? this.actions : [];
|
|
913
914
|
for (const n of i) {
|
|
914
|
-
const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h =
|
|
915
|
+
const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h = m(`<button class="${o}">${s}</button>`);
|
|
915
916
|
typeof n.onClick == "function" && h.addEventListener("click", (l) => {
|
|
916
917
|
n.onClick(l, this.binaryWindow);
|
|
917
918
|
}), t.append(h);
|
|
@@ -979,7 +980,7 @@ class bt extends T {
|
|
|
979
980
|
}
|
|
980
981
|
frame() {
|
|
981
982
|
super.frame(...arguments);
|
|
982
|
-
const i =
|
|
983
|
+
const i = m("<bw-sill />");
|
|
983
984
|
this.windowElement.append(i), this.sillElement = i;
|
|
984
985
|
}
|
|
985
986
|
enableFeatures() {
|