react-bwin 0.4.1 → 0.5.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.
@@ -1,11 +1,12 @@
1
- import e, { forwardRef as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
2
- import { createPortal as s } from "react-dom";
3
- //#region node_modules/.pnpm/bwin@0.4.2/node_modules/bwin/dist/bwin.js
4
- function c(e = .7, t = 128) {
1
+ import * as e from "react";
2
+ import t, { forwardRef as n, useContext as r, useEffect as i, useImperativeHandle as a, useMemo as o, useRef as s, useState as c } from "react";
3
+ import { createPortal as l } from "react-dom";
4
+ //#region node_modules/.pnpm/bwin@0.4.4/node_modules/bwin/dist/bwin.js
5
+ function u(e = .7, t = 128) {
5
6
  let n = 256 - t;
6
7
  return `rgba(${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.max(.5, Math.random() * e)})`;
7
8
  }
8
- function l(e = 2, t = 3) {
9
+ function d(e = 2, t = 3) {
9
10
  if (e < 0 || t < 0) throw Error("Parameters must be non-negative numbers");
10
11
  let n = "";
11
12
  for (let t = 0; t < e; t++) {
@@ -19,14 +20,14 @@ function l(e = 2, t = 3) {
19
20
  }
20
21
  return n;
21
22
  }
22
- function u(e, t) {
23
+ function f(e, t) {
23
24
  for (; t.firstChild;) e.append(t.firstChild);
24
25
  }
25
- function d(e, t) {
26
+ function p(e, t) {
26
27
  let n = document.createElement("div");
27
- u(n, e), u(e, t), u(t, n);
28
+ f(n, e), f(e, t), f(t, n);
28
29
  }
29
- function f(e) {
30
+ function m(e) {
30
31
  if (typeof e == "number" && !isNaN(e)) return e;
31
32
  if (typeof e == "string") {
32
33
  let t = e.trim();
@@ -46,35 +47,35 @@ function f(e) {
46
47
  }
47
48
  return NaN;
48
49
  }
49
- function p(e) {
50
+ function h(e) {
50
51
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
51
52
  }
52
- function m(e, t) {
53
+ function g(e, t) {
53
54
  for (let n in t) {
54
55
  if (Object.hasOwn(e, n)) throw Error(`Key "${n}" already exists in target object`);
55
56
  e[n] = t[n];
56
57
  }
57
58
  return e;
58
59
  }
59
- function h(e) {
60
+ function _(e) {
60
61
  let t = document.createElement("template");
61
62
  return t.innerHTML = e.trim(), t.content;
62
63
  }
63
- function g(e) {
64
+ function v(e) {
64
65
  if (e == null || e === "") return null;
65
66
  if (typeof e == "string") try {
66
- let t = h(e);
67
+ let t = _(e);
67
68
  return t.childNodes.length === 1 ? t.firstChild : t;
68
69
  } catch {
69
70
  return document.createTextNode(e);
70
71
  }
71
72
  return e instanceof Node ? e : document.createTextNode(String(e));
72
73
  }
73
- function _(e) {
74
+ function y(e) {
74
75
  let t = document.createDocumentFragment();
75
76
  return t.append(...e.childNodes), t;
76
77
  }
77
- function v(e) {
78
+ function b(e) {
78
79
  return {
79
80
  left: parseFloat(e.style.left) || 0,
80
81
  top: parseFloat(e.style.top) || 0,
@@ -82,7 +83,7 @@ function v(e) {
82
83
  height: parseFloat(e.style.height) || 0
83
84
  };
84
85
  }
85
- var y = {
86
+ var x = {
86
87
  Top: "top",
87
88
  Right: "right",
88
89
  Bottom: "bottom",
@@ -92,48 +93,48 @@ var y = {
92
93
  Unknown: "unknown",
93
94
  Outside: "outside"
94
95
  };
95
- function b(e) {
96
+ function S(e) {
96
97
  switch (e) {
97
- case y.Top: return y.Bottom;
98
- case y.Right: return y.Left;
99
- case y.Bottom: return y.Top;
100
- case y.Left: return y.Right;
98
+ case x.Top: return x.Bottom;
99
+ case x.Right: return x.Left;
100
+ case x.Bottom: return x.Top;
101
+ case x.Left: return x.Right;
101
102
  default: throw Error(`[bwin] Invalid position: ${e}`);
102
103
  }
103
104
  }
104
- function x({ width: e, height: t, x: n }) {
105
+ function ee({ width: e, height: t, x: n }) {
105
106
  return t / e * n;
106
107
  }
107
- function ee({ width: e, height: t, y: n }) {
108
+ function te({ width: e, height: t, y: n }) {
108
109
  return e / t * n;
109
110
  }
110
- function te({ width: e, height: t, x: n }) {
111
+ function ne({ width: e, height: t, x: n }) {
111
112
  return t - t / e * n;
112
113
  }
113
- function ne({ width: e, height: t, y: n }) {
114
+ function re({ width: e, height: t, y: n }) {
114
115
  return e - e / t * n;
115
116
  }
116
- function S(e, { clientX: t, clientY: n }) {
117
+ function ie(e, { clientX: t, clientY: n }) {
117
118
  let r = e.getBoundingClientRect(), { width: i, height: a } = r, o = t - r.left, s = n - r.top;
118
- if (o < 0 || o > i || s < 0 || s > a) return y.Outside;
119
- let c = .3, l = x({
119
+ if (o < 0 || o > i || s < 0 || s > a) return x.Outside;
120
+ let c = .3, l = ee({
120
121
  width: i,
121
122
  height: a,
122
123
  x: o
123
- }), u = te({
124
+ }), u = ne({
124
125
  width: i,
125
126
  height: a,
126
127
  x: o
127
- }), d = ee({
128
+ }), d = te({
128
129
  width: i,
129
130
  height: a,
130
131
  y: s
131
- }), f = ne({
132
+ }), f = re({
132
133
  width: i,
133
134
  height: a,
134
135
  y: s
135
136
  });
136
- return o < i * (.5 - c / 2) && s > l && s < u ? y.Left : o > i * .65 && s < l && s > u ? y.Right : s < a * (.5 - c / 2) && o > d && o < f ? y.Top : s > a * .65 && o < d && o > f ? y.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? y.Center : y.Unknown;
137
+ return o < i * (.5 - c / 2) && s > l && s < u ? x.Left : o > i * .65 && s < l && s > u ? x.Right : s < a * (.5 - c / 2) && o > d && o < f ? x.Top : s > a * .65 && o < d && o > f ? x.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? x.Center : x.Unknown;
137
138
  }
138
139
  var C = {
139
140
  left: 0,
@@ -144,9 +145,9 @@ var C = {
144
145
  minHeight: 100,
145
146
  resizeStrategy: "classic"
146
147
  }, w = class {
147
- constructor({ left: e = C.left, top: t = C.top, width: n = C.width, height: r = C.height, minWidth: i = C.minWidth, minHeight: a = C.minHeight, resizeStrategy: o = C.resizeStrategy, parent: s = null, domNode: c = null, store: u = {}, position: d, id: f } = C) {
148
- if (this.id = f ?? l(), !d) throw Error("[bwin] Sash position is required");
149
- this.position = d, this.domNode = c, this.parent = s, this._top = t, this._left = e, this._width = n, this._height = r, this.children = [], this.minWidth = i, this.minHeight = a, this.resizeStrategy = o, this.store = u;
148
+ constructor({ left: e = C.left, top: t = C.top, width: n = C.width, height: r = C.height, minWidth: i = C.minWidth, minHeight: a = C.minHeight, resizeStrategy: o = C.resizeStrategy, parent: s = null, domNode: c = null, store: l = {}, position: u, id: f } = C) {
149
+ if (this.id = f ?? d(), !u) throw Error("[bwin] Sash position is required");
150
+ this.position = u, this.domNode = c, this.parent = s, this._top = t, this._left = e, this._width = n, this._height = r, this.children = [], this.minWidth = i, this.minHeight = a, this.resizeStrategy = o, this.store = l;
150
151
  }
151
152
  walk(e) {
152
153
  this.children.forEach((t) => t.walk(e)), e(this);
@@ -158,26 +159,26 @@ var C = {
158
159
  return this.children.length > 0;
159
160
  }
160
161
  isLeftRightSplit() {
161
- return this.children.some((e) => e.position === y.Left || e.position === y.Right);
162
+ return this.children.some((e) => e.position === x.Left || e.position === x.Right);
162
163
  }
163
164
  isTopBottomSplit() {
164
- return this.children.some((e) => e.position === y.Top || e.position === y.Bottom);
165
+ return this.children.some((e) => e.position === x.Top || e.position === x.Bottom);
165
166
  }
166
167
  get leftChild() {
167
- return this.children.find((e) => e.position === y.Left);
168
+ return this.children.find((e) => e.position === x.Left);
168
169
  }
169
170
  get rightChild() {
170
- return this.children.find((e) => e.position === y.Right);
171
+ return this.children.find((e) => e.position === x.Right);
171
172
  }
172
173
  get topChild() {
173
- return this.children.find((e) => e.position === y.Top);
174
+ return this.children.find((e) => e.position === x.Top);
174
175
  }
175
176
  get bottomChild() {
176
- return this.children.find((e) => e.position === y.Bottom);
177
+ return this.children.find((e) => e.position === x.Bottom);
177
178
  }
178
179
  getChildren() {
179
180
  let e = null, t = null, n = null, r = null;
180
- for (let i of this.children) i.position === y.Left ? e = i : i.position === y.Right ? t = i : i.position === y.Top ? n = i : i.position === y.Bottom && (r = i);
181
+ for (let i of this.children) i.position === x.Left ? e = i : i.position === x.Right ? t = i : i.position === x.Top ? n = i : i.position === x.Bottom && (r = i);
181
182
  return [
182
183
  n,
183
184
  t,
@@ -253,7 +254,7 @@ var C = {
253
254
  return this.getAllLeafDescendants().reduce((e, t) => t.width * t.height > e.width * e.height ? t : e);
254
255
  }
255
256
  getRelativeSize() {
256
- return this.parent ? this.position === y.Left || this.position === y.Right ? this.width / this.parent.width : this.height / this.parent.height : 1;
257
+ return this.parent ? this.position === x.Left || this.position === x.Right ? this.width / this.parent.width : this.height / this.parent.height : 1;
257
258
  }
258
259
  get top() {
259
260
  return this._top;
@@ -282,7 +283,7 @@ var C = {
282
283
  let [n, r, i, a] = this.getChildren();
283
284
  if (a && r) {
284
285
  let e = a.width + r.width, n = t * (a.width / e), i = e + t, o, s, c;
285
- if (this.resizeStrategy === "natural" && this.position === y.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === y.Right ? (o = a.width + t, s = r.width, c = a.left + o) : (o = a.width + n, s = i - o, c = r.left + n), t < 0) {
286
+ if (this.resizeStrategy === "natural" && this.position === x.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === x.Right ? (o = a.width + t, s = r.width, c = a.left + o) : (o = a.width + n, s = i - o, c = r.left + n), t < 0) {
286
287
  let e = a.calcMinWidth(), t = r.calcMinWidth();
287
288
  o < e && s > t ? (o = a.width, s = i - o, c = a.left + o) : s < t && o > e && (s = r.width, o = i - s, c = a.left + o);
288
289
  }
@@ -299,7 +300,7 @@ var C = {
299
300
  let [n, r, i, a] = this.getChildren();
300
301
  if (n && i) {
301
302
  let e = n.height + i.height, r = t * (n.height / e), a = e + t, o, s, c;
302
- if (this.resizeStrategy === "natural" && this.position === y.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === y.Bottom ? (o = n.height + t, s = i.height, c = n.top + o) : (o = n.height + r, s = a - o, c = i.top + r), t < 0) {
303
+ if (this.resizeStrategy === "natural" && this.position === x.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === x.Bottom ? (o = n.height + t, s = i.height, c = n.top + o) : (o = n.height + r, s = a - o, c = i.top + r), t < 0) {
303
304
  let e = n.calcMinHeight(), t = i.calcMinHeight();
304
305
  o < e && s > t ? (o = n.height, s = a - o, c = n.top + o) : s < t && o > e && (s = i.height, o = a - s, c = n.top + o);
305
306
  }
@@ -309,8 +310,8 @@ var C = {
309
310
  }
310
311
  }, T = {
311
312
  size: "50%",
312
- position: y.Left
313
- }, re = class e {
313
+ position: x.Left
314
+ }, ae = class e {
314
315
  left;
315
316
  top;
316
317
  width;
@@ -320,39 +321,39 @@ var C = {
320
321
  }
321
322
  getPosition(e) {
322
323
  if (!this.siblingConfigNode) return e;
323
- let t = b(this.siblingConfigNode.position);
324
+ let t = S(this.siblingConfigNode.position);
324
325
  if (!e) return t;
325
326
  if (e !== t) throw Error("[bwin] Sibling position and current position are not opposite");
326
327
  return e;
327
328
  }
328
329
  getSize(e) {
329
- if (!this.siblingConfigNode) return f(e);
330
+ if (!this.siblingConfigNode) return m(e);
330
331
  if (!e) {
331
332
  if (this.siblingConfigNode.size < 1) return 1 - this.siblingConfigNode.size;
332
- if (this.siblingConfigNode.position === y.Left || this.siblingConfigNode.position === y.Right) return this.parentRect.width - this.siblingConfigNode.width;
333
- if (this.siblingConfigNode.position === y.Top || this.siblingConfigNode.position === y.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
333
+ if (this.siblingConfigNode.position === x.Left || this.siblingConfigNode.position === x.Right) return this.parentRect.width - this.siblingConfigNode.width;
334
+ if (this.siblingConfigNode.position === x.Top || this.siblingConfigNode.position === x.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
334
335
  }
335
- let t = f(e);
336
+ let t = m(e);
336
337
  if (t < 1) {
337
338
  if (t + this.siblingConfigNode.size !== 1) throw Error("[bwin] Sum of sibling sizes is not equal to 1");
338
339
  } else {
339
- if ((this.position === y.Left || this.position === y.Right) && t + this.siblingConfigNode.size !== this.parentRect.width) throw Error("[bwin] Sum of sibling sizes is not equal to parent width");
340
- if ((this.position === y.Top || this.position === y.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
340
+ if ((this.position === x.Left || this.position === x.Right) && t + this.siblingConfigNode.size !== this.parentRect.width) throw Error("[bwin] Sum of sibling sizes is not equal to parent width");
341
+ if ((this.position === x.Top || this.position === x.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
341
342
  }
342
343
  return t;
343
344
  }
344
345
  setBounds() {
345
- if (this.position === y.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
346
- else if (this.position === y.Left) {
346
+ if (this.position === x.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
347
+ else if (this.position === x.Left) {
347
348
  let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
348
349
  this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
349
- } else if (this.position === y.Right) {
350
+ } else if (this.position === x.Right) {
350
351
  let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
351
352
  this.left = this.parentRect.left + this.parentRect.width - e, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
352
- } else if (this.position === y.Top) {
353
+ } else if (this.position === x.Top) {
353
354
  let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
354
355
  this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = e;
355
- } else if (this.position === y.Bottom) {
356
+ } else if (this.position === x.Bottom) {
356
357
  let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
357
358
  this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - e, this.width = this.parentRect.width, this.height = e;
358
359
  }
@@ -372,10 +373,10 @@ var C = {
372
373
  });
373
374
  }
374
375
  normConfig(e) {
375
- if (p(e)) return e;
376
+ if (h(e)) return e;
376
377
  if (Array.isArray(e)) return { children: e };
377
378
  if (typeof e == "string" || typeof e == "number") {
378
- let t = f(e);
379
+ let t = m(e);
379
380
  if (isNaN(t)) throw Error(`[bwin] Invalid size value: ${t}`);
380
381
  return { size: e };
381
382
  } else if (e == null) return {};
@@ -410,7 +411,7 @@ var C = {
410
411
  let t = this.createSash({ resizeStrategy: e });
411
412
  if (!Array.isArray(this.children) || this.children.length === 0) return t;
412
413
  let n = this.normConfig(this.children[0]), r = this.normConfig(this.children.at(1)), i, a;
413
- if (!n.size && !n.position && r ? (r.position ||= y.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
414
+ if (!n.size && !n.position && r ? (r.position ||= x.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
414
415
  let n = i.buildSashTree({ resizeStrategy: e }), r = a.buildSashTree({ resizeStrategy: e });
415
416
  n.parent = t, r.parent = t, t.children.push(n), t.children.push(r);
416
417
  }
@@ -422,7 +423,7 @@ var C = {
422
423
  }, D = {
423
424
  fitContainer: !1,
424
425
  theme: ""
425
- }, ie = class extends re {
426
+ }, oe = class extends ae {
426
427
  constructor({ id: e, children: t, width: n = E.width, height: r = E.height, fitContainer: i = D.fitContainer, theme: a = D.theme, ...o } = {
427
428
  ...E,
428
429
  ...D
@@ -431,7 +432,7 @@ var C = {
431
432
  id: e,
432
433
  children: t,
433
434
  size: NaN,
434
- position: y.Root,
435
+ position: x.Root,
435
436
  parentRect: {
436
437
  width: n,
437
438
  height: r
@@ -439,167 +440,185 @@ var C = {
439
440
  ...o
440
441
  }), this.fitContainer = i, this.theme = a;
441
442
  }
442
- }, ae = class extends w {
443
+ }, se = class extends w {
443
444
  constructor(e = C) {
444
445
  super({
445
446
  ...e,
446
- position: y.Root
447
+ position: x.Root
447
448
  }), Object.assign(this, D);
448
449
  }
449
450
  };
450
- function oe(e) {
451
+ function ce(e) {
451
452
  let t = document.createElement("bw-pane");
452
453
  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("sash-id", e.id), t.setAttribute("position", e.position), t;
453
454
  }
454
- function se(e) {
455
+ function le(e) {
455
456
  let t = e.domNode;
456
457
  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;
457
458
  }
458
- function ce(e, { size: t, id: n }) {
459
- let r = f(t), i = e.width / 2;
460
- r && (i = r < 1 ? e.width * r : r);
461
- let a = new w({
459
+ function ue(e, { size: t, id: n, minWidth: r, minHeight: i }) {
460
+ let a = m(t), o = e.width / 2;
461
+ a && (o = a < 1 ? e.width * a : a);
462
+ let s = new w({
462
463
  id: n,
463
464
  top: e.top,
464
465
  left: e.left,
465
- width: i,
466
+ width: o,
466
467
  height: e.height,
467
- position: y.Left
468
- }), o = new w({
468
+ minWidth: r,
469
+ minHeight: i,
470
+ position: x.Left
471
+ }), c = new w({
469
472
  id: e.id,
470
473
  top: e.top,
471
- left: e.left + a.width,
472
- width: e.width - i,
474
+ left: e.left + s.width,
475
+ width: e.width - o,
473
476
  height: e.height,
474
- position: y.Right,
477
+ position: x.Right,
475
478
  domNode: e.domNode
476
479
  });
477
- return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
480
+ return e.addChild(s), e.addChild(c), e.domNode = null, e.id = d(), s;
478
481
  }
479
- function O(e, { size: t, id: n }) {
480
- let r = f(t), i = e.width / 2;
481
- r && (i = r < 1 ? e.width * r : r);
482
- let a = new w({
482
+ function de(e, { size: t, id: n, minWidth: r, minHeight: i }) {
483
+ let a = m(t), o = e.width / 2;
484
+ a && (o = a < 1 ? e.width * a : a);
485
+ let s = new w({
483
486
  id: e.id,
484
487
  left: e.left,
485
488
  top: e.top,
486
- width: e.width - i,
489
+ width: e.width - o,
487
490
  height: e.height,
488
- position: y.Left,
491
+ position: x.Left,
489
492
  domNode: e.domNode
490
- }), o = new w({
493
+ }), c = new w({
491
494
  id: n,
492
- left: e.left + a.width,
495
+ left: e.left + s.width,
493
496
  top: e.top,
494
- width: i,
497
+ width: o,
495
498
  height: e.height,
496
- position: y.Right
499
+ minWidth: r,
500
+ minHeight: i,
501
+ position: x.Right
497
502
  });
498
- return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
503
+ return e.addChild(s), e.addChild(c), e.domNode = null, e.id = d(), c;
499
504
  }
500
- function k(e, { size: t, id: n }) {
501
- let r = f(t), i = e.height / 2;
502
- r && (i = r < 1 ? e.height * r : r);
503
- let a = new w({
505
+ function fe(e, { size: t, id: n, minWidth: r, minHeight: i }) {
506
+ let a = m(t), o = e.height / 2;
507
+ a && (o = a < 1 ? e.height * a : a);
508
+ let s = new w({
504
509
  id: n,
505
510
  left: e.left,
506
511
  top: e.top,
507
512
  width: e.width,
508
- height: i,
509
- position: y.Top
510
- }), o = new w({
513
+ height: o,
514
+ minWidth: r,
515
+ minHeight: i,
516
+ position: x.Top
517
+ }), c = new w({
511
518
  id: e.id,
512
519
  left: e.left,
513
- top: e.top + a.height,
520
+ top: e.top + s.height,
514
521
  width: e.width,
515
- height: e.height - i,
516
- position: y.Bottom,
522
+ height: e.height - o,
523
+ position: x.Bottom,
517
524
  domNode: e.domNode
518
525
  });
519
- return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
526
+ return e.addChild(s), e.addChild(c), e.domNode = null, e.id = d(), s;
520
527
  }
521
- function le(e, { size: t, id: n }) {
522
- let r = f(t), i = e.height / 2;
523
- r && (i = r < 1 ? e.height * r : r);
524
- let a = new w({
528
+ function pe(e, { size: t, id: n, minWidth: r, minHeight: i }) {
529
+ let a = m(t), o = e.height / 2;
530
+ a && (o = a < 1 ? e.height * a : a);
531
+ let s = new w({
525
532
  id: e.id,
526
533
  top: e.top,
527
534
  left: e.left,
528
535
  width: e.width,
529
- height: e.height - i,
530
- position: y.Top,
536
+ height: e.height - o,
537
+ position: x.Top,
531
538
  domNode: e.domNode
532
- }), o = new w({
539
+ }), c = new w({
533
540
  id: n,
534
- top: e.top + a.height,
541
+ top: e.top + s.height,
535
542
  left: e.left,
536
543
  width: e.width,
537
- height: i,
538
- position: y.Bottom
544
+ height: o,
545
+ minWidth: r,
546
+ minHeight: i,
547
+ position: x.Bottom
539
548
  });
540
- return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
549
+ return e.addChild(s), e.addChild(c), e.domNode = null, e.id = d(), c;
541
550
  }
542
- function ue(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
543
- if (t === y.Left) return ce(e, {
551
+ function me(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
552
+ if (t === x.Left) return ue(e, {
544
553
  size: n,
545
- id: r
554
+ id: r,
555
+ minWidth: i,
556
+ minHeight: a
546
557
  });
547
- if (t === y.Right) return O(e, {
558
+ if (t === x.Right) return de(e, {
548
559
  size: n,
549
- id: r
560
+ id: r,
561
+ minWidth: i,
562
+ minHeight: a
550
563
  });
551
- if (t === y.Top) return k(e, {
564
+ if (t === x.Top) return fe(e, {
552
565
  size: n,
553
- id: r
566
+ id: r,
567
+ minWidth: i,
568
+ minHeight: a
554
569
  });
555
- if (t === y.Bottom) return le(e, {
570
+ if (t === x.Bottom) return pe(e, {
556
571
  size: n,
557
- id: r
572
+ id: r,
573
+ minWidth: i,
574
+ minHeight: a
558
575
  });
559
576
  }
560
- function A(e) {
577
+ function O(e) {
561
578
  if (e.tagName === "BW-PANE") return e.getAttribute("sash-id");
562
579
  let t = e.closest("bw-pane");
563
580
  if (!t) throw Error("[bwin] Pane element not found");
564
581
  return t.getAttribute("sash-id");
565
582
  }
566
- var de = {
583
+ var he = {
567
584
  createPane(e) {
568
- let t = oe(e);
585
+ let t = ce(e);
569
586
  return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
570
587
  },
571
588
  onPaneCreate(e, t) {
572
- t.store.content && e.append(g(t.store.content)), this?.debug && (e.style.backgroundColor = c(), e.innerHTML = "", e.append(j(e)));
589
+ t.store.content && e.append(v(t.store.content)), this?.debug && (e.style.backgroundColor = u(), e.innerHTML = "", e.append(k(e)));
573
590
  },
574
591
  updatePane(e) {
575
- return se(e);
592
+ return le(e);
576
593
  },
577
594
  onPaneUpdate(e, t) {
578
- this?.debug && (e.innerHTML = "", e.append(j(e)));
595
+ this?.debug && (e.innerHTML = "", e.append(k(e)));
579
596
  },
580
- addPane(e, { position: t, size: n, id: r }) {
597
+ addPane(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
581
598
  if (!t) throw Error("[bwin] Position is required when adding pane");
582
- let i = this.rootSash.getById(e);
583
- if (!i) throw Error("[bwin] Parent sash not found when adding pane");
584
- let a = ue(i, {
599
+ let o = this.rootSash.getById(e);
600
+ if (!o) throw Error("[bwin] Parent sash not found when adding pane");
601
+ let s = me(o, {
585
602
  position: t,
586
603
  size: n,
587
- id: r
604
+ id: r,
605
+ minWidth: i,
606
+ minHeight: a
588
607
  });
589
- return this.update(), a;
608
+ return this.update(), s;
590
609
  },
591
610
  removePane(e) {
592
611
  let t = this.rootSash.getDescendantParentById(e);
593
612
  if (!t) throw Error("[bwin] Parent sash not found when removing pane");
594
613
  let n = t.getChildSiblingById(e);
595
- n.children.length === 0 ? (t.id = n.id, t.domNode = n.domNode, t.domNode.setAttribute("sash-id", n.id), t.children = []) : (t.id = l(), t.children = n.children, t.children.forEach((e) => e.parent = t), n.position === y.Left ? n.width = t.width : n.position === y.Right ? (n.width = t.width, n.left = t.left) : n.position === y.Top ? n.height = t.height : n.position === y.Bottom && (n.height = t.height, n.top = t.top)), this.update();
614
+ n.children.length === 0 ? (t.id = n.id, t.domNode = n.domNode, t.domNode.setAttribute("sash-id", n.id), t.children = []) : (t.id = d(), t.children = n.children, t.children.forEach((e) => e.parent = t), n.position === x.Left ? n.width = t.width : n.position === x.Right ? (n.width = t.width, n.left = t.left) : n.position === x.Top ? n.height = t.height : n.position === x.Bottom && (n.height = t.height, n.top = t.top)), this.update();
596
615
  },
597
616
  swapPanes(e, t) {
598
- let n = A(e), r = A(t), i = e.getAttribute("can-drop") !== "false", a = t.getAttribute("can-drop") !== "false";
599
- this.rootSash.swapIds(n, r), d(e, this.activeDropPaneEl), e.setAttribute("sash-id", r), t.setAttribute("sash-id", n), e.setAttribute("can-drop", a), t.setAttribute("can-drop", i);
617
+ let n = O(e), r = O(t), i = e.getAttribute("can-drop") !== "false", a = t.getAttribute("can-drop") !== "false";
618
+ this.rootSash.swapIds(n, r), p(e, this.activeDropPaneEl), e.setAttribute("sash-id", r), t.setAttribute("sash-id", n), e.setAttribute("can-drop", a), t.setAttribute("can-drop", i);
600
619
  }
601
620
  };
602
- function j(e) {
621
+ function k(e) {
603
622
  let t = document.createElement("pre");
604
623
  return t.style.fontSize = "10px", t.innerHTML = `
605
624
  ${e.getAttribute("sash-id")}
@@ -610,7 +629,7 @@ width: ${e.style.width}
610
629
  height: ${e.style.height}
611
630
  `.trim(), t;
612
631
  }
613
- var fe = {
632
+ var ge = {
614
633
  createWindow({ theme: e } = {}) {
615
634
  let t = document.createElement("bw-window");
616
635
  return t.style.width = `${this.rootSash.width}px`, t.style.height = `${this.rootSash.height}px`, t.setAttribute("root-sash-id", this.rootSash.id), e && t.setAttribute("theme", e), t;
@@ -631,7 +650,7 @@ var fe = {
631
650
  e.children.length > 0 ? t.includes(e.id) ? (this.updateMuntin(e), this.onMuntinUpdate(e.domNode, e)) : (e.domNode = this.createMuntin(e), this.windowElement.append(e.domNode)) : t.includes(e.id) ? (this.updatePane(e), this.onPaneUpdate(e.domNode, e)) : (e.domNode ||= this.createPane(e), this.windowElement.prepend(e.domNode));
632
651
  });
633
652
  }
634
- }, pe = {
653
+ }, _e = {
635
654
  muntinSize: 4,
636
655
  createMuntin(e) {
637
656
  let t = document.createElement("bw-muntin"), n = e.leftChild, r = e.topChild;
@@ -643,7 +662,7 @@ var fe = {
643
662
  n ? (t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + n.width - this.muntinSize / 2}px`) : r && (t.style.width = `${e.width}px`, t.style.top = `${e.top + r.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`);
644
663
  },
645
664
  onMuntinUpdate(e, t) {}
646
- }, me = {
665
+ }, ve = {
647
666
  fitContainer: !1,
648
667
  fit() {
649
668
  this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
@@ -655,7 +674,7 @@ var fe = {
655
674
  });
656
675
  }).observe(this.containerElement);
657
676
  }
658
- }, he = {
677
+ }, ye = {
659
678
  activeMuntinSash: null,
660
679
  isResizeStarted: !1,
661
680
  isDropStarted: !1,
@@ -688,7 +707,7 @@ var fe = {
688
707
  this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
689
708
  });
690
709
  }
691
- }, ge = {
710
+ }, be = {
692
711
  activeDropPaneEl: null,
693
712
  onPaneDrop(e, t) {},
694
713
  enableDrop() {
@@ -696,7 +715,7 @@ var fe = {
696
715
  e.preventDefault();
697
716
  let t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
698
717
  if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
699
- let n = S(t, e);
718
+ let n = ie(t, e);
700
719
  t.setAttribute("drop-area", n);
701
720
  }), this.windowElement.addEventListener("dragleave", (e) => {
702
721
  e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || (this.activeDropPaneEl &&= (this.activeDropPaneEl.removeAttribute("drop-area"), null));
@@ -706,13 +725,13 @@ var fe = {
706
725
  this.onPaneDrop(e, n), typeof n.store.onDrop == "function" && n.store.onDrop(e, n), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
707
726
  });
708
727
  }
709
- }, _e = !1, M = class {
728
+ }, xe = !1, A = class {
710
729
  windowElement = null;
711
730
  containerElement = null;
712
- debug = _e;
731
+ debug = xe;
713
732
  constructor(e) {
714
733
  let t = null;
715
- e instanceof ae ? (t = e, this.rootSash = e) : (t = new ie(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer;
734
+ e instanceof se ? (t = e, this.rootSash = e) : (t = new oe(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer;
716
735
  }
717
736
  frame(e) {
718
737
  this.containerElement = e, this.windowElement = this.createWindow({ theme: this.theme }), this.glaze(), this.containerElement.append(this.windowElement);
@@ -725,12 +744,12 @@ var fe = {
725
744
  }
726
745
  static assemble(...e) {
727
746
  e.forEach((e) => {
728
- m(this.prototype, e);
747
+ g(this.prototype, e);
729
748
  });
730
749
  }
731
750
  };
732
- M.assemble(fe, pe, de, me, ge, he);
733
- function N(e, t) {
751
+ A.assemble(ge, _e, he, ve, be, ye);
752
+ function j(e, t) {
734
753
  let n = e.left + e.width, r = e.top + e.height, i = t.left + t.width, a = t.top + t.height;
735
754
  if (e.left >= i || t.left >= n || e.top >= a || t.top >= r) return null;
736
755
  let o = Math.max(e.left, t.left), s = Math.max(e.top, t.top), c = Math.min(n, i), l = Math.min(r, a);
@@ -741,28 +760,29 @@ function N(e, t) {
741
760
  height: l - s
742
761
  };
743
762
  }
744
- var P = {
763
+ var M = {
745
764
  enableGlassActions() {
746
765
  this.handleMinimizedGlassClick(), this.observeActionButtons();
747
766
  },
748
767
  restoreGlass(e) {
749
768
  let t = e.bwOriginalBoundingRect, n = 0, r = null;
750
769
  if (this.windowElement.querySelectorAll("bw-pane").forEach((e) => {
751
- let i = N(t, v(e));
770
+ let i = j(t, b(e));
752
771
  if (i) {
753
772
  let t = i.width * i.height;
754
773
  t > n && (n = t, r = e);
755
774
  }
756
775
  }), r) {
757
- let n = e.bwOriginalPosition, i = v(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
758
- if (n === y.Left || n === y.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
759
- else if (n === y.Top || n === y.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
776
+ let n = e.bwOriginalPosition, i = b(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
777
+ if (n === x.Left || n === x.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
778
+ else if (n === x.Top || n === x.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
760
779
  else throw Error("[bwin] Invalid position when restoring glass");
761
780
  let c = e.bwOriginalSashId;
762
781
  this.addPane(r.getAttribute("sash-id"), {
763
782
  id: c,
764
783
  position: n,
765
- size: s
784
+ size: s,
785
+ withGlass: !1
766
786
  }).domNode.append(e.bwGlassElement);
767
787
  }
768
788
  },
@@ -795,20 +815,21 @@ var P = {
795
815
  });
796
816
  }).observe(this.windowElement, { childList: !0 });
797
817
  }
798
- }, F = null, I = !1, ve = {
818
+ }, N = null, P = !1, Se = {
799
819
  onPaneDrop(e, t) {
800
- if (!F) return;
820
+ if (!N) return;
801
821
  let n = this.activeDropPaneEl.getAttribute("drop-area");
802
822
  if (n === "center") {
803
- let e = F.closest("bw-pane");
823
+ let e = N.closest("bw-pane");
804
824
  this.swapPanes(e, this.activeDropPaneEl);
805
825
  return;
806
826
  } else {
807
- let e = A(F);
827
+ let e = O(N);
808
828
  this.removePane(e), this.addPane(t.id, {
809
829
  position: n,
810
- id: e
811
- }).domNode.replaceChildren(F);
830
+ id: e,
831
+ withGlass: !1
832
+ }).domNode.append(N);
812
833
  }
813
834
  },
814
835
  enableGlassDrag() {
@@ -819,62 +840,62 @@ var P = {
819
840
  return;
820
841
  }
821
842
  let t = e.target.closest("bw-glass");
822
- t.setAttribute("draggable", !0), F = t;
843
+ t.setAttribute("draggable", !0), N = t;
823
844
  }), document.addEventListener("mouseup", () => {
824
- F &&= (F.removeAttribute("draggable"), null);
845
+ N &&= (N.removeAttribute("draggable"), null);
825
846
  }), this.windowElement.addEventListener("dragstart", (e) => {
826
- if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !F) return;
847
+ if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !N) return;
827
848
  e.dataTransfer.effectAllowed = "move";
828
- let t = F.closest("bw-pane");
829
- I = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
849
+ let t = N.closest("bw-pane");
850
+ P = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
830
851
  }), this.windowElement.addEventListener("dragend", () => {
831
- F &&= (F.removeAttribute("draggable"), F.closest("bw-pane").setAttribute("can-drop", I), null);
852
+ N &&= (N.removeAttribute("draggable"), N.closest("bw-pane").setAttribute("can-drop", P), null);
832
853
  });
833
854
  }
834
- }, L = {
855
+ }, F = {
835
856
  label: "",
836
857
  className: "bw-glass-action--close",
837
858
  onClick: (e, t) => {
838
- let n = A(e.target);
859
+ let n = O(e.target);
839
860
  t.removePane(n);
840
861
  }
841
- }, R = {
862
+ }, I = {
842
863
  label: "",
843
864
  className: "bw-glass-action--minimize",
844
865
  onClick: (e, t) => {
845
866
  let n = t.sillElement;
846
867
  if (!n) throw Error("[bwin] Sill element not found when minimizing");
847
- let r = g("<button class=\"bw-minimized-glass\" />");
868
+ let r = v("<button class=\"bw-minimized-glass\" />");
848
869
  n.append(r);
849
870
  let i = e.target.closest("bw-pane"), a = e.target.closest("bw-glass"), o = i.getAttribute("sash-id"), s = i.getAttribute("position");
850
- r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = v(i), r.bwOriginalSashId = o, t.removePane(o);
871
+ r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = b(i), r.bwOriginalSashId = o, t.removePane(o);
851
872
  }
852
- }, ye = {
873
+ }, Ce = {
853
874
  label: "",
854
875
  className: "bw-glass-action--maximize",
855
876
  onClick: (e) => {
856
877
  let t = e.target.closest("bw-pane");
857
- t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = v(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
878
+ t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = b(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
858
879
  }
859
- }, z = 15, B = {
880
+ }, L = 15, R = {
860
881
  label: "",
861
882
  className: "bw-glass-action--detach",
862
883
  onClick: (e, t) => {
863
884
  if (!t.addDetachedGlass) throw Error("[bwin] Failed to detach glass from pane");
864
- let n = e.target.closest("bw-pane"), r = n.querySelector("bw-glass-content"), i = n.querySelector("bw-glass-title"), a = t.windowElement.getBoundingClientRect(), o = a.width - z * 2, s = a.height - z * 2, c = t.addDetachedGlass({
885
+ let n = e.target.closest("bw-pane"), r = n.querySelector("bw-glass-content"), i = n.querySelector("bw-glass-title"), a = t.windowElement.getBoundingClientRect(), o = a.width - L * 2, s = a.height - L * 2, c = t.addDetachedGlass({
865
886
  position: "center",
866
887
  width: o,
867
888
  height: s
868
889
  }), l = n.getAttribute("sash-id"), u = t.rootSash.getById(l), d = u.parent.getChildSiblingById(l).id;
869
890
  c.domNode.bwOriginalSiblingSashId = d, c.domNode.bwOriginalPosition = n.getAttribute("position"), c.domNode.bwOriginalRelativeSize = u.getRelativeSize(), c.contentElement.replaceWith(r), i && c.titleElement.replaceWith(i), t.removePane(l);
870
891
  }
871
- }, V = [
892
+ }, z = [
893
+ I,
872
894
  R,
873
- B,
874
- L
875
- ], H = class {
895
+ F
896
+ ], B = class {
876
897
  domNode;
877
- constructor({ title: e = null, content: t = null, tabs: n = [], actions: r = V, draggable: i = !0, sash: a = null, binaryWindow: o }) {
898
+ constructor({ title: e = null, content: t = null, tabs: n = [], actions: r = z, draggable: i = !0, sash: a = null, binaryWindow: o }) {
878
899
  this.title = e, this.content = t, this.tabs = n, this.actions = r, this.sash = a, this.draggable = i, this.binaryWindow = o, this.build();
879
900
  }
880
901
  build() {
@@ -882,16 +903,16 @@ var P = {
882
903
  if (Array.isArray(this.tabs) && this.tabs.length > 0) e.append(this.createTabs());
883
904
  else {
884
905
  let t = document.createElement("bw-glass-title");
885
- this.title && t.append(g(this.title)), e.append(t);
906
+ this.title && t.append(v(this.title)), e.append(t);
886
907
  }
887
908
  e.setAttribute("can-drag", this.draggable), e.append(this.createActions());
888
- let t = document.createElement("bw-glass-content"), n = g(this.content);
909
+ let t = document.createElement("bw-glass-content"), n = v(this.content);
889
910
  n && t.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(e, t);
890
911
  }
891
912
  createTabs() {
892
913
  let e = document.createElement("bw-glass-tab-container");
893
914
  for (let t of this.tabs) {
894
- let n = g(`<button class="bw-glass-tab">${t?.label ?? t}</button>`);
915
+ let n = v(`<button class="bw-glass-tab">${t?.label ?? t}</button>`);
895
916
  e.append(n);
896
917
  }
897
918
  return e;
@@ -899,7 +920,7 @@ var P = {
899
920
  createActions() {
900
921
  let e = document.createElement("bw-glass-action-container"), t = Array.isArray(this.actions) ? this.actions : [];
901
922
  for (let n of t) {
902
- let t = n?.label ?? n, r = g(`<button class="${n.className ? `bw-glass-action ${n.className}` : "bw-glass-action"}">${t}</button>`);
923
+ let t = n?.label ?? n, r = v(`<button class="${n.className ? `bw-glass-action ${n.className}` : "bw-glass-action"}">${t}</button>`);
903
924
  typeof n.onClick == "function" && r.addEventListener("click", (e) => {
904
925
  n.onClick(e, this.binaryWindow);
905
926
  }), e.append(r);
@@ -915,18 +936,18 @@ var P = {
915
936
  get titleElement() {
916
937
  return this.domNode.querySelector("bw-glass-title");
917
938
  }
918
- }, be = [
939
+ }, we = [
940
+ I,
941
+ Ce,
919
942
  R,
920
- ye,
921
- B,
922
- L
923
- ], xe = {
943
+ F
944
+ ], Te = {
924
945
  enableGlassFeature() {
925
946
  this.enableGlassActions(), this.enableGlassDrag();
926
947
  },
927
- ...P,
928
- ...ve
929
- }, Se = {
948
+ ...M,
949
+ ...Se
950
+ }, Ee = {
930
951
  trimMuntin(e) {
931
952
  e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
932
953
  },
@@ -936,7 +957,7 @@ var P = {
936
957
  onMuntinUpdate(e) {
937
958
  this.trimMuntin(e);
938
959
  }
939
- }, Ce = [
960
+ }, De = [
940
961
  "n",
941
962
  "s",
942
963
  "e",
@@ -946,13 +967,13 @@ var P = {
946
967
  "se",
947
968
  "sw"
948
969
  ];
949
- function we() {
950
- return Ce.map((e) => {
970
+ function Oe() {
971
+ return De.map((e) => {
951
972
  let t = document.createElement("bw-glass-resize-handle");
952
973
  return t.setAttribute("resize-dir", e), t;
953
974
  });
954
975
  }
955
- function Te({ position: e, offset: t, offsetX: n, offsetY: r, width: i, height: a }) {
976
+ function ke({ position: e, offset: t, offsetX: n, offsetY: r, width: i, height: a }) {
956
977
  let o = n ?? t, s = r ?? t;
957
978
  switch (e) {
958
979
  case "top-left": return {
@@ -988,7 +1009,7 @@ function Te({ position: e, offset: t, offsetX: n, offsetY: r, width: i, height:
988
1009
  default: throw Error(`Position "${e}" is not supported for detached glass.`);
989
1010
  }
990
1011
  }
991
- var U = new class {
1012
+ var V = new class {
992
1013
  constructor() {
993
1014
  this.glasses = [], this.topZIndex = 1;
994
1015
  }
@@ -1009,14 +1030,14 @@ var U = new class {
1009
1030
  }
1010
1031
  return null;
1011
1032
  }
1012
- }(), W = [
1033
+ }(), H = [
1013
1034
  {
1014
1035
  label: "",
1015
1036
  className: "bw-glass-action--minimize",
1016
1037
  onClick: (e, t) => {
1017
1038
  let n = t.sillElement;
1018
1039
  if (!n) throw Error("[bwin] Sill element not found when minimizing");
1019
- let r = g("<button class=\"bw-minimized-detached-glass\" />");
1040
+ let r = v("<button class=\"bw-minimized-detached-glass\" />");
1020
1041
  n.append(r);
1021
1042
  let i = e.target.closest("bw-glass[detached]");
1022
1043
  if (!i) throw Error("[bwin] Detached Glass element not found when minimizing");
@@ -1036,7 +1057,7 @@ var U = new class {
1036
1057
  t.addPane(s, {
1037
1058
  position: c,
1038
1059
  size: l,
1039
- content: _(u),
1060
+ content: y(u),
1040
1061
  title: n.querySelector("bw-glass-title")?.textContent || ""
1041
1062
  }), t.removeDetachedGlass(n.id);
1042
1063
  }
@@ -1046,17 +1067,17 @@ var U = new class {
1046
1067
  className: "bw-glass-action--close",
1047
1068
  onClick: (e) => {
1048
1069
  let t = e.target.closest("bw-glass[detached]");
1049
- t && (U.removeGlassById(t.id), t.remove());
1070
+ t && (V.removeGlassById(t.id), t.remove());
1050
1071
  }
1051
1072
  }
1052
- ], Ee = class extends H {
1073
+ ], U = class extends B {
1053
1074
  constructor(e) {
1054
- let { position: t, width: n = 222, height: r = 222, offset: i = 0, offsetX: a, offsetY: o, id: s, actions: c = W, ...u } = e;
1075
+ let { position: t, width: n = 222, height: r = 222, offset: i = 0, offsetX: a, offsetY: o, id: s, actions: c = H, ...l } = e;
1055
1076
  super({
1056
- ...u,
1077
+ ...l,
1057
1078
  actions: c
1058
- }), this.domNode.setAttribute("id", s || l() + "-F"), this.domNode.setAttribute("detached", ""), this.domNode.style.position = "absolute", this.domNode.style.width = `${n}px`, this.domNode.style.height = `${r}px`;
1059
- let { top: d, left: f, right: p, bottom: m } = Te({
1079
+ }), this.domNode.setAttribute("id", s || d() + "-F"), this.domNode.setAttribute("detached", ""), this.domNode.style.position = "absolute", this.domNode.style.width = `${n}px`, this.domNode.style.height = `${r}px`;
1080
+ let { top: u, left: f, right: p, bottom: m } = ke({
1060
1081
  position: t,
1061
1082
  offset: i,
1062
1083
  offsetX: a,
@@ -1064,25 +1085,25 @@ var U = new class {
1064
1085
  width: n,
1065
1086
  height: r
1066
1087
  });
1067
- this.domNode.style.top = d, this.domNode.style.left = f, this.domNode.style.right = p, this.domNode.style.bottom = m;
1088
+ this.domNode.style.top = u, this.domNode.style.left = f, this.domNode.style.right = p, this.domNode.style.bottom = m;
1068
1089
  }
1069
- }, De = 200, Oe = 200, G = 25;
1070
- function ke(e, { width: t, height: n }) {
1071
- let r = U.getActiveGlass();
1090
+ }, Ae = 200, je = 200, W = 25;
1091
+ function Me(e, { width: t, height: n }) {
1092
+ let r = V.getActiveGlass();
1072
1093
  if (!r) return { position: "center" };
1073
- let i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = a.left - i.left + G, s = a.top - i.top + G;
1074
- return o + t > i.width && (o = G), s + n > i.height && (s = G), {
1094
+ let i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = a.left - i.left + W, s = a.top - i.top + W;
1095
+ return o + t > i.width && (o = W), s + n > i.height && (s = W), {
1075
1096
  position: "top-left",
1076
1097
  offsetX: o,
1077
1098
  offsetY: s
1078
1099
  };
1079
1100
  }
1080
- var Ae = {
1101
+ var Ne = {
1081
1102
  addDetachedGlass(e = {}) {
1082
- let t = e.width ?? De, n = e.height ?? Oe, { position: r, offsetX: i, offsetY: a } = e.position ? {} : ke(this.windowElement, {
1103
+ let t = e.width ?? Ae, n = e.height ?? je, { position: r, offsetX: i, offsetY: a } = e.position ? {} : Me(this.windowElement, {
1083
1104
  width: t,
1084
1105
  height: n
1085
- }), o = new Ee({
1106
+ }), o = new U({
1086
1107
  actions: this.actions[1],
1087
1108
  binaryWindow: this,
1088
1109
  position: r,
@@ -1092,19 +1113,19 @@ var Ae = {
1092
1113
  width: t,
1093
1114
  height: n
1094
1115
  });
1095
- return this.windowElement.append(o.domNode), U.addGlassByElement(o.domNode), U.bringToFront(o.domNode), o;
1116
+ return this.windowElement.append(o.domNode), V.addGlassByElement(o.domNode), V.bringToFront(o.domNode), o;
1096
1117
  },
1097
1118
  removeDetachedGlass(e) {
1098
- let t = U.removeGlassById(e);
1119
+ let t = V.removeGlassById(e);
1099
1120
  return t?.remove(), t;
1100
1121
  }
1101
- }, je = { enableDetachedGlassActivate() {
1122
+ }, Pe = { enableDetachedGlassActivate() {
1102
1123
  this.windowElement.addEventListener("pointerdown", (e) => {
1103
1124
  if (e.button !== 0) return;
1104
1125
  let t = e.target.closest?.("bw-glass[detached]");
1105
- t && U.bringToFront(t);
1126
+ t && V.bringToFront(t);
1106
1127
  });
1107
- } }, Me = { enableDetachedGlassMove() {
1128
+ } }, Fe = { enableDetachedGlassMove() {
1108
1129
  let e = null, t = 0, n = 0, r = 0, i = 0;
1109
1130
  this.windowElement.addEventListener("pointerdown", (a) => {
1110
1131
  if (a.button !== 0) return;
@@ -1122,43 +1143,43 @@ var Ae = {
1122
1143
  }), this.windowElement.addEventListener("pointerup", (t) => {
1123
1144
  e &&= (t.target.hasPointerCapture?.(t.pointerId) && t.target.releasePointerCapture(t.pointerId), null);
1124
1145
  });
1125
- } }, K = null, q = 0, J = 0, Ne = { enableDetachedGlassDrag() {
1146
+ } }, G = null, K = 0, q = 0, Ie = { enableDetachedGlassDrag() {
1126
1147
  document.addEventListener("mousedown", (e) => {
1127
1148
  if (e.button !== 0) return;
1128
1149
  let t = e.target.closest("bw-glass-header");
1129
1150
  if (!t || e.target.closest("button") || t.getAttribute("can-drag") === "false") return;
1130
1151
  let n = t.closest("bw-glass[detached]");
1131
- n && (n.setAttribute("draggable", !0), K = n);
1152
+ n && (n.setAttribute("draggable", !0), G = n);
1132
1153
  }), document.addEventListener("mouseup", () => {
1133
- K &&= (K.removeAttribute("draggable"), null);
1154
+ G &&= (G.removeAttribute("draggable"), null);
1134
1155
  }), this.windowElement.addEventListener("dragstart", (e) => {
1135
- if (!K) return;
1156
+ if (!G) return;
1136
1157
  e.dataTransfer.effectAllowed = "move";
1137
- let t = K.getBoundingClientRect();
1138
- q = e.clientX - t.left, J = e.clientY - t.top;
1158
+ let t = G.getBoundingClientRect();
1159
+ K = e.clientX - t.left, q = e.clientY - t.top;
1139
1160
  }), this.windowElement.addEventListener("dragend", (e) => {
1140
- if (!K) return;
1141
- let t = this.windowElement.getBoundingClientRect(), n = e.clientX - t.left - q, r = e.clientY - t.top - J;
1142
- K.style.right = "auto", K.style.bottom = "auto", K.style.left = `${n}px`, K.style.top = `${r}px`, K.removeAttribute("draggable"), K = null;
1161
+ if (!G) return;
1162
+ let t = this.windowElement.getBoundingClientRect(), n = e.clientX - t.left - K, r = e.clientY - t.top - q;
1163
+ G.style.right = "auto", G.style.bottom = "auto", G.style.left = `${n}px`, G.style.top = `${r}px`, G.removeAttribute("draggable"), G = null;
1143
1164
  });
1144
- } }, Y = 100, X = 60;
1145
- function Pe(e) {
1165
+ } }, J = 100, Y = 60;
1166
+ function Le(e) {
1146
1167
  return !!e.querySelector(":scope > bw-glass-resize-handle");
1147
1168
  }
1148
- function Fe(e) {
1149
- Pe(e) || e.append(...we());
1169
+ function Re(e) {
1170
+ Le(e) || e.append(...Oe());
1150
1171
  }
1151
- function Z(e) {
1172
+ function X(e) {
1152
1173
  e.querySelectorAll(":scope > bw-glass-resize-handle").forEach((e) => e.remove());
1153
1174
  }
1154
- var Ie = { enableDetachedGlassResize() {
1175
+ var ze = { enableDetachedGlassResize() {
1155
1176
  let e = null, t = "", n = 0, r = 0, i = null;
1156
1177
  this.windowElement.addEventListener("pointerover", (e) => {
1157
1178
  let t = e.target.closest?.("bw-glass[detached]");
1158
- t && Fe(t);
1179
+ t && Re(t);
1159
1180
  }), this.windowElement.addEventListener("pointerout", (t) => {
1160
1181
  let n = t.target.closest?.("bw-glass[detached]");
1161
- n && t.relatedTarget?.closest?.("bw-glass[detached]") !== n && n !== e && Z(n);
1182
+ n && t.relatedTarget?.closest?.("bw-glass[detached]") !== n && n !== e && X(n);
1162
1183
  }), this.windowElement.addEventListener("pointerdown", (a) => {
1163
1184
  if (a.button !== 0 || a.target.tagName !== "BW-GLASS-RESIZE-HANDLE") return;
1164
1185
  let o = a.target.closest("bw-glass[detached]");
@@ -1174,45 +1195,45 @@ var Ie = { enableDetachedGlassResize() {
1174
1195
  }), this.windowElement.addEventListener("pointermove", (a) => {
1175
1196
  if (!e) return;
1176
1197
  let o = t, s = a.pageX - n, c = a.pageY - r, l = i, { left: u, top: d, width: f, height: p } = l;
1177
- o.includes("e") ? f = Math.max(Y, l.width + s) : o.includes("w") && (f = Math.max(Y, l.width - s), u = l.left + (l.width - f)), o.includes("s") ? p = Math.max(X, l.height + c) : o.includes("n") && (p = Math.max(X, l.height - c), d = l.top + (l.height - p)), e.style.right = "auto", e.style.bottom = "auto", e.style.left = `${u}px`, e.style.top = `${d}px`, e.style.width = `${f}px`, e.style.height = `${p}px`;
1198
+ o.includes("e") ? f = Math.max(J, l.width + s) : o.includes("w") && (f = Math.max(J, l.width - s), u = l.left + (l.width - f)), o.includes("s") ? p = Math.max(Y, l.height + c) : o.includes("n") && (p = Math.max(Y, l.height - c), d = l.top + (l.height - p)), e.style.right = "auto", e.style.bottom = "auto", e.style.left = `${u}px`, e.style.top = `${d}px`, e.style.width = `${f}px`, e.style.height = `${p}px`;
1178
1199
  }), this.windowElement.addEventListener("pointerup", (n) => {
1179
1200
  if (!e) return;
1180
1201
  n.target.hasPointerCapture?.(n.pointerId) && n.target.releasePointerCapture(n.pointerId);
1181
1202
  let r = e;
1182
- e = null, t = "", i = null, r.matches(":hover") || Z(r);
1203
+ e = null, t = "", i = null, r.matches(":hover") || X(r);
1183
1204
  });
1184
- } }, Le = { handleMinimizedDetachedGlassClick() {
1205
+ } }, Be = { handleMinimizedDetachedGlassClick() {
1185
1206
  this.sillElement.addEventListener("click", (e) => {
1186
1207
  let t = e.target;
1187
1208
  if (!t.matches(".bw-minimized-detached-glass")) return;
1188
1209
  let n = t.bwDetachedGlassElement;
1189
- n && (n.style.display = "", t.remove(), U.bringToFront(n));
1210
+ n && (n.style.display = "", t.remove(), V.bringToFront(n));
1190
1211
  });
1191
- } }, Re = {
1212
+ } }, Ve = {
1192
1213
  enableDetachedGlassFeatures() {
1193
1214
  this.enableDetachedGlassActivate(), this.enableDetachedGlassResize(), this.enableDetachedGlassMove(), this.handleMinimizedDetachedGlassClick();
1194
1215
  },
1195
- ...Ae,
1196
- ...je,
1197
- ...Me,
1198
1216
  ...Ne,
1217
+ ...Pe,
1218
+ ...Fe,
1199
1219
  ...Ie,
1200
- ...Le
1201
- }, Q = class e extends M {
1220
+ ...ze,
1221
+ ...Be
1222
+ }, Z = class e extends A {
1202
1223
  sillElement = null;
1203
1224
  constructor(t) {
1204
1225
  super(t), this.theme = t.theme || "", this.actions = e.normActions(t.actions);
1205
1226
  }
1206
1227
  frame() {
1207
1228
  super.frame(...arguments);
1208
- let e = g("<bw-sill />");
1229
+ let e = v("<bw-sill />");
1209
1230
  this.windowElement.append(e), this.sillElement = e;
1210
1231
  }
1211
1232
  enableFeatures() {
1212
1233
  super.enableFeatures(), this.enableGlassFeature(), this.enableDetachedGlassFeatures();
1213
1234
  }
1214
1235
  onPaneCreate(e, t) {
1215
- let n = this.actions[0], r = new H({
1236
+ let n = this.actions[0], r = new B({
1216
1237
  actions: n,
1217
1238
  ...t.store,
1218
1239
  sash: t,
@@ -1222,16 +1243,22 @@ var Ie = { enableDetachedGlassResize() {
1222
1243
  }
1223
1244
  onPaneUpdate() {}
1224
1245
  addPane(e, t) {
1225
- let { position: n, size: r, id: i, ...a } = t, o = super.addPane(e, {
1246
+ let { position: n, size: r, id: i, minWidth: a, minHeight: o, withGlass: s = !0, ...c } = t, l = super.addPane(e, {
1226
1247
  position: n,
1227
1248
  size: r,
1228
- id: i
1229
- }), s = new H({
1230
- ...a,
1231
- sash: o,
1232
- binaryWindow: this
1249
+ id: i,
1250
+ minWidth: a,
1251
+ minHeight: o
1233
1252
  });
1234
- return o.domNode.append(s.domNode), o;
1253
+ if (s) {
1254
+ let e = new B({
1255
+ ...c,
1256
+ sash: l,
1257
+ binaryWindow: this
1258
+ });
1259
+ l.domNode.append(e.domNode);
1260
+ }
1261
+ return l;
1235
1262
  }
1236
1263
  setTheme(e) {
1237
1264
  if (!e) {
@@ -1249,108 +1276,138 @@ var Ie = { enableDetachedGlassResize() {
1249
1276
  t && t.remove();
1250
1277
  }
1251
1278
  static normActions(e) {
1252
- if (e === void 0) return [V, W];
1279
+ if (e === void 0) return [z, H];
1253
1280
  if (!e || !Array.isArray(e) || e.length === 0) return [[], []];
1254
- if (e.length === 1 && Array.isArray(e[0])) return [e[0], W];
1255
- if (!e.some(Array.isArray)) return [e, W];
1281
+ if (e.length === 1 && Array.isArray(e[0])) return [e[0], H];
1282
+ if (!e.some(Array.isArray)) return [e, H];
1256
1283
  if (e.length >= 2 && !Array.isArray(e[0]) && Array.isArray(e[1])) return [[], e[1]];
1257
1284
  if (e.length >= 2 && Array.isArray(e[0]) && !Array.isArray(e[1])) return [e[0], []];
1258
1285
  if (e.length >= 2 && Array.isArray(e[0]) && Array.isArray(e[1])) return e;
1259
1286
  throw Error("[bwin] Invalid actions format");
1260
1287
  }
1261
1288
  };
1262
- Q.assemble(xe, Re, Se);
1289
+ Z.assemble(Te, Ve, Ee);
1263
1290
  //#endregion
1264
1291
  //#region src/Muntin.tsx
1265
- var $ = 4;
1266
- function ze({ sash: t }) {
1267
- let r = a(), i = t.leftChild, o = t.topChild, s, c, l, u, d, f;
1268
- return i ? (s = $, c = t.height - $, l = t.top + $ / 2, u = t.left + i.width - $ / 2, d = !0) : o && (s = t.width - $, c = $, l = t.top + o.height - $ / 2, u = t.left + $ / 2, f = !0), n(() => {
1269
- t.domNode = r.current;
1270
- }, []), /* @__PURE__ */ e.createElement("bw-muntin", {
1271
- "sash-id": t.id,
1292
+ var Q = 4;
1293
+ function He({ sash: e }) {
1294
+ let n = s(), r = e.leftChild, a = e.topChild, o, c, l, u, d, f;
1295
+ return r ? (o = Q, c = e.height - Q, l = e.top + Q / 2, u = e.left + r.width - Q / 2, d = !0) : a && (o = e.width - Q, c = Q, l = e.top + a.height - Q / 2, u = e.left + Q / 2, f = !0), i(() => {
1296
+ e.domNode = n.current;
1297
+ }, []), /* @__PURE__ */ t.createElement("bw-muntin", {
1298
+ "sash-id": e.id,
1272
1299
  style: {
1273
- width: s,
1300
+ width: o,
1274
1301
  height: c,
1275
1302
  top: l,
1276
1303
  left: u
1277
1304
  },
1278
1305
  vertical: d,
1279
1306
  horizontal: f,
1280
- resizable: t.store?.resizable === !1 ? "false" : "true",
1281
- ref: r
1307
+ resizable: e.store?.resizable === !1 ? "false" : "true",
1308
+ ref: n
1282
1309
  });
1283
1310
  }
1284
1311
  //#endregion
1285
1312
  //#region src/Pane.tsx
1286
- function Be({ sash: t, bwin: r }) {
1287
- let i = a(), { left: o, top: s, width: c, height: l, id: u, position: d } = t;
1288
- n(() => {
1289
- t.domNode = i.current;
1313
+ function Ue({ sash: e, bwin: n }) {
1314
+ let r = s(), { left: a, top: o, width: c, height: l, id: u, position: d } = e;
1315
+ i(() => {
1316
+ e.domNode = r.current;
1290
1317
  }, []);
1291
- let f = t.store?.actions === void 0 ? r.actions[0] : Array.isArray(t.store.actions) ? t.store.actions : [];
1292
- return /* @__PURE__ */ e.createElement("bw-pane", {
1318
+ let f = e.store?.actions === void 0 ? n.actions[0] : Array.isArray(e.store.actions) ? e.store.actions : [];
1319
+ return /* @__PURE__ */ t.createElement("bw-pane", {
1293
1320
  "sash-id": u,
1294
1321
  position: d,
1295
1322
  style: {
1296
- left: o,
1297
- top: s,
1323
+ left: a,
1324
+ top: o,
1298
1325
  width: c,
1299
1326
  height: l
1300
1327
  },
1301
- "can-drop": t.store?.droppable === !1 ? "false" : "true",
1302
- ref: i
1303
- }, /* @__PURE__ */ e.createElement("bw-glass", null, /* @__PURE__ */ e.createElement("bw-glass-header", { "can-drag": t.store?.draggable === !1 ? "false" : "true" }, /* @__PURE__ */ e.createElement("bw-glass-title", null, t.store?.title), f.length > 0 && /* @__PURE__ */ e.createElement("bw-glass-action-container", null, f.map((t, n) => {
1304
- let i = t.className ? `bw-glass-action ${t.className}` : "bw-glass-action";
1305
- return /* @__PURE__ */ e.createElement("button", {
1328
+ "can-drop": e.store?.droppable === !1 ? "false" : "true",
1329
+ ref: r
1330
+ }, /* @__PURE__ */ t.createElement("bw-glass", null, /* @__PURE__ */ t.createElement("bw-glass-header", { "can-drag": e.store?.draggable === !1 ? "false" : "true" }, /* @__PURE__ */ t.createElement("bw-glass-title", null, e.store?.title), f.length > 0 && /* @__PURE__ */ t.createElement("bw-glass-action-container", null, f.map((e, r) => {
1331
+ let i = e.className ? `bw-glass-action ${e.className}` : "bw-glass-action";
1332
+ return /* @__PURE__ */ t.createElement("button", {
1306
1333
  className: i,
1307
- key: n,
1308
- onClick: (e) => t.onClick(e, r)
1309
- }, t.label);
1310
- }))), /* @__PURE__ */ e.createElement("bw-glass-content", null, t.store?.content)));
1334
+ key: r,
1335
+ onClick: (t) => e.onClick(t, n)
1336
+ }, e.label);
1337
+ }))), /* @__PURE__ */ t.createElement("bw-glass-content", null, e.store?.content)));
1338
+ }
1339
+ //#endregion
1340
+ //#region src/WindowProvider.tsx
1341
+ var $ = e.createContext(null);
1342
+ function We({ children: t }) {
1343
+ let n = e.useRef(null);
1344
+ return /* @__PURE__ */ e.createElement($.Provider, { value: { api: n } }, t);
1345
+ }
1346
+ function Ge() {
1347
+ let t = e.useContext($);
1348
+ if (!t) throw Error("useWindow must be used within a WindowProvider");
1349
+ let { api: n } = t, r = e.useRef();
1350
+ return r.current ||= new Proxy({}, { get(e, t) {
1351
+ return (...e) => {
1352
+ if (!n.current) throw Error("[react-bwin] Window API is not ready yet. Render a <Window> inside the <WindowProvider> before calling its methods.");
1353
+ let r = n.current[t];
1354
+ return r(...e);
1355
+ };
1356
+ } }), r.current;
1311
1357
  }
1312
1358
  //#endregion
1313
1359
  //#region src/Window.tsx
1314
- var Ve = t((t, c) => {
1315
- let l = a(), u = a(), [d, f] = o(), { panes: p, ...m } = t, h = new Q({
1316
- ...m,
1317
- children: p
1318
- }), g = [], _ = [];
1319
- h.rootSash.walk((e) => {
1320
- e.children.length > 0 ? g.push(e) : _.push(e);
1321
- }), n(() => {
1322
- let e = l.current;
1323
- e?.parentElement && (h.windowElement = e, h.containerElement = e.parentElement, h.sillElement = u.current, h.enableFeatures());
1324
- }, []), r(c, () => ({
1325
- fit: h.fit.bind(h),
1326
- removePane: h.removePane.bind(h),
1327
- setTheme: h.setTheme.bind(h),
1328
- addPane: b
1360
+ var Ke = n((e, n) => {
1361
+ let u = s(), d = s(), [f, p] = c(), { panes: m, ...h } = e, g = new Z({
1362
+ ...h,
1363
+ children: m
1364
+ }), _ = [], v = [];
1365
+ g.rootSash.walk((e) => {
1366
+ e.children.length > 0 ? _.push(e) : v.push(e);
1367
+ }), i(() => {
1368
+ let e = u.current;
1369
+ e?.parentElement && (g.windowElement = e, g.containerElement = e.parentElement, g.sillElement = d.current, g.enableFeatures());
1370
+ }, []), a(n, () => ({
1371
+ fit: g.fit.bind(g),
1372
+ removePane: g.removePane.bind(g),
1373
+ setTheme: g.setTheme.bind(g),
1374
+ addPane: S
1329
1375
  }), []);
1330
- let v = /* @__PURE__ */ e.createElement("bw-window", {
1331
- "root-sash-id": h.rootSash.id,
1332
- theme: h.theme || void 0,
1376
+ let y = r($);
1377
+ i(() => {
1378
+ if (y) return y.api.current = {
1379
+ fit: g.fit.bind(g),
1380
+ removePane: g.removePane.bind(g),
1381
+ setTheme: g.setTheme.bind(g),
1382
+ addPane: S
1383
+ }, () => {
1384
+ y.api.current = null;
1385
+ };
1386
+ }, []);
1387
+ let b = /* @__PURE__ */ t.createElement("bw-window", {
1388
+ "root-sash-id": g.rootSash.id,
1389
+ theme: g.theme || void 0,
1333
1390
  style: {
1334
- width: h.rootSash.width,
1335
- height: h.rootSash.height
1391
+ width: g.rootSash.width,
1392
+ height: g.rootSash.height
1336
1393
  },
1337
- ref: l
1338
- }, _.map((t) => /* @__PURE__ */ e.createElement(Be, {
1339
- key: t.id,
1340
- sash: t,
1341
- bwin: h
1342
- })), g.map((t) => /* @__PURE__ */ e.createElement(ze, {
1343
- key: t.id,
1344
- sash: t
1345
- })), /* @__PURE__ */ e.createElement("bw-sill", { ref: u })), y = i(() => v, []);
1346
- function b(e, t) {
1347
- let { content: n, ...r } = t, i = h.addPane(e, r), a = document.querySelector(`bw-pane[sash-id="${i.id}"] bw-glass-content`);
1348
- f((e) => [...e || [], {
1394
+ ref: u
1395
+ }, v.map((e) => /* @__PURE__ */ t.createElement(Ue, {
1396
+ key: e.id,
1397
+ sash: e,
1398
+ bwin: g
1399
+ })), _.map((e) => /* @__PURE__ */ t.createElement(He, {
1400
+ key: e.id,
1401
+ sash: e
1402
+ })), /* @__PURE__ */ t.createElement("bw-sill", { ref: d })), x = o(() => b, []);
1403
+ function S(e, t) {
1404
+ let { content: n, ...r } = t, i = g.addPane(e, r), a = document.querySelector(`bw-pane[sash-id="${i.id}"] bw-glass-content`);
1405
+ p((e) => [...e || [], {
1349
1406
  node: n,
1350
1407
  container: a
1351
1408
  }]);
1352
1409
  }
1353
- return /* @__PURE__ */ e.createElement(e.Fragment, null, y, d?.map((e) => s(e.node, e.container)));
1354
- }), He = "0.4.1";
1410
+ return /* @__PURE__ */ t.createElement(t.Fragment, null, x, f?.map((e) => l(e.node, e.container)));
1411
+ }), qe = "0.5.1";
1355
1412
  //#endregion
1356
- export { be as BUILTIN_ACTIONS, W as DEFAULT_DETACHED_GLASS_ACTIONS, V as DEFAULT_GLASS_ACTIONS, Ve as Window, He as version };
1413
+ export { we as BUILTIN_ACTIONS, H as DEFAULT_DETACHED_GLASS_ACTIONS, z as DEFAULT_GLASS_ACTIONS, Ke as Window, We as WindowProvider, Ge as useWindow, qe as version };