bwin 0.3.4-dev.1 → 0.4.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/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Binary Window
2
2
 
3
+ [![Publish to npm](https://github.com/bhjsdev/bwin/actions/workflows/publish.yml/badge.svg)](https://github.com/bhjsdev/bwin/actions/workflows/publish.yml)
4
+ [![npm version](https://img.shields.io/npm/v/bwin)](https://www.npmjs.com/package/bwin)
5
+
3
6
  A lightweight window-tiling JavaScript library for the browser, featuring resizable panes, drag-and-drop, and more.
4
7
 
5
- [![A bwin tiling layout with resizable panes showing charts and a data table](docs/screenshot.png)](https://bhjsdev.github.io/bwin-docs/)
8
+ [![A bwin tiling layout with resizable panes showing charts and a data table](docs/screenshot.png)](https://bhjsdev.github.io/bwin-docs?theme=light)
6
9
 
7
- [Documentation](https://bhjsdev.github.io/bwin-docs/general/overview)
10
+ [Documentation](https://bhjsdev.github.io/bwin-docs/javascript/get-started)
8
11
 
9
12
  ## Development
10
13
 
package/dist/bwin.css CHANGED
@@ -1,2 +1,2 @@
1
- bw-window{--bw-font-family:system-ui;--bw-font-size:14px;--bw-drop-area-bg-color:#0000000d;--bw-glass-clearance:2px;--bw-glass-border-radius:2px;--bw-glass-border-color:#1a1a1a;--bw-glass-border-color-disabled:#ccc;--bw-glass-bg-color-disabled:#f7f7f7;--bw-glass-header-height:30px;--bw-glass-header-gap:4px;--bw-glass-header-bg-color:#f7f7f7;--bw-sill-gap:6px}bw-window[theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bw-glass-border-color:#666;--bw-glass-border-color-disabled:#4d4d4d;--bw-glass-header-bg-color:#2e2e2e;--bw-glass-bg-color-disabled:#292929;--bw-drop-area-bg-color:#ffffff1a}bw-window[theme=dark] bw-pane,bw-window[theme=dark] bw-muntin{background-color:#242424}bw-window[theme=dark] bw-glass{color:#e6e6e6;background-color:#292929}bw-window[theme=dark] .bw-glass-tab:hover,bw-window[theme=dark] .bw-glass-action:hover,bw-window[theme=dark] .bw-minimized-glass:hover{background-color:#424242}.body--bw-resize-x{-webkit-user-select:none;user-select:none;cursor:ew-resize}.body--bw-resize-y{-webkit-user-select:none;user-select:none;cursor:ns-resize}bw-window{box-sizing:border-box;display:block;position:absolute}bw-window:has(>bw-pane[maximized])>:is(bw-pane,bw-muntin):not([maximized]){display:none}bw-pane{box-sizing:border-box;background-color:#f2f2f2;position:absolute;overflow:auto}bw-pane[drop-area]:before{content:"";background-color:var(--bw-drop-area-bg-color);position:absolute}bw-pane[drop-area=top]:before{height:50%;top:0;left:0;right:0}bw-pane[drop-area=right]:before{width:50%;top:0;bottom:0;right:0}bw-pane[drop-area=bottom]:before{height:50%;bottom:0;left:0;right:0}bw-pane[drop-area=left]:before{width:50%;top:0;bottom:0;left:0}bw-pane[drop-area=center]:before{inset:0}bw-muntin{box-sizing:border-box;background-color:#fff;position:absolute}bw-muntin[horizontal]{cursor:ns-resize}bw-muntin[vertical]{cursor:ew-resize}bw-muntin[resizable=false]{cursor:auto}bw-window:has(bw-glass) bw-pane{background-color:#0000}bw-window:has(bw-glass) bw-pane[drop-area]:before{z-index:1}bw-window:has(bw-glass) bw-pane[drop-area=top]:before{top:var(--bw-glass-clearance);left:var(--bw-glass-clearance);right:var(--bw-glass-clearance);height:50%}bw-window:has(bw-glass) bw-pane[drop-area=right]:before{top:var(--bw-glass-clearance);right:var(--bw-glass-clearance);bottom:var(--bw-glass-clearance);width:50%}bw-window:has(bw-glass) bw-pane[drop-area=bottom]:before{bottom:var(--bw-glass-clearance);left:var(--bw-glass-clearance);right:var(--bw-glass-clearance);height:50%}bw-window:has(bw-glass) bw-pane[drop-area=left]:before{top:var(--bw-glass-clearance);left:var(--bw-glass-clearance);bottom:var(--bw-glass-clearance);width:50%}bw-window:has(bw-glass) bw-pane[drop-area=center]:before{inset:var(--bw-glass-clearance)}bw-window:has(bw-glass) bw-muntin{background-color:#0000}bw-glass{inset:var(--bw-glass-clearance);border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);font-family:var(--bw-font-family);font-size:var(--bw-font-size);box-sizing:border-box;background-color:#fff;flex-direction:column;display:flex;position:absolute}bw-glass[draggable=true]:active{cursor:move;opacity:.4}bw-glass-header{box-sizing:border-box;flex-basis:var(--bw-glass-header-height);align-items:center;gap:var(--bw-glass-header-gap);padding-inline:var(--bw-glass-header-gap);border-bottom:1px solid var(--bw-glass-border-color);border-top-left-radius:var(--bw-glass-border-radius);border-top-right-radius:var(--bw-glass-border-radius);background-color:var(--bw-glass-header-bg-color);flex-shrink:0;display:flex;overflow:hidden}bw-glass-title{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}bw-glass-tab-container{align-self:flex-end;gap:var(--bw-glass-header-gap);display:flex}.bw-glass-tab{font-family:var(--bw-font-family);border:1px solid var(--bw-glass-border-color);border-top-left-radius:var(--bw-glass-border-radius);border-top-right-radius:var(--bw-glass-border-radius);cursor:pointer;border-bottom:none}.bw-glass-tab:hover{background-color:#fff}.bw-glass-tab:active{transform:translateY(1px)}bw-glass-action-container{flex-shrink:0;gap:2px;margin-left:auto;display:flex}.bw-glass-action{font-family:var(--bw-font-family);border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);cursor:pointer}.bw-glass-action:hover{background-color:#fff}.bw-glass-action:active{transform:scale(.95)}.bw-glass-action:disabled{border:1px solid var(--bw-glass-border-color-disabled);background-color:var(--bw-glass-bg-color-disabled);cursor:not-allowed}.bw-glass-action:disabled:hover{background-color:var(--bw-glass-bg-color-disabled)}.bw-glass-action:disabled:active{transform:scale(1)}.bw-glass-action--close:before{content:""}.bw-glass-action--maximize:before{content:"☐"}bw-pane[maximized] .bw-glass-action--maximize:before{content:""}.bw-glass-action--minimize:before{content:""}bw-glass-content{box-sizing:border-box;flex-grow:1;display:block;overflow:auto}bw-sill{margin-top:calc(var(--bw-sill-gap) - var(--bw-glass-clearance));gap:var(--bw-sill-gap);box-sizing:border-box;width:100%;padding-inline:var(--bw-glass-clearance);display:flex;position:absolute;top:100%}.bw-minimized-glass{border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);cursor:pointer;background-color:var(--bw-glass-header-bg-color);flex-basis:10%;height:10px;display:block}.bw-minimized-glass:hover{background-color:#fff}.bw-minimized-glass:active{transform:scale(.95)}
1
+ bw-window{--bw-font-family:system-ui;--bw-font-size:14px;--bw-drop-area-bg-color:#0000000d;--bw-glass-clearance:2px;--bw-glass-border-radius:2px;--bw-glass-border-color:#1a1a1a;--bw-glass-border-color-disabled:#ccc;--bw-glass-bg-color-disabled:#f7f7f7;--bw-glass-header-height:30px;--bw-glass-header-gap:4px;--bw-glass-header-bg-color:#f7f7f7;--bw-minimized-glass-highlight-color:#d9d9d9;--bw-detached-glass-shadow:0 2px 6px #0000001f, 0 4px 14px #00000038;--bw-detached-glass-shadow-active:0 4px 10px #00000038, 0 10px 30px #00000061;--bw-detached-glass-resize-handle-size:12px;--bw-sill-gap:6px}bw-window[theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bw-glass-border-color:#666;--bw-glass-border-color-disabled:#4d4d4d;--bw-glass-header-bg-color:#2e2e2e;--bw-glass-bg-color-disabled:#292929;--bw-drop-area-bg-color:#ffffff1a;--bw-detached-glass-shadow:0 2px 6px #0000008c, 0 4px 14px #000000a6;--bw-detached-glass-shadow-active:0 4px 10px #000000a6, 0 10px 30px #000c;--bw-minimized-glass-highlight-color:#a6a6a6cc}bw-window[theme=dark] bw-pane,bw-window[theme=dark] bw-muntin{background-color:#242424}bw-window[theme=dark] bw-glass{color:#e6e6e6;background-color:#292929}bw-window[theme=dark] .bw-glass-tab:hover,bw-window[theme=dark] .bw-glass-action:hover,bw-window[theme=dark] .bw-minimized-glass:hover{background-color:#424242}.body--bw-resize-x{-webkit-user-select:none;user-select:none;cursor:ew-resize}.body--bw-resize-y{-webkit-user-select:none;user-select:none;cursor:ns-resize}bw-window{box-sizing:border-box;display:block;position:absolute}bw-window:has(>bw-pane[maximized])>:is(bw-pane,bw-muntin):not([maximized]){display:none}bw-pane{isolation:isolate;box-sizing:border-box;background-color:#f2f2f2;position:absolute;overflow:auto}bw-pane[drop-area]:before{content:"";background-color:var(--bw-drop-area-bg-color);position:absolute}bw-pane[drop-area=top]:before{height:50%;top:0;left:0;right:0}bw-pane[drop-area=right]:before{width:50%;top:0;bottom:0;right:0}bw-pane[drop-area=bottom]:before{height:50%;bottom:0;left:0;right:0}bw-pane[drop-area=left]:before{width:50%;top:0;bottom:0;left:0}bw-pane[drop-area=center]:before{inset:0}bw-muntin{box-sizing:border-box;background-color:#fff;position:absolute}bw-muntin[horizontal]{cursor:ns-resize}bw-muntin[vertical]{cursor:ew-resize}bw-muntin[resizable=false]{cursor:auto}bw-window:has(bw-glass) bw-pane{background-color:#0000}bw-window:has(bw-glass) bw-pane[drop-area]:before{z-index:1}bw-window:has(bw-glass) bw-pane[drop-area=top]:before{top:var(--bw-glass-clearance);left:var(--bw-glass-clearance);right:var(--bw-glass-clearance);height:50%}bw-window:has(bw-glass) bw-pane[drop-area=right]:before{top:var(--bw-glass-clearance);right:var(--bw-glass-clearance);bottom:var(--bw-glass-clearance);width:50%}bw-window:has(bw-glass) bw-pane[drop-area=bottom]:before{bottom:var(--bw-glass-clearance);left:var(--bw-glass-clearance);right:var(--bw-glass-clearance);height:50%}bw-window:has(bw-glass) bw-pane[drop-area=left]:before{top:var(--bw-glass-clearance);left:var(--bw-glass-clearance);bottom:var(--bw-glass-clearance);width:50%}bw-window:has(bw-glass) bw-pane[drop-area=center]:before{inset:var(--bw-glass-clearance)}bw-window:has(bw-glass) bw-muntin{background-color:#0000}bw-glass{inset:var(--bw-glass-clearance);border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);font-family:var(--bw-font-family);font-size:var(--bw-font-size);box-sizing:border-box;background-color:#fff;flex-direction:column;display:flex;position:absolute}bw-glass[draggable=true]:active{cursor:move;opacity:.4}bw-glass-header{box-sizing:border-box;flex-basis:var(--bw-glass-header-height);-webkit-user-select:none;user-select:none;align-items:center;gap:var(--bw-glass-header-gap);padding-inline:var(--bw-glass-header-gap);border-bottom:1px solid var(--bw-glass-border-color);border-top-left-radius:var(--bw-glass-border-radius);border-top-right-radius:var(--bw-glass-border-radius);background-color:var(--bw-glass-header-bg-color);flex-shrink:0;display:flex;overflow:hidden}bw-glass-title{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}bw-glass-tab-container{align-self:flex-end;gap:var(--bw-glass-header-gap);display:flex}.bw-glass-tab{font-family:var(--bw-font-family);border:1px solid var(--bw-glass-border-color);border-top-left-radius:var(--bw-glass-border-radius);border-top-right-radius:var(--bw-glass-border-radius);cursor:pointer;border-bottom:none}.bw-glass-tab:hover{background-color:#fff}.bw-glass-tab:active{transform:translateY(1px)}bw-glass-action-container{flex-shrink:0;gap:2px;margin-left:auto;display:flex}.bw-glass-action{font-family:var(--bw-font-family);border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);cursor:pointer}.bw-glass-action:hover{background-color:#fff}.bw-glass-action:active{transform:scale(.95)}.bw-glass-action:disabled{border:1px solid var(--bw-glass-border-color-disabled);background-color:var(--bw-glass-bg-color-disabled);cursor:not-allowed}.bw-glass-action:disabled:hover{background-color:var(--bw-glass-bg-color-disabled)}.bw-glass-action:disabled:active{transform:scale(1)}.bw-glass-action--minimize:before{content:""}.bw-glass-action--detach:before{content:"☐"}.bw-glass-action--attach:before{content:"◱"}.bw-glass-action--maximize:before{content:"🡥"}bw-pane[maximized] .bw-glass-action--maximize:before{content:"🡧"}.bw-glass-action--close:before{content:""}bw-glass-content{box-sizing:border-box;flex-grow:1;display:block;overflow:auto}bw-glass[detached]{box-shadow:var(--bw-detached-glass-shadow)}bw-glass[detached][active]{box-shadow:var(--bw-detached-glass-shadow-active)}bw-glass[detached]>bw-glass-header[can-drag=true]:active{cursor:move}bw-glass-resize-handle{z-index:2;touch-action:none;position:absolute}bw-glass-resize-handle[resize-dir=n]{top:calc(var(--bw-detached-glass-resize-handle-size) / -2);height:var(--bw-detached-glass-resize-handle-size);cursor:ns-resize;left:0;right:0}bw-glass-resize-handle[resize-dir=s]{bottom:calc(var(--bw-detached-glass-resize-handle-size) / -2);height:var(--bw-detached-glass-resize-handle-size);cursor:ns-resize;left:0;right:0}bw-glass-resize-handle[resize-dir=e]{top:0;bottom:0;right:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);cursor:ew-resize}bw-glass-resize-handle[resize-dir=w]{top:0;bottom:0;left:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);cursor:ew-resize}bw-glass-resize-handle[resize-dir=ne]{top:calc(var(--bw-detached-glass-resize-handle-size) / -2);right:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);height:var(--bw-detached-glass-resize-handle-size);cursor:nesw-resize}bw-glass-resize-handle[resize-dir=nw]{top:calc(var(--bw-detached-glass-resize-handle-size) / -2);left:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);height:var(--bw-detached-glass-resize-handle-size);cursor:nwse-resize}bw-glass-resize-handle[resize-dir=se]{bottom:calc(var(--bw-detached-glass-resize-handle-size) / -2);right:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);height:var(--bw-detached-glass-resize-handle-size);cursor:nwse-resize}bw-glass-resize-handle[resize-dir=sw]{bottom:calc(var(--bw-detached-glass-resize-handle-size) / -2);left:calc(var(--bw-detached-glass-resize-handle-size) / -2);width:var(--bw-detached-glass-resize-handle-size);height:var(--bw-detached-glass-resize-handle-size);cursor:nesw-resize}bw-sill{margin-top:calc(var(--bw-sill-gap) - var(--bw-glass-clearance));gap:var(--bw-sill-gap);box-sizing:border-box;width:100%;padding-inline:var(--bw-glass-clearance);display:flex;position:absolute;top:100%}.bw-minimized-glass,.bw-minimized-detached-glass{border:1px solid var(--bw-glass-border-color);border-radius:var(--bw-glass-border-radius);cursor:pointer;background-color:var(--bw-glass-header-bg-color);flex-basis:10%;height:10px;display:block}:is(.bw-minimized-glass,.bw-minimized-detached-glass):hover{background-color:#fff}:is(.bw-minimized-glass,.bw-minimized-detached-glass):active{transform:scale(.95)}.bw-minimized-glass,.bw-minimized-detached-glass{animation:2s ease-out bw-minimized-glass-highlight}@keyframes bw-minimized-glass-highlight{0%{background-color:var(--bw-glass-header-bg-color)}30%{background-color:var(--bw-minimized-glass-highlight-color)}to{background-color:var(--bw-glass-header-bg-color)}}
2
2
  /*$vite$:1*/
package/dist/bwin.js CHANGED
@@ -69,6 +69,10 @@ function c(e) {
69
69
  return e instanceof Node ? e : document.createTextNode(String(e));
70
70
  }
71
71
  function l(e) {
72
+ let t = document.createDocumentFragment();
73
+ return t.append(...e.childNodes), t;
74
+ }
75
+ function u(e) {
72
76
  return {
73
77
  left: parseFloat(e.style.left) || 0,
74
78
  top: parseFloat(e.style.top) || 0,
@@ -78,7 +82,7 @@ function l(e) {
78
82
  }
79
83
  //#endregion
80
84
  //#region src/position.js
81
- var u = {
85
+ var d = {
82
86
  Top: "top",
83
87
  Right: "right",
84
88
  Bottom: "bottom",
@@ -88,22 +92,22 @@ var u = {
88
92
  Unknown: "unknown",
89
93
  Outside: "outside"
90
94
  };
91
- function d(e) {
95
+ function f(e) {
92
96
  switch (e) {
93
- case u.Top: return u.Bottom;
94
- case u.Right: return u.Left;
95
- case u.Bottom: return u.Top;
96
- case u.Left: return u.Right;
97
+ case d.Top: return d.Bottom;
98
+ case d.Right: return d.Left;
99
+ case d.Bottom: return d.Top;
100
+ case d.Left: return d.Right;
97
101
  default: throw Error(`[bwin] Invalid position: ${e}`);
98
102
  }
99
103
  }
100
- function f({ width: e, height: t, x: n }) {
104
+ function p({ width: e, height: t, x: n }) {
101
105
  return t / e * n;
102
106
  }
103
- function p({ width: e, height: t, y: n }) {
107
+ function m({ width: e, height: t, y: n }) {
104
108
  return e / t * n;
105
109
  }
106
- function m({ width: e, height: t, x: n }) {
110
+ function ee({ width: e, height: t, x: n }) {
107
111
  return t - t / e * n;
108
112
  }
109
113
  function h({ width: e, height: t, y: n }) {
@@ -111,25 +115,25 @@ function h({ width: e, height: t, y: n }) {
111
115
  }
112
116
  function g(e, { clientX: t, clientY: n }) {
113
117
  let r = e.getBoundingClientRect(), { width: i, height: a } = r, o = t - r.left, s = n - r.top;
114
- if (o < 0 || o > i || s < 0 || s > a) return u.Outside;
115
- let c = .3, l = f({
118
+ if (o < 0 || o > i || s < 0 || s > a) return d.Outside;
119
+ let c = .3, l = p({
116
120
  width: i,
117
121
  height: a,
118
122
  x: o
119
- }), d = m({
123
+ }), u = ee({
120
124
  width: i,
121
125
  height: a,
122
126
  x: o
123
- }), g = p({
127
+ }), f = m({
124
128
  width: i,
125
129
  height: a,
126
130
  y: s
127
- }), _ = h({
131
+ }), g = h({
128
132
  width: i,
129
133
  height: a,
130
134
  y: s
131
135
  });
132
- return o < i * (.5 - c / 2) && s > l && s < d ? u.Left : o > i * .65 && s < l && s > d ? u.Right : s < a * (.5 - c / 2) && o > g && o < _ ? u.Top : s > a * .65 && o < g && o > _ ? u.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? u.Center : u.Unknown;
136
+ return o < i * (.5 - c / 2) && s > l && s < u ? d.Left : o > i * .65 && s < l && s > u ? d.Right : s < a * (.5 - c / 2) && o > f && o < g ? d.Top : s > a * .65 && o < f && o > g ? d.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? d.Center : d.Unknown;
133
137
  }
134
138
  var _ = {
135
139
  left: 0,
@@ -154,26 +158,26 @@ var _ = {
154
158
  return this.children.length > 0;
155
159
  }
156
160
  isLeftRightSplit() {
157
- return this.children.some((e) => e.position === u.Left || e.position === u.Right);
161
+ return this.children.some((e) => e.position === d.Left || e.position === d.Right);
158
162
  }
159
163
  isTopBottomSplit() {
160
- return this.children.some((e) => e.position === u.Top || e.position === u.Bottom);
164
+ return this.children.some((e) => e.position === d.Top || e.position === d.Bottom);
161
165
  }
162
166
  get leftChild() {
163
- return this.children.find((e) => e.position === u.Left);
167
+ return this.children.find((e) => e.position === d.Left);
164
168
  }
165
169
  get rightChild() {
166
- return this.children.find((e) => e.position === u.Right);
170
+ return this.children.find((e) => e.position === d.Right);
167
171
  }
168
172
  get topChild() {
169
- return this.children.find((e) => e.position === u.Top);
173
+ return this.children.find((e) => e.position === d.Top);
170
174
  }
171
175
  get bottomChild() {
172
- return this.children.find((e) => e.position === u.Bottom);
176
+ return this.children.find((e) => e.position === d.Bottom);
173
177
  }
174
178
  getChildren() {
175
179
  let e = null, t = null, n = null, r = null;
176
- for (let i of this.children) i.position === u.Left ? e = i : i.position === u.Right ? t = i : i.position === u.Top ? n = i : i.position === u.Bottom && (r = i);
180
+ for (let i of this.children) i.position === d.Left ? e = i : i.position === d.Right ? t = i : i.position === d.Top ? n = i : i.position === d.Bottom && (r = i);
177
181
  return [
178
182
  n,
179
183
  t,
@@ -232,7 +236,7 @@ var _ = {
232
236
  }
233
237
  addChild(e) {
234
238
  if (this.children.length >= 2) throw Error("[bwin] Maximum 2 children allowed");
235
- this.children.push(e);
239
+ e.parent = this, this.children.push(e);
236
240
  }
237
241
  getDescendantParentById(e) {
238
242
  for (let t of this.children) {
@@ -245,6 +249,12 @@ var _ = {
245
249
  getChildSiblingById(e) {
246
250
  return this.children.find((t) => t.id !== e);
247
251
  }
252
+ getLargestLeaf() {
253
+ return this.getAllLeafDescendants().reduce((e, t) => t.width * t.height > e.width * e.height ? t : e);
254
+ }
255
+ getRelativeSize() {
256
+ return this.parent ? this.position === d.Left || this.position === d.Right ? this.width / this.parent.width : this.height / this.parent.height : 1;
257
+ }
248
258
  get top() {
249
259
  return this._top;
250
260
  }
@@ -272,7 +282,7 @@ var _ = {
272
282
  let [n, r, i, a] = this.getChildren();
273
283
  if (a && r) {
274
284
  let e = a.width + r.width, n = t * (a.width / e), i = e + t, o, s, c;
275
- if (this.resizeStrategy === "natural" && this.position === u.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === u.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) {
285
+ if (this.resizeStrategy === "natural" && this.position === d.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === d.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) {
276
286
  let e = a.calcMinWidth(), t = r.calcMinWidth();
277
287
  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);
278
288
  }
@@ -289,7 +299,7 @@ var _ = {
289
299
  let [n, r, i, a] = this.getChildren();
290
300
  if (n && i) {
291
301
  let e = n.height + i.height, r = t * (n.height / e), a = e + t, o, s, c;
292
- if (this.resizeStrategy === "natural" && this.position === u.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === u.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) {
302
+ if (this.resizeStrategy === "natural" && this.position === d.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === d.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) {
293
303
  let e = n.calcMinHeight(), t = i.calcMinHeight();
294
304
  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);
295
305
  }
@@ -299,8 +309,8 @@ var _ = {
299
309
  }
300
310
  }, y = {
301
311
  size: "50%",
302
- position: u.Left
303
- }, b = class e {
312
+ position: d.Left
313
+ }, te = class e {
304
314
  left;
305
315
  top;
306
316
  width;
@@ -310,7 +320,7 @@ var _ = {
310
320
  }
311
321
  getPosition(e) {
312
322
  if (!this.siblingConfigNode) return e;
313
- let t = d(this.siblingConfigNode.position);
323
+ let t = f(this.siblingConfigNode.position);
314
324
  if (!e) return t;
315
325
  if (e !== t) throw Error("[bwin] Sibling position and current position are not opposite");
316
326
  return e;
@@ -319,30 +329,30 @@ var _ = {
319
329
  if (!this.siblingConfigNode) return i(e);
320
330
  if (!e) {
321
331
  if (this.siblingConfigNode.size < 1) return 1 - this.siblingConfigNode.size;
322
- if (this.siblingConfigNode.position === u.Left || this.siblingConfigNode.position === u.Right) return this.parentRect.width - this.siblingConfigNode.width;
323
- if (this.siblingConfigNode.position === u.Top || this.siblingConfigNode.position === u.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
332
+ if (this.siblingConfigNode.position === d.Left || this.siblingConfigNode.position === d.Right) return this.parentRect.width - this.siblingConfigNode.width;
333
+ if (this.siblingConfigNode.position === d.Top || this.siblingConfigNode.position === d.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
324
334
  }
325
335
  let t = i(e);
326
336
  if (t < 1) {
327
337
  if (t + this.siblingConfigNode.size !== 1) throw Error("[bwin] Sum of sibling sizes is not equal to 1");
328
338
  } else {
329
- if ((this.position === u.Left || this.position === u.Right) && t + this.siblingConfigNode.size !== this.parentRect.width) throw Error("[bwin] Sum of sibling sizes is not equal to parent width");
330
- if ((this.position === u.Top || this.position === u.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
339
+ if ((this.position === d.Left || this.position === d.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 === d.Top || this.position === d.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
331
341
  }
332
342
  return t;
333
343
  }
334
344
  setBounds() {
335
- if (this.position === u.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
336
- else if (this.position === u.Left) {
345
+ if (this.position === d.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
346
+ else if (this.position === d.Left) {
337
347
  let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
338
348
  this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
339
- } else if (this.position === u.Right) {
349
+ } else if (this.position === d.Right) {
340
350
  let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
341
351
  this.left = this.parentRect.left + this.parentRect.width - e, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
342
- } else if (this.position === u.Top) {
352
+ } else if (this.position === d.Top) {
343
353
  let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
344
354
  this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = e;
345
- } else if (this.position === u.Bottom) {
355
+ } else if (this.position === d.Bottom) {
346
356
  let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
347
357
  this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - e, this.width = this.parentRect.width, this.height = e;
348
358
  }
@@ -400,28 +410,28 @@ var _ = {
400
410
  let t = this.createSash({ resizeStrategy: e });
401
411
  if (!Array.isArray(this.children) || this.children.length === 0) return t;
402
412
  let n = this.normConfig(this.children[0]), r = this.normConfig(this.children.at(1)), i, a;
403
- if (!n.size && !n.position && r ? (r.position ||= u.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
413
+ if (!n.size && !n.position && r ? (r.position ||= d.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
404
414
  let n = i.buildSashTree({ resizeStrategy: e }), r = a.buildSashTree({ resizeStrategy: e });
405
415
  n.parent = t, r.parent = t, t.children.push(n), t.children.push(r);
406
416
  }
407
417
  return t;
408
418
  }
409
- }, x = {
419
+ }, b = {
410
420
  width: 333,
411
421
  height: 333
412
- }, S = {
422
+ }, x = {
413
423
  fitContainer: !1,
414
424
  theme: ""
415
- }, C = class extends b {
416
- constructor({ id: e, children: t, width: n = x.width, height: r = x.height, fitContainer: i = S.fitContainer, theme: a = S.theme, ...o } = {
417
- ...x,
418
- ...S
425
+ }, S = class extends te {
426
+ constructor({ id: e, children: t, width: n = b.width, height: r = b.height, fitContainer: i = x.fitContainer, theme: a = x.theme, ...o } = {
427
+ ...b,
428
+ ...x
419
429
  }) {
420
430
  super({
421
431
  id: e,
422
432
  children: t,
423
433
  size: NaN,
424
- position: u.Root,
434
+ position: d.Root,
425
435
  parentRect: {
426
436
  width: n,
427
437
  height: r
@@ -429,25 +439,25 @@ var _ = {
429
439
  ...o
430
440
  }), this.fitContainer = i, this.theme = a;
431
441
  }
432
- }, w = class extends v {
442
+ }, C = class extends v {
433
443
  constructor(e = _) {
434
444
  super({
435
445
  ...e,
436
- position: u.Root
437
- }), Object.assign(this, S);
446
+ position: d.Root
447
+ }), Object.assign(this, x);
438
448
  }
439
449
  };
440
450
  //#endregion
441
451
  //#region src/frame/pane-utils.js
442
- function T(e) {
452
+ function ne(e) {
443
453
  let t = document.createElement("bw-pane");
444
454
  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;
445
455
  }
446
- function E(e) {
456
+ function w(e) {
447
457
  let t = e.domNode;
448
458
  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;
449
459
  }
450
- function D(e, { size: n, id: r }) {
460
+ function T(e, { size: n, id: r }) {
451
461
  let a = i(n), o = e.width / 2;
452
462
  a && (o = a < 1 ? e.width * a : a);
453
463
  let s = new v({
@@ -456,19 +466,19 @@ function D(e, { size: n, id: r }) {
456
466
  left: e.left,
457
467
  width: o,
458
468
  height: e.height,
459
- position: u.Left
469
+ position: d.Left
460
470
  }), c = new v({
461
471
  id: e.id,
462
472
  top: e.top,
463
473
  left: e.left + s.width,
464
474
  width: e.width - o,
465
475
  height: e.height,
466
- position: u.Right,
476
+ position: d.Right,
467
477
  domNode: e.domNode
468
478
  });
469
479
  return e.addChild(s), e.addChild(c), e.domNode = null, e.id = t(), s;
470
480
  }
471
- function O(e, { size: n, id: r }) {
481
+ function E(e, { size: n, id: r }) {
472
482
  let a = i(n), o = e.width / 2;
473
483
  a && (o = a < 1 ? e.width * a : a);
474
484
  let s = new v({
@@ -477,7 +487,7 @@ function O(e, { size: n, id: r }) {
477
487
  top: e.top,
478
488
  width: e.width - o,
479
489
  height: e.height,
480
- position: u.Left,
490
+ position: d.Left,
481
491
  domNode: e.domNode
482
492
  }), c = new v({
483
493
  id: r,
@@ -485,11 +495,11 @@ function O(e, { size: n, id: r }) {
485
495
  top: e.top,
486
496
  width: o,
487
497
  height: e.height,
488
- position: u.Right
498
+ position: d.Right
489
499
  });
490
500
  return e.addChild(s), e.addChild(c), e.domNode = null, e.id = t(), c;
491
501
  }
492
- function k(e, { size: n, id: r }) {
502
+ function D(e, { size: n, id: r }) {
493
503
  let a = i(n), o = e.height / 2;
494
504
  a && (o = a < 1 ? e.height * a : a);
495
505
  let s = new v({
@@ -498,19 +508,19 @@ function k(e, { size: n, id: r }) {
498
508
  top: e.top,
499
509
  width: e.width,
500
510
  height: o,
501
- position: u.Top
511
+ position: d.Top
502
512
  }), c = new v({
503
513
  id: e.id,
504
514
  left: e.left,
505
515
  top: e.top + s.height,
506
516
  width: e.width,
507
517
  height: e.height - o,
508
- position: u.Bottom,
518
+ position: d.Bottom,
509
519
  domNode: e.domNode
510
520
  });
511
521
  return e.addChild(s), e.addChild(c), e.domNode = null, e.id = t(), s;
512
522
  }
513
- function A(e, { size: n, id: r }) {
523
+ function O(e, { size: n, id: r }) {
514
524
  let a = i(n), o = e.height / 2;
515
525
  a && (o = a < 1 ? e.height * a : a);
516
526
  let s = new v({
@@ -519,7 +529,7 @@ function A(e, { size: n, id: r }) {
519
529
  left: e.left,
520
530
  width: e.width,
521
531
  height: e.height - o,
522
- position: u.Top,
532
+ position: d.Top,
523
533
  domNode: e.domNode
524
534
  }), c = new v({
525
535
  id: r,
@@ -527,31 +537,31 @@ function A(e, { size: n, id: r }) {
527
537
  left: e.left,
528
538
  width: e.width,
529
539
  height: o,
530
- position: u.Bottom
540
+ position: d.Bottom
531
541
  });
532
542
  return e.addChild(s), e.addChild(c), e.domNode = null, e.id = t(), c;
533
543
  }
534
- function j(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
535
- if (t === u.Left) return D(e, {
544
+ function k(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
545
+ if (t === d.Left) return T(e, {
536
546
  size: n,
537
547
  id: r
538
548
  });
539
- if (t === u.Right) return O(e, {
549
+ if (t === d.Right) return E(e, {
540
550
  size: n,
541
551
  id: r
542
552
  });
543
- if (t === u.Top) return k(e, {
553
+ if (t === d.Top) return D(e, {
544
554
  size: n,
545
555
  id: r
546
556
  });
547
- if (t === u.Bottom) return A(e, {
557
+ if (t === d.Bottom) return O(e, {
548
558
  size: n,
549
559
  id: r
550
560
  });
551
561
  }
552
562
  //#endregion
553
563
  //#region src/frame/frame-utils.js
554
- function M(e) {
564
+ function A(e) {
555
565
  if (e.tagName === "BW-PANE") return e.getAttribute("sash-id");
556
566
  let t = e.closest("bw-pane");
557
567
  if (!t) throw Error("[bwin] Pane element not found");
@@ -559,25 +569,25 @@ function M(e) {
559
569
  }
560
570
  //#endregion
561
571
  //#region src/frame/pane.js
562
- var N = {
572
+ var re = {
563
573
  createPane(e) {
564
- let t = T(e);
574
+ let t = ne(e);
565
575
  return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
566
576
  },
567
577
  onPaneCreate(t, n) {
568
- n.store.content && t.append(c(n.store.content)), this?.debug && (t.style.backgroundColor = e(), t.innerHTML = "", t.append(P(t)));
578
+ n.store.content && t.append(c(n.store.content)), this?.debug && (t.style.backgroundColor = e(), t.innerHTML = "", t.append(j(t)));
569
579
  },
570
580
  updatePane(e) {
571
- return E(e);
581
+ return w(e);
572
582
  },
573
583
  onPaneUpdate(e, t) {
574
- this?.debug && (e.innerHTML = "", e.append(P(e)));
584
+ this?.debug && (e.innerHTML = "", e.append(j(e)));
575
585
  },
576
586
  addPane(e, { position: t, size: n, id: r }) {
577
587
  if (!t) throw Error("[bwin] Position is required when adding pane");
578
588
  let i = this.rootSash.getById(e);
579
589
  if (!i) throw Error("[bwin] Parent sash not found when adding pane");
580
- let a = j(i, {
590
+ let a = k(i, {
581
591
  position: t,
582
592
  size: n,
583
593
  id: r
@@ -588,14 +598,14 @@ var N = {
588
598
  let n = this.rootSash.getDescendantParentById(e);
589
599
  if (!n) throw Error("[bwin] Parent sash not found when removing pane");
590
600
  let r = n.getChildSiblingById(e);
591
- r.children.length === 0 ? (n.id = r.id, n.domNode = r.domNode, n.domNode.setAttribute("sash-id", r.id), n.children = []) : (n.id = t(), n.children = r.children, r.position === u.Left ? r.width = n.width : r.position === u.Right ? (r.width = n.width, r.left = n.left) : r.position === u.Top ? r.height = n.height : r.position === u.Bottom && (r.height = n.height, r.top = n.top)), this.update();
601
+ r.children.length === 0 ? (n.id = r.id, n.domNode = r.domNode, n.domNode.setAttribute("sash-id", r.id), n.children = []) : (n.id = t(), n.children = r.children, n.children.forEach((e) => e.parent = n), r.position === d.Left ? r.width = n.width : r.position === d.Right ? (r.width = n.width, r.left = n.left) : r.position === d.Top ? r.height = n.height : r.position === d.Bottom && (r.height = n.height, r.top = n.top)), this.update();
592
602
  },
593
603
  swapPanes(e, t) {
594
- let n = M(e), i = M(t), a = e.getAttribute("can-drop") !== "false", o = t.getAttribute("can-drop") !== "false";
604
+ let n = A(e), i = A(t), a = e.getAttribute("can-drop") !== "false", o = t.getAttribute("can-drop") !== "false";
595
605
  this.rootSash.swapIds(n, i), r(e, this.activeDropPaneEl), e.setAttribute("sash-id", i), t.setAttribute("sash-id", n), e.setAttribute("can-drop", o), t.setAttribute("can-drop", a);
596
606
  }
597
607
  };
598
- function P(e) {
608
+ function j(e) {
599
609
  let t = document.createElement("pre");
600
610
  return t.style.fontSize = "10px", t.innerHTML = `
601
611
  ${e.getAttribute("sash-id")}
@@ -608,7 +618,7 @@ height: ${e.style.height}
608
618
  }
609
619
  //#endregion
610
620
  //#region src/frame/main.js
611
- var F = {
621
+ var ie = {
612
622
  createWindow({ theme: e } = {}) {
613
623
  let t = document.createElement("bw-window");
614
624
  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;
@@ -629,7 +639,7 @@ var F = {
629
639
  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));
630
640
  });
631
641
  }
632
- }, I = {
642
+ }, ae = {
633
643
  muntinSize: 4,
634
644
  createMuntin(e) {
635
645
  let t = document.createElement("bw-muntin"), n = e.leftChild, r = e.topChild;
@@ -641,7 +651,7 @@ var F = {
641
651
  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`);
642
652
  },
643
653
  onMuntinUpdate(e, t) {}
644
- }, L = {
654
+ }, oe = {
645
655
  fitContainer: !1,
646
656
  fit() {
647
657
  this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
@@ -653,7 +663,7 @@ var F = {
653
663
  });
654
664
  }).observe(this.containerElement);
655
665
  }
656
- }, R = {
666
+ }, se = {
657
667
  activeMuntinSash: null,
658
668
  isResizeStarted: !1,
659
669
  isDropStarted: !1,
@@ -686,7 +696,7 @@ var F = {
686
696
  this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
687
697
  });
688
698
  }
689
- }, z = {
699
+ }, ce = {
690
700
  activeDropPaneEl: null,
691
701
  onPaneDrop(e, t) {},
692
702
  enableDrop() {
@@ -704,13 +714,13 @@ var F = {
704
714
  this.onPaneDrop(e, n), typeof n.store.onDrop == "function" && n.store.onDrop(e, n), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
705
715
  });
706
716
  }
707
- }, B = !1, V = class {
717
+ }, le = !1, M = class {
708
718
  windowElement = null;
709
719
  containerElement = null;
710
- debug = B;
720
+ debug = le;
711
721
  constructor(e) {
712
722
  let t = null;
713
- e instanceof w ? (t = e, this.rootSash = e) : (t = new C(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer, this.theme = t.theme;
723
+ e instanceof C ? (t = e, this.rootSash = e) : (t = new S(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer;
714
724
  }
715
725
  frame(e) {
716
726
  this.containerElement = e, this.windowElement = this.createWindow({ theme: this.theme }), this.glaze(), this.containerElement.append(this.windowElement);
@@ -727,38 +737,10 @@ var F = {
727
737
  });
728
738
  }
729
739
  };
730
- V.assemble(F, I, N, L, z, R);
731
- //#endregion
732
- //#region src/binary-window/actions.close.js
733
- var H = {
734
- label: "",
735
- className: "bw-glass-action--close",
736
- onClick: (e, t) => {
737
- let n = M(e.target);
738
- t.removePane(n);
739
- }
740
- }, U = {
741
- label: "",
742
- className: "bw-glass-action--minimize",
743
- onClick: (e, t) => {
744
- let n = t.sillElement;
745
- if (!n) throw Error("[bwin] Sill element not found when minimizing");
746
- let r = c("<button class=\"bw-minimized-glass\" />");
747
- n.append(r);
748
- let i = e.target.closest("bw-pane"), a = e.target.closest("bw-glass"), o = i.getAttribute("sash-id"), s = i.getAttribute("position");
749
- r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = l(i), r.bwOriginalSashId = o, t.removePane(o);
750
- }
751
- }, W = {
752
- label: "",
753
- className: "bw-glass-action--maximize",
754
- onClick: (e) => {
755
- let t = e.target.closest("bw-pane");
756
- 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 = l(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
757
- }
758
- };
740
+ M.assemble(ie, ae, re, oe, ce, se);
759
741
  //#endregion
760
742
  //#region src/rect.js
761
- function G(e, t) {
743
+ function ue(e, t) {
762
744
  let n = e.left + e.width, r = e.top + e.height, i = t.left + t.width, a = t.top + t.height;
763
745
  if (e.left >= i || t.left >= n || e.top >= a || t.top >= r) return null;
764
746
  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);
@@ -770,27 +752,23 @@ function G(e, t) {
770
752
  };
771
753
  }
772
754
  //#endregion
773
- //#region src/binary-window/actions.js
774
- var K = [
775
- U,
776
- W,
777
- H
778
- ], q = {
779
- enableActions() {
755
+ //#region src/binary-window/glass/action.js
756
+ var de = {
757
+ enableGlassActions() {
780
758
  this.handleMinimizedGlassClick(), this.observeActionButtons();
781
759
  },
782
760
  restoreGlass(e) {
783
761
  let t = e.bwOriginalBoundingRect, n = 0, r = null;
784
762
  if (this.windowElement.querySelectorAll("bw-pane").forEach((e) => {
785
- let i = G(t, l(e));
763
+ let i = ue(t, u(e));
786
764
  if (i) {
787
765
  let t = i.width * i.height;
788
766
  t > n && (n = t, r = e);
789
767
  }
790
768
  }), r) {
791
- let n = e.bwOriginalPosition, i = l(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
792
- if (n === u.Left || n === u.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
793
- else if (n === u.Top || n === u.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
769
+ let n = e.bwOriginalPosition, i = u(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
770
+ if (n === d.Left || n === d.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
771
+ else if (n === d.Top || n === d.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
794
772
  else throw Error("[bwin] Invalid position when restoring glass");
795
773
  let c = e.bwOriginalSashId;
796
774
  this.addPane(r.getAttribute("sash-id"), {
@@ -808,7 +786,7 @@ var K = [
808
786
  });
809
787
  },
810
788
  updateDisabledStateOfActionButtons() {
811
- this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize");
789
+ this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize"), this.updateDisabledState(".bw-glass-action--detach");
812
790
  },
813
791
  updateDisabledState(e) {
814
792
  if (this.windowElement.querySelectorAll("bw-pane").length === 1) {
@@ -829,23 +807,94 @@ var K = [
829
807
  });
830
808
  }).observe(this.windowElement, { childList: !0 });
831
809
  }
832
- }, J = {
833
- title: null,
834
- content: null,
835
- tabs: [],
836
- actions: void 0,
837
- draggable: !0
838
- }, Y = class {
810
+ }, N = null, P = !1, F = {
811
+ onPaneDrop(e, t) {
812
+ if (!N) return;
813
+ let n = this.activeDropPaneEl.getAttribute("drop-area");
814
+ if (n === "center") {
815
+ let e = N.closest("bw-pane");
816
+ this.swapPanes(e, this.activeDropPaneEl);
817
+ return;
818
+ } else {
819
+ let e = A(N);
820
+ this.removePane(e), this.addPane(t.id, {
821
+ position: n,
822
+ id: e
823
+ }).domNode.append(N);
824
+ }
825
+ },
826
+ enableGlassDrag() {
827
+ document.addEventListener("mousedown", (e) => {
828
+ if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
829
+ if (e.target.getAttribute("can-drag") === "false") {
830
+ e.preventDefault();
831
+ return;
832
+ }
833
+ let t = e.target.closest("bw-glass");
834
+ t.setAttribute("draggable", !0), N = t;
835
+ }), document.addEventListener("mouseup", () => {
836
+ N &&= (N.removeAttribute("draggable"), null);
837
+ }), this.windowElement.addEventListener("dragstart", (e) => {
838
+ if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !N) return;
839
+ e.dataTransfer.effectAllowed = "move";
840
+ let t = N.closest("bw-pane");
841
+ P = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
842
+ }), this.windowElement.addEventListener("dragend", () => {
843
+ N &&= (N.removeAttribute("draggable"), N.closest("bw-pane").setAttribute("can-drop", P), null);
844
+ });
845
+ }
846
+ }, I = {
847
+ label: "",
848
+ className: "bw-glass-action--close",
849
+ onClick: (e, t) => {
850
+ let n = A(e.target);
851
+ t.removePane(n);
852
+ }
853
+ }, L = {
854
+ label: "",
855
+ className: "bw-glass-action--minimize",
856
+ onClick: (e, t) => {
857
+ let n = t.sillElement;
858
+ if (!n) throw Error("[bwin] Sill element not found when minimizing");
859
+ let r = c("<button class=\"bw-minimized-glass\" />");
860
+ n.append(r);
861
+ let i = e.target.closest("bw-pane"), a = e.target.closest("bw-glass"), o = i.getAttribute("sash-id"), s = i.getAttribute("position");
862
+ r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = u(i), r.bwOriginalSashId = o, t.removePane(o);
863
+ }
864
+ }, R = {
865
+ label: "",
866
+ className: "bw-glass-action--maximize",
867
+ onClick: (e) => {
868
+ let t = e.target.closest("bw-pane");
869
+ 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 = u(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
870
+ }
871
+ }, z = 15, B = {
872
+ label: "",
873
+ className: "bw-glass-action--detach",
874
+ onClick: (e, t) => {
875
+ if (!t.addDetachedGlass) throw Error("[bwin] Failed to detach glass from pane");
876
+ 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({
877
+ position: "center",
878
+ width: o,
879
+ height: s
880
+ }), l = n.getAttribute("sash-id"), u = t.rootSash.getById(l), d = u.parent.getChildSiblingById(l).id;
881
+ c.domNode.bwOriginalSiblingSashId = d, c.domNode.bwOriginalPosition = n.getAttribute("position"), c.domNode.bwOriginalRelativeSize = u.getRelativeSize(), c.contentElement.replaceWith(r), c.titleElement.replaceWith(i), t.removePane(l);
882
+ }
883
+ }, V = [
884
+ L,
885
+ B,
886
+ I
887
+ ], H = class {
839
888
  domNode;
840
- constructor({ title: e = J.title, content: t = J.content, tabs: n = J.tabs, actions: r = J.actions, draggable: i = J.draggable, sash: a, binaryWindow: o }) {
889
+ constructor({ title: e = null, content: t = null, tabs: n = [], actions: r = V, draggable: i = !0, sash: a = null, binaryWindow: o }) {
841
890
  this.title = e, this.content = t, this.tabs = n, this.actions = r, this.sash = a, this.draggable = i, this.binaryWindow = o, this.build();
842
891
  }
843
892
  build() {
844
893
  let e = document.createElement("bw-glass-header");
845
894
  if (Array.isArray(this.tabs) && this.tabs.length > 0) e.append(this.createTabs());
846
- else if (this.title) {
895
+ else {
847
896
  let t = document.createElement("bw-glass-title");
848
- t.append(c(this.title)), e.append(t);
897
+ this.title && t.append(c(this.title)), e.append(t);
849
898
  }
850
899
  e.setAttribute("can-drag", this.draggable), e.append(this.createActions());
851
900
  let t = document.createElement("bw-glass-content"), n = c(this.content);
@@ -860,7 +909,7 @@ var K = [
860
909
  return e;
861
910
  }
862
911
  createActions() {
863
- let e = document.createElement("bw-glass-action-container"), t = this.actions === void 0 ? K : Array.isArray(this.actions) ? this.actions : [];
912
+ let e = document.createElement("bw-glass-action-container"), t = Array.isArray(this.actions) ? this.actions : [];
864
913
  for (let n of t) {
865
914
  let t = n?.label ?? n, r = c(`<button class="${n.className ? `bw-glass-action ${n.className}` : "bw-glass-action"}">${t}</button>`);
866
915
  typeof n.onClick == "function" && r.addEventListener("click", (e) => {
@@ -875,45 +924,21 @@ var K = [
875
924
  get headerElement() {
876
925
  return this.domNode.querySelector("bw-glass-header");
877
926
  }
878
- }, X = {
879
- activeDragGlassEl: null,
880
- activeDragGlassPaneCanDrop: !1,
881
- onPaneDrop(e, t) {
882
- if (!this.activeDragGlassEl) return;
883
- let n = this.activeDropPaneEl.getAttribute("drop-area");
884
- if (n === "center") {
885
- let e = this.activeDragGlassEl.closest("bw-pane");
886
- this.swapPanes(e, this.activeDropPaneEl);
887
- return;
888
- } else {
889
- let e = M(this.activeDragGlassEl);
890
- this.removePane(e), this.addPane(t.id, {
891
- position: n,
892
- id: e
893
- }).domNode.append(this.activeDragGlassEl);
894
- }
927
+ get titleElement() {
928
+ return this.domNode.querySelector("bw-glass-title");
929
+ }
930
+ }, fe = [
931
+ L,
932
+ R,
933
+ B,
934
+ I
935
+ ], pe = {
936
+ enableGlassFeature() {
937
+ this.enableGlassActions(), this.enableGlassDrag();
895
938
  },
896
- enableDrag() {
897
- document.addEventListener("mousedown", (e) => {
898
- if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
899
- if (e.target.getAttribute("can-drag") === "false") {
900
- e.preventDefault();
901
- return;
902
- }
903
- let t = e.target.closest("bw-glass");
904
- t.setAttribute("draggable", !0), this.activeDragGlassEl = t;
905
- }), document.addEventListener("mouseup", () => {
906
- this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), null);
907
- }), this.windowElement.addEventListener("dragstart", (e) => {
908
- if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !this.activeDragGlassEl) return;
909
- e.dataTransfer.effectAllowed = "move";
910
- let t = this.activeDragGlassEl.closest("bw-pane");
911
- this.activeDragGlassPaneCanDrop = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
912
- }), this.windowElement.addEventListener("dragend", () => {
913
- this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), null);
914
- });
915
- }
916
- }, Z = {
939
+ ...de,
940
+ ...F
941
+ }, me = {
917
942
  trimMuntin(e) {
918
943
  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`);
919
944
  },
@@ -923,23 +948,289 @@ var K = [
923
948
  onMuntinUpdate(e) {
924
949
  this.trimMuntin(e);
925
950
  }
926
- }, Q = class extends V {
951
+ }, he = [
952
+ "n",
953
+ "s",
954
+ "e",
955
+ "w",
956
+ "ne",
957
+ "nw",
958
+ "se",
959
+ "sw"
960
+ ];
961
+ function ge() {
962
+ return he.map((e) => {
963
+ let t = document.createElement("bw-glass-resize-handle");
964
+ return t.setAttribute("resize-dir", e), t;
965
+ });
966
+ }
967
+ function _e({ position: e, offset: t, offsetX: n, offsetY: r, width: i, height: a }) {
968
+ let o = n ?? t, s = r ?? t;
969
+ switch (e) {
970
+ case "top-left": return {
971
+ top: `${s}px`,
972
+ left: `${o}px`,
973
+ right: "auto",
974
+ bottom: "auto"
975
+ };
976
+ case "top-right": return {
977
+ top: `${s}px`,
978
+ right: `${o}px`,
979
+ left: "auto",
980
+ bottom: "auto"
981
+ };
982
+ case "bottom-left": return {
983
+ bottom: `${s}px`,
984
+ left: `${o}px`,
985
+ right: "auto",
986
+ top: "auto"
987
+ };
988
+ case "bottom-right": return {
989
+ bottom: `${s}px`,
990
+ right: `${o}px`,
991
+ left: "auto",
992
+ top: "auto"
993
+ };
994
+ case "center": return {
995
+ top: `calc(50% - ${a / 2}px + ${s}px)`,
996
+ left: `calc(50% - ${i / 2}px + ${o}px)`,
997
+ right: "auto",
998
+ bottom: "auto"
999
+ };
1000
+ default: throw Error(`Position "${e}" is not supported for detached glass.`);
1001
+ }
1002
+ }
1003
+ var U = new class {
1004
+ constructor() {
1005
+ this.glasses = [], this.topZIndex = 1;
1006
+ }
1007
+ addGlassByElement(e) {
1008
+ this.glasses.push(e);
1009
+ }
1010
+ getActiveGlass() {
1011
+ return this.glasses.find((e) => e.hasAttribute("active")) ?? null;
1012
+ }
1013
+ bringToFront(e) {
1014
+ e.hasAttribute("active") || (this.topZIndex += 1, e.style.zIndex = this.topZIndex, e.parentElement?.querySelectorAll(":scope > bw-glass[detached][active]").forEach((t) => t !== e && t.removeAttribute("active")), e.setAttribute("active", ""));
1015
+ }
1016
+ removeGlassById(e) {
1017
+ let t = this.glasses.findIndex((t) => t.id === e);
1018
+ if (t !== -1) {
1019
+ let [e] = this.glasses.splice(t, 1);
1020
+ return e;
1021
+ }
1022
+ return null;
1023
+ }
1024
+ }(), W = [
1025
+ {
1026
+ label: "",
1027
+ className: "bw-glass-action--minimize",
1028
+ onClick: (e, t) => {
1029
+ let n = t.sillElement;
1030
+ if (!n) throw Error("[bwin] Sill element not found when minimizing");
1031
+ let r = c("<button class=\"bw-minimized-detached-glass\" />");
1032
+ n.append(r);
1033
+ let i = e.target.closest("bw-glass[detached]");
1034
+ if (!i) throw Error("[bwin] Detached Glass element not found when minimizing");
1035
+ r.bwDetachedGlassElement = i, i.style.display = "none";
1036
+ }
1037
+ },
1038
+ {
1039
+ label: "",
1040
+ className: "bw-glass-action--attach",
1041
+ onClick: (e, t) => {
1042
+ let n = e.target.closest("bw-glass[detached]"), r = n.bwOriginalPosition, i = n.bwOriginalSiblingSashId, a = n.bwOriginalRelativeSize, o = t.rootSash.getById(i), s = i, c = r, u = a;
1043
+ if (!o) {
1044
+ let e = t.rootSash.getLargestLeaf();
1045
+ s = e.id, c = e.width > e.height ? "right" : "bottom", u = .5;
1046
+ }
1047
+ let d = n.querySelector("bw-glass-content");
1048
+ t.addPane(s, {
1049
+ position: c,
1050
+ size: u,
1051
+ content: l(d),
1052
+ title: n.querySelector("bw-glass-title")?.textContent || ""
1053
+ }), t.removeDetachedGlass(n.id);
1054
+ }
1055
+ },
1056
+ {
1057
+ label: "",
1058
+ className: "bw-glass-action--close",
1059
+ onClick: (e) => {
1060
+ let t = e.target.closest("bw-glass[detached]");
1061
+ t && (U.removeGlassById(t.id), t.remove());
1062
+ }
1063
+ }
1064
+ ], ve = class extends H {
1065
+ constructor(e) {
1066
+ let { position: n, width: r = 222, height: i = 222, offset: a = 0, offsetX: o, offsetY: s, id: c, actions: l = W, ...u } = e;
1067
+ super({
1068
+ ...u,
1069
+ actions: l
1070
+ }), this.domNode.setAttribute("id", c || t() + "-F"), this.domNode.setAttribute("detached", ""), this.domNode.style.position = "absolute", this.domNode.style.width = `${r}px`, this.domNode.style.height = `${i}px`;
1071
+ let { top: d, left: f, right: p, bottom: m } = _e({
1072
+ position: n,
1073
+ offset: a,
1074
+ offsetX: o,
1075
+ offsetY: s,
1076
+ width: r,
1077
+ height: i
1078
+ });
1079
+ this.domNode.style.top = d, this.domNode.style.left = f, this.domNode.style.right = p, this.domNode.style.bottom = m;
1080
+ }
1081
+ }, ye = 200, be = 200, G = 25;
1082
+ function xe(e, { width: t, height: n }) {
1083
+ let r = U.getActiveGlass();
1084
+ if (!r) return { position: "center" };
1085
+ let i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = a.left - i.left + G, s = a.top - i.top + G;
1086
+ return o + t > i.width && (o = G), s + n > i.height && (s = G), {
1087
+ position: "top-left",
1088
+ offsetX: o,
1089
+ offsetY: s
1090
+ };
1091
+ }
1092
+ var Se = {
1093
+ addDetachedGlass(e = {}) {
1094
+ let t = e.width ?? ye, n = e.height ?? be, { position: r, offsetX: i, offsetY: a } = e.position ? {} : xe(this.windowElement, {
1095
+ width: t,
1096
+ height: n
1097
+ }), o = new ve({
1098
+ actions: this.actions[1],
1099
+ binaryWindow: this,
1100
+ position: r,
1101
+ offsetX: i,
1102
+ offsetY: a,
1103
+ ...e,
1104
+ width: t,
1105
+ height: n
1106
+ });
1107
+ return this.windowElement.append(o.domNode), U.addGlassByElement(o.domNode), U.bringToFront(o.domNode), o;
1108
+ },
1109
+ removeDetachedGlass(e) {
1110
+ let t = U.removeGlassById(e);
1111
+ return t?.remove(), t;
1112
+ }
1113
+ }, Ce = { enableDetachedGlassActivate() {
1114
+ this.windowElement.addEventListener("pointerdown", (e) => {
1115
+ if (e.button !== 0) return;
1116
+ let t = e.target.closest?.("bw-glass[detached]");
1117
+ t && U.bringToFront(t);
1118
+ });
1119
+ } }, we = { enableDetachedGlassMove() {
1120
+ let e = null, t = 0, n = 0, r = 0, i = 0;
1121
+ this.windowElement.addEventListener("pointerdown", (a) => {
1122
+ if (a.button !== 0) return;
1123
+ let o = a.target.closest("bw-glass-header");
1124
+ if (!o || a.target.closest("button") || o.getAttribute("can-drag") === "false") return;
1125
+ let s = o.closest("bw-glass[detached]");
1126
+ if (!s) return;
1127
+ a.preventDefault(), o.setPointerCapture(a.pointerId), e = s, t = a.pageX, n = a.pageY;
1128
+ let c = this.windowElement.getBoundingClientRect(), l = s.getBoundingClientRect();
1129
+ r = l.left - c.left, i = l.top - c.top;
1130
+ }), this.windowElement.addEventListener("pointermove", (a) => {
1131
+ if (!e) return;
1132
+ let o = r + (a.pageX - t), s = i + (a.pageY - n);
1133
+ e.style.right = "auto", e.style.bottom = "auto", e.style.left = `${o}px`, e.style.top = `${s}px`;
1134
+ }), this.windowElement.addEventListener("pointerup", (t) => {
1135
+ e &&= (t.target.hasPointerCapture?.(t.pointerId) && t.target.releasePointerCapture(t.pointerId), null);
1136
+ });
1137
+ } }, K = null, q = 0, J = 0, Y = { enableDetachedGlassDrag() {
1138
+ document.addEventListener("mousedown", (e) => {
1139
+ if (e.button !== 0) return;
1140
+ let t = e.target.closest("bw-glass-header");
1141
+ if (!t || e.target.closest("button") || t.getAttribute("can-drag") === "false") return;
1142
+ let n = t.closest("bw-glass[detached]");
1143
+ n && (n.setAttribute("draggable", !0), K = n);
1144
+ }), document.addEventListener("mouseup", () => {
1145
+ K &&= (K.removeAttribute("draggable"), null);
1146
+ }), this.windowElement.addEventListener("dragstart", (e) => {
1147
+ if (!K) return;
1148
+ e.dataTransfer.effectAllowed = "move";
1149
+ let t = K.getBoundingClientRect();
1150
+ q = e.clientX - t.left, J = e.clientY - t.top;
1151
+ }), this.windowElement.addEventListener("dragend", (e) => {
1152
+ if (!K) return;
1153
+ let t = this.windowElement.getBoundingClientRect(), n = e.clientX - t.left - q, r = e.clientY - t.top - J;
1154
+ K.style.right = "auto", K.style.bottom = "auto", K.style.left = `${n}px`, K.style.top = `${r}px`, K.removeAttribute("draggable"), K = null;
1155
+ });
1156
+ } }, X = 100, Z = 60;
1157
+ function Te(e) {
1158
+ return !!e.querySelector(":scope > bw-glass-resize-handle");
1159
+ }
1160
+ function Ee(e) {
1161
+ Te(e) || e.append(...ge());
1162
+ }
1163
+ function Q(e) {
1164
+ e.querySelectorAll(":scope > bw-glass-resize-handle").forEach((e) => e.remove());
1165
+ }
1166
+ var De = { enableDetachedGlassResize() {
1167
+ let e = null, t = "", n = 0, r = 0, i = null;
1168
+ this.windowElement.addEventListener("pointerover", (e) => {
1169
+ let t = e.target.closest?.("bw-glass[detached]");
1170
+ t && Ee(t);
1171
+ }), this.windowElement.addEventListener("pointerout", (t) => {
1172
+ let n = t.target.closest?.("bw-glass[detached]");
1173
+ n && t.relatedTarget?.closest?.("bw-glass[detached]") !== n && n !== e && Q(n);
1174
+ }), this.windowElement.addEventListener("pointerdown", (a) => {
1175
+ if (a.button !== 0 || a.target.tagName !== "BW-GLASS-RESIZE-HANDLE") return;
1176
+ let o = a.target.closest("bw-glass[detached]");
1177
+ if (!o) return;
1178
+ a.preventDefault(), a.target.setPointerCapture(a.pointerId), e = o, t = a.target.getAttribute("resize-dir"), n = a.pageX, r = a.pageY;
1179
+ let s = this.windowElement.getBoundingClientRect(), c = o.getBoundingClientRect();
1180
+ i = {
1181
+ left: c.left - s.left,
1182
+ top: c.top - s.top,
1183
+ width: c.width,
1184
+ height: c.height
1185
+ };
1186
+ }), this.windowElement.addEventListener("pointermove", (a) => {
1187
+ if (!e) return;
1188
+ let o = t, s = a.pageX - n, c = a.pageY - r, l = i, { left: u, top: d, width: f, height: p } = l;
1189
+ o.includes("e") ? f = Math.max(X, l.width + s) : o.includes("w") && (f = Math.max(X, l.width - s), u = l.left + (l.width - f)), o.includes("s") ? p = Math.max(Z, l.height + c) : o.includes("n") && (p = Math.max(Z, 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`;
1190
+ }), this.windowElement.addEventListener("pointerup", (n) => {
1191
+ if (!e) return;
1192
+ n.target.hasPointerCapture?.(n.pointerId) && n.target.releasePointerCapture(n.pointerId);
1193
+ let r = e;
1194
+ e = null, t = "", i = null, r.matches(":hover") || Q(r);
1195
+ });
1196
+ } }, Oe = { handleMinimizedDetachedGlassClick() {
1197
+ this.sillElement.addEventListener("click", (e) => {
1198
+ let t = e.target;
1199
+ if (!t.matches(".bw-minimized-detached-glass")) return;
1200
+ let n = t.bwDetachedGlassElement;
1201
+ n && (n.style.display = "", t.remove(), U.bringToFront(n));
1202
+ });
1203
+ } }, ke = {
1204
+ enableDetachedGlassFeatures() {
1205
+ this.enableDetachedGlassActivate(), this.enableDetachedGlassResize(), this.enableDetachedGlassMove(), this.handleMinimizedDetachedGlassClick();
1206
+ },
1207
+ ...Se,
1208
+ ...Ce,
1209
+ ...we,
1210
+ ...Y,
1211
+ ...De,
1212
+ ...Oe
1213
+ }, $ = class e extends M {
927
1214
  sillElement = null;
1215
+ constructor(t) {
1216
+ super(t), this.theme = t.theme || "", this.actions = e.normActions(t.actions);
1217
+ }
928
1218
  frame() {
929
1219
  super.frame(...arguments);
930
1220
  let e = c("<bw-sill />");
931
1221
  this.windowElement.append(e), this.sillElement = e;
932
1222
  }
933
1223
  enableFeatures() {
934
- super.enableFeatures(), this.enableDrag(), this.enableActions();
1224
+ super.enableFeatures(), this.enableGlassFeature(), this.enableDetachedGlassFeatures();
935
1225
  }
936
1226
  onPaneCreate(e, t) {
937
- let n = new Y({
1227
+ let n = this.actions[0], r = new H({
1228
+ actions: n,
938
1229
  ...t.store,
939
1230
  sash: t,
940
1231
  binaryWindow: this
941
1232
  });
942
- e.innerHTML = "", e.append(n.domNode), this.debug && n.contentElement.prepend(`${t.id}`);
1233
+ e.innerHTML = "", e.append(r.domNode), this.debug && r.contentElement.prepend(`${t.id}`);
943
1234
  }
944
1235
  onPaneUpdate() {}
945
1236
  addPane(e, t) {
@@ -947,7 +1238,7 @@ var K = [
947
1238
  position: n,
948
1239
  size: r,
949
1240
  id: i
950
- }), s = new Y({
1241
+ }), s = new H({
951
1242
  ...a,
952
1243
  sash: o,
953
1244
  binaryWindow: this
@@ -969,7 +1260,17 @@ var K = [
969
1260
  let t = this.getMinimizedGlassElementBySashId(e);
970
1261
  t && t.remove();
971
1262
  }
1263
+ static normActions(e) {
1264
+ if (e === void 0) return [V, W];
1265
+ if (!e || !Array.isArray(e) || e.length === 0) return [[], []];
1266
+ if (e.length === 1 && Array.isArray(e[0])) return [e[0], W];
1267
+ if (!e.some(Array.isArray)) return [e, W];
1268
+ if (e.length >= 2 && !Array.isArray(e[0]) && Array.isArray(e[1])) return [[], e[1]];
1269
+ if (e.length >= 2 && Array.isArray(e[0]) && !Array.isArray(e[1])) return [e[0], []];
1270
+ if (e.length >= 2 && Array.isArray(e[0]) && Array.isArray(e[1])) return e;
1271
+ throw Error("[bwin] Invalid actions format");
1272
+ }
972
1273
  };
973
- Q.assemble(X, Z, q);
1274
+ $.assemble(pe, ke, me);
974
1275
  //#endregion
975
- export { K as BUILTIN_ACTIONS, Q as BinaryWindow, C as ConfigRoot, V as Frame, u as Position, v as Sash, w as SashConfig };
1276
+ export { fe as BUILTIN_ACTIONS, $ as BinaryWindow, S as ConfigRoot, W as DEFAULT_DETACHED_GLASS_ACTIONS, V as DEFAULT_GLASS_ACTIONS, M as Frame, d as Position, v as Sash, C as SashConfig };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "bwin",
3
3
  "description": "A tiling window manager for web browsers",
4
4
  "type": "module",
5
- "version": "0.3.4-dev.1",
5
+ "version": "0.4.1",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/bhjsdev/bwin.git"