@netless/telebox-insider 0.3.0-beta.1 → 0.3.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +83 -14
- package/dist/style.css +104 -11
- package/dist/telebox-insider.cjs.js +1245 -546
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1158 -464
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +2 -2
- package/src/AppMenu/index.ts +152 -0
- package/src/AppMenu/style.scss +109 -0
- package/src/TeleBox/style.scss +2 -2
- package/src/TeleBoxCollector/index.ts +35 -1
- package/src/TeleBoxCollector/style.scss +13 -3
- package/src/TeleBoxManager/MaxTitleBar/index.ts +20 -12
- package/src/TeleBoxManager/MaxTitleBar/style.scss +3 -3
- package/src/TeleBoxManager/index.ts +502 -160
- package/src/TeleBoxManager/typings.ts +2 -0
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +2 -2
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var fancyScrollbar = ".tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}";
|
|
21
|
-
var style$3 = '.telebox-box {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n transition: width 0.4s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.4s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.4s ease;\n}\n\n.telebox-box-main {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: #f9f9fc;\n box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);\n border-radius: 6px;\n border: 1px solid #e3e3ec;\n}\n\n.telebox-titlebar-wrap {\n flex-shrink: 0;\n position: relative;\n z-index: 1;\n}\n\n.telebox-content-wrap {\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n}\n\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n\n.telebox-resize-handle {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: absolute;\n z-index: 2147483647;\n}\n\n.telebox-n {\n width: 100%;\n height: 5px;\n left: 0;\n top: -5px;\n cursor: n-resize;\n}\n\n.telebox-s {\n width: 100%;\n height: 5px;\n left: 0;\n bottom: -5px;\n cursor: s-resize;\n}\n\n.telebox-w {\n width: 5px;\n height: 100%;\n left: -5px;\n top: 0;\n cursor: w-resize;\n}\n\n.telebox-e {\n width: 5px;\n height: 100%;\n right: -5px;\n top: 0;\n cursor: e-resize;\n}\n\n.telebox-nw {\n width: 15px;\n height: 15px;\n top: -5px;\n left: -5px;\n cursor: nw-resize;\n}\n\n.telebox-ne {\n width: 15px;\n height: 15px;\n top: -5px;\n right: -5px;\n cursor: ne-resize;\n}\n\n.telebox-se {\n width: 15px;\n height: 15px;\n bottom: -5px;\n right: -5px;\n cursor: se-resize;\n}\n\n.telebox-sw {\n width: 15px;\n height: 15px;\n bottom: -5px;\n left: -5px;\n cursor: sw-resize;\n}\n\n.telebox-track-mask {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 2147483647;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.0001);\n cursor: move;\n}\n\n.telebox-cursor-n {\n cursor: n-resize;\n}\n\n.telebox-cursor-s {\n cursor: s-resize;\n}\n\n.telebox-cursor-w {\n cursor: w-resize;\n}\n\n.telebox-cursor-e {\n cursor: e-resize;\n}\n\n.telebox-cursor-nw {\n cursor: nw-resize;\n}\n\n.telebox-cursor-ne {\n cursor: ne-resize;\n}\n\n.telebox-cursor-se {\n cursor: se-resize;\n}\n\n.telebox-cursor-sw {\n cursor: sw-resize;\n}\n\n.telebox-maximized .telebox-resize-handles,\n.telebox-no-resize .telebox-resize-handles {\n display: none;\n}\n\n.telebox-maximized {\n box-shadow: none;\n transition: none;\n}\n\n.telebox-minimized {\n transition: width 0.05s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.05s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.6s ease;\n opacity: 0;\n pointer-events: none;\n user-select: none;\n}\n\n.telebox-transforming {\n will-change: transform;\n transition: opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0);\n}\n\n.telebox-readonly .telebox-resize-handle {\n cursor: initial !important;\n pointer-events: none !important;\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark .telebox-box-main {\n color: #e9e9e9;\n background: #212126;\n border-color: #43434d;\n}';
|
|
1
|
+
var fancyScrollbar = "";
|
|
2
|
+
var style$4 = "";
|
|
22
3
|
var eventemitter3 = { exports: {} };
|
|
23
4
|
(function(module) {
|
|
24
5
|
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
25
6
|
function Events() {
|
|
26
7
|
}
|
|
27
8
|
if (Object.create) {
|
|
28
|
-
Events.prototype = Object.create(null);
|
|
9
|
+
Events.prototype = /* @__PURE__ */ Object.create(null);
|
|
29
10
|
if (!new Events().__proto__)
|
|
30
11
|
prefix = false;
|
|
31
12
|
}
|
|
@@ -211,8 +192,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
211
192
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
212
193
|
PERFORMANCE OF THIS SOFTWARE.
|
|
213
194
|
***************************************************************************** */
|
|
214
|
-
var __assign
|
|
215
|
-
__assign
|
|
195
|
+
var __assign = function() {
|
|
196
|
+
__assign = Object.assign || function __assign2(t2) {
|
|
216
197
|
for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
217
198
|
s2 = arguments[i2];
|
|
218
199
|
for (var p in s2)
|
|
@@ -221,7 +202,7 @@ var __assign$1 = function() {
|
|
|
221
202
|
}
|
|
222
203
|
return t2;
|
|
223
204
|
};
|
|
224
|
-
return __assign
|
|
205
|
+
return __assign.apply(this, arguments);
|
|
225
206
|
};
|
|
226
207
|
function __rest(s2, e2) {
|
|
227
208
|
var t2 = {};
|
|
@@ -252,8 +233,8 @@ var createStep = function(setRunNextFrame) {
|
|
|
252
233
|
var numThisFrame = 0;
|
|
253
234
|
var isProcessing2 = false;
|
|
254
235
|
var i2 = 0;
|
|
255
|
-
var cancelled = new WeakSet();
|
|
256
|
-
var toKeepAlive = new WeakSet();
|
|
236
|
+
var cancelled = /* @__PURE__ */ new WeakSet();
|
|
237
|
+
var toKeepAlive = /* @__PURE__ */ new WeakSet();
|
|
257
238
|
var renderStep = {
|
|
258
239
|
cancel: function(process) {
|
|
259
240
|
var indexOfCallback = processToRunNextFrame.indexOf(process);
|
|
@@ -358,32 +339,6 @@ var startLoop = function() {
|
|
|
358
339
|
if (!isProcessing)
|
|
359
340
|
onNextFrame(processFrame);
|
|
360
341
|
};
|
|
361
|
-
/*! *****************************************************************************
|
|
362
|
-
Copyright (c) Microsoft Corporation.
|
|
363
|
-
|
|
364
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
365
|
-
purpose with or without fee is hereby granted.
|
|
366
|
-
|
|
367
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
368
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
369
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
370
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
371
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
372
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
373
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
374
|
-
***************************************************************************** */
|
|
375
|
-
var __assign = function() {
|
|
376
|
-
__assign = Object.assign || function __assign2(t2) {
|
|
377
|
-
for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
378
|
-
s2 = arguments[i2];
|
|
379
|
-
for (var p in s2)
|
|
380
|
-
if (Object.prototype.hasOwnProperty.call(s2, p))
|
|
381
|
-
t2[p] = s2[p];
|
|
382
|
-
}
|
|
383
|
-
return t2;
|
|
384
|
-
};
|
|
385
|
-
return __assign.apply(this, arguments);
|
|
386
|
-
};
|
|
387
342
|
var clamp$1 = function(min, max) {
|
|
388
343
|
return function(v) {
|
|
389
344
|
return Math.max(Math.min(v, max), min);
|
|
@@ -541,7 +496,7 @@ var color = {
|
|
|
541
496
|
}
|
|
542
497
|
};
|
|
543
498
|
var createStyler = function(_a) {
|
|
544
|
-
var onRead2 = _a.onRead, onRender2 = _a.onRender, _b = _a.uncachedValues, uncachedValues = _b === void 0 ? new Set() : _b, _c = _a.useCache, useCache = _c === void 0 ? true : _c;
|
|
499
|
+
var onRead2 = _a.onRead, onRender2 = _a.onRender, _b = _a.uncachedValues, uncachedValues = _b === void 0 ? /* @__PURE__ */ new Set() : _b, _c = _a.useCache, useCache = _c === void 0 ? true : _c;
|
|
545
500
|
return function(_a2) {
|
|
546
501
|
if (_a2 === void 0) {
|
|
547
502
|
_a2 = {};
|
|
@@ -624,7 +579,7 @@ var testPrefix = function(key) {
|
|
|
624
579
|
return;
|
|
625
580
|
}
|
|
626
581
|
camelCache.set(key, prefixedPropertyName);
|
|
627
|
-
setDashPrefix(key,
|
|
582
|
+
setDashPrefix(key, (noPrefix ? "" : "-") + camelToDash(prefixedPropertyName));
|
|
628
583
|
}
|
|
629
584
|
}
|
|
630
585
|
};
|
|
@@ -663,7 +618,7 @@ var transformOriginProps = /* @__PURE__ */ new Set(["originX", "originY", "origi
|
|
|
663
618
|
function isTransformOriginProp(key) {
|
|
664
619
|
return transformOriginProps.has(key);
|
|
665
620
|
}
|
|
666
|
-
var int = /* @__PURE__ */ __assign
|
|
621
|
+
var int = /* @__PURE__ */ __assign(/* @__PURE__ */ __assign({}, number), { transform: Math.round });
|
|
667
622
|
var valueTypes = {
|
|
668
623
|
color,
|
|
669
624
|
backgroundColor: color,
|
|
@@ -882,7 +837,7 @@ function createCssStyler(element, _a) {
|
|
|
882
837
|
_a = {};
|
|
883
838
|
}
|
|
884
839
|
var enableHardwareAcceleration = _a.enableHardwareAcceleration, allowTransformNone = _a.allowTransformNone, props = __rest(_a, ["enableHardwareAcceleration", "allowTransformNone"]);
|
|
885
|
-
return cssStyler(__assign
|
|
840
|
+
return cssStyler(__assign({ element, buildStyles: createStyleBuilder({
|
|
886
841
|
enableHardwareAcceleration,
|
|
887
842
|
allowTransformNone
|
|
888
843
|
}), preparseOutput: true }, props));
|
|
@@ -1072,7 +1027,7 @@ const e$1 = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop
|
|
|
1072
1027
|
};
|
|
1073
1028
|
class o {
|
|
1074
1029
|
constructor() {
|
|
1075
|
-
this.disposers = new Map();
|
|
1030
|
+
this.disposers = /* @__PURE__ */ new Map();
|
|
1076
1031
|
}
|
|
1077
1032
|
add(e2, s2 = r$1()) {
|
|
1078
1033
|
return this.flush(s2), this.disposers.set(s2, e2()), s2;
|
|
@@ -1120,9 +1075,9 @@ class o {
|
|
|
1120
1075
|
}), this.disposers.clear();
|
|
1121
1076
|
}
|
|
1122
1077
|
}
|
|
1123
|
-
var e = Object.defineProperty, s = (typeof require
|
|
1078
|
+
var e = Object.defineProperty, s = ("undefined" != typeof require && require, (s2, r2, t2) => (((s3, r3, t3) => {
|
|
1124
1079
|
r3 in s3 ? e(s3, r3, { enumerable: true, configurable: true, writable: true, value: t3 }) : s3[r3] = t3;
|
|
1125
|
-
})(s2, typeof r2
|
|
1080
|
+
})(s2, "symbol" != typeof r2 ? r2 + "" : r2, t2), t2));
|
|
1126
1081
|
class r {
|
|
1127
1082
|
constructor(e2, r2) {
|
|
1128
1083
|
s(this, "_value"), s(this, "_beforeDestroys"), s(this, "_subscribers"), this._value = e2, r2 && (this.compare = r2);
|
|
@@ -1137,7 +1092,7 @@ class r {
|
|
|
1137
1092
|
}
|
|
1138
1093
|
}
|
|
1139
1094
|
reaction(e2) {
|
|
1140
|
-
return this._subscribers || (this._subscribers = new Set()), this._subscribers.add(e2), () => {
|
|
1095
|
+
return this._subscribers || (this._subscribers = /* @__PURE__ */ new Set()), this._subscribers.add(e2), () => {
|
|
1141
1096
|
this._subscribers && this._subscribers.delete(e2);
|
|
1142
1097
|
};
|
|
1143
1098
|
}
|
|
@@ -1155,7 +1110,7 @@ class r {
|
|
|
1155
1110
|
this._beforeDestroys && (this._beforeDestroys.forEach((e2) => e2()), this._beforeDestroys.clear()), this._subscribers && this._subscribers.clear();
|
|
1156
1111
|
}
|
|
1157
1112
|
addBeforeDestroy(e2) {
|
|
1158
|
-
return this._beforeDestroys || (this._beforeDestroys = new Set()), this._beforeDestroys.add(e2), () => {
|
|
1113
|
+
return this._beforeDestroys || (this._beforeDestroys = /* @__PURE__ */ new Set()), this._beforeDestroys.add(e2), () => {
|
|
1159
1114
|
this._beforeDestroys && this._beforeDestroys.delete(e2);
|
|
1160
1115
|
};
|
|
1161
1116
|
}
|
|
@@ -1196,21 +1151,20 @@ function c(e2) {
|
|
|
1196
1151
|
};
|
|
1197
1152
|
return { bindSideEffect: s2, combine: (e3, r2, i2, o2) => s2(t(e3, r2, i2, o2)), createVal: (e3, t2) => s2(new r(e3, t2)) };
|
|
1198
1153
|
}
|
|
1199
|
-
var style$
|
|
1200
|
-
var TELE_BOX_COLOR_SCHEME
|
|
1201
|
-
(function(TELE_BOX_COLOR_SCHEME2) {
|
|
1154
|
+
var style$3 = "";
|
|
1155
|
+
var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
|
|
1202
1156
|
TELE_BOX_COLOR_SCHEME2["Light"] = "light";
|
|
1203
1157
|
TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
|
|
1204
1158
|
TELE_BOX_COLOR_SCHEME2["Auto"] = "auto";
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
(
|
|
1159
|
+
return TELE_BOX_COLOR_SCHEME2;
|
|
1160
|
+
})(TELE_BOX_COLOR_SCHEME || {});
|
|
1161
|
+
var TELE_BOX_STATE = /* @__PURE__ */ ((TELE_BOX_STATE2) => {
|
|
1208
1162
|
TELE_BOX_STATE2["Normal"] = "normal";
|
|
1209
1163
|
TELE_BOX_STATE2["Minimized"] = "minimized";
|
|
1210
1164
|
TELE_BOX_STATE2["Maximized"] = "maximized";
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
(
|
|
1165
|
+
return TELE_BOX_STATE2;
|
|
1166
|
+
})(TELE_BOX_STATE || {});
|
|
1167
|
+
var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
|
|
1214
1168
|
TELE_BOX_EVENT2["DarkMode"] = "dark_mode";
|
|
1215
1169
|
TELE_BOX_EVENT2["PrefersColorScheme"] = "prefers_color_scheme";
|
|
1216
1170
|
TELE_BOX_EVENT2["Close"] = "close";
|
|
@@ -1229,15 +1183,15 @@ var TELE_BOX_EVENT;
|
|
|
1229
1183
|
TELE_BOX_EVENT2["Destroyed"] = "destroyed";
|
|
1230
1184
|
TELE_BOX_EVENT2["BoxStatus"] = "box_status";
|
|
1231
1185
|
TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
(
|
|
1186
|
+
return TELE_BOX_EVENT2;
|
|
1187
|
+
})(TELE_BOX_EVENT || {});
|
|
1188
|
+
var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
|
|
1235
1189
|
TELE_BOX_DELEGATE_EVENT2["Close"] = "close";
|
|
1236
1190
|
TELE_BOX_DELEGATE_EVENT2["Maximize"] = "maximize";
|
|
1237
1191
|
TELE_BOX_DELEGATE_EVENT2["Minimize"] = "minimize";
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
(
|
|
1192
|
+
return TELE_BOX_DELEGATE_EVENT2;
|
|
1193
|
+
})(TELE_BOX_DELEGATE_EVENT || {});
|
|
1194
|
+
var TELE_BOX_RESIZE_HANDLE = /* @__PURE__ */ ((TELE_BOX_RESIZE_HANDLE2) => {
|
|
1241
1195
|
TELE_BOX_RESIZE_HANDLE2["North"] = "n";
|
|
1242
1196
|
TELE_BOX_RESIZE_HANDLE2["South"] = "s";
|
|
1243
1197
|
TELE_BOX_RESIZE_HANDLE2["West"] = "w";
|
|
@@ -1246,7 +1200,8 @@ var TELE_BOX_RESIZE_HANDLE;
|
|
|
1246
1200
|
TELE_BOX_RESIZE_HANDLE2["NorthEast"] = "ne";
|
|
1247
1201
|
TELE_BOX_RESIZE_HANDLE2["SouthEast"] = "se";
|
|
1248
1202
|
TELE_BOX_RESIZE_HANDLE2["SouthWest"] = "sw";
|
|
1249
|
-
|
|
1203
|
+
return TELE_BOX_RESIZE_HANDLE2;
|
|
1204
|
+
})(TELE_BOX_RESIZE_HANDLE || {});
|
|
1250
1205
|
const TeleBoxDragHandleType = "dh";
|
|
1251
1206
|
function clamp(value, min, max) {
|
|
1252
1207
|
return Math.min(Math.max(value, min), max);
|
|
@@ -1385,7 +1340,10 @@ class DefaultTitleBar {
|
|
|
1385
1340
|
this.state = state;
|
|
1386
1341
|
this.buttons.forEach((btn, i2) => {
|
|
1387
1342
|
if (btn.isActive) {
|
|
1388
|
-
this.$btns[i2].classList.toggle(
|
|
1343
|
+
this.$btns[i2].classList.toggle(
|
|
1344
|
+
"is-active",
|
|
1345
|
+
btn.isActive(state)
|
|
1346
|
+
);
|
|
1389
1347
|
}
|
|
1390
1348
|
});
|
|
1391
1349
|
}
|
|
@@ -1396,7 +1354,10 @@ class DefaultTitleBar {
|
|
|
1396
1354
|
if (boxStatus) {
|
|
1397
1355
|
this.buttons.forEach((btn, i2) => {
|
|
1398
1356
|
if (btn.isActive) {
|
|
1399
|
-
this.$btns[i2].classList.toggle(
|
|
1357
|
+
this.$btns[i2].classList.toggle(
|
|
1358
|
+
"is-active",
|
|
1359
|
+
btn.isActive(boxStatus)
|
|
1360
|
+
);
|
|
1400
1361
|
}
|
|
1401
1362
|
});
|
|
1402
1363
|
}
|
|
@@ -1428,7 +1389,9 @@ class DefaultTitleBar {
|
|
|
1428
1389
|
this.buttons.forEach(({ iconClassName, isActive }, i2) => {
|
|
1429
1390
|
const teleTitleBarBtnIndex = String(i2);
|
|
1430
1391
|
const $btn = document.createElement("button");
|
|
1431
|
-
$btn.className = `${this.wrapClassName(
|
|
1392
|
+
$btn.className = `${this.wrapClassName(
|
|
1393
|
+
"titlebar-btn"
|
|
1394
|
+
)} ${iconClassName}`;
|
|
1432
1395
|
$btn.dataset.teleTitleBarBtnIndex = teleTitleBarBtnIndex;
|
|
1433
1396
|
$btn.dataset.teleTitleBarNoDblClick = "true";
|
|
1434
1397
|
if (isActive) {
|
|
@@ -1437,24 +1400,30 @@ class DefaultTitleBar {
|
|
|
1437
1400
|
this.$btns.push($btn);
|
|
1438
1401
|
$buttonsContainer.appendChild($btn);
|
|
1439
1402
|
});
|
|
1440
|
-
this.sideEffect.addEventListener(
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1403
|
+
this.sideEffect.addEventListener(
|
|
1404
|
+
$buttonsContainer,
|
|
1405
|
+
"click",
|
|
1406
|
+
(ev) => {
|
|
1407
|
+
var _a;
|
|
1408
|
+
if (this.readonly) {
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
const target = ev.target;
|
|
1412
|
+
const teleTitleBarBtnIndex = Number(
|
|
1413
|
+
(_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex
|
|
1414
|
+
);
|
|
1415
|
+
if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
|
|
1416
|
+
preventEvent(ev);
|
|
1417
|
+
const btn = this.buttons[teleTitleBarBtnIndex];
|
|
1418
|
+
if (this.onEvent) {
|
|
1419
|
+
this.onEvent({
|
|
1420
|
+
type: btn.type,
|
|
1421
|
+
value: btn.value
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1455
1424
|
}
|
|
1456
1425
|
}
|
|
1457
|
-
|
|
1426
|
+
);
|
|
1458
1427
|
this.$titleBar.appendChild($titleArea);
|
|
1459
1428
|
this.$titleBar.appendChild($buttonsContainer);
|
|
1460
1429
|
}
|
|
@@ -1464,8 +1433,17 @@ class DefaultTitleBar {
|
|
|
1464
1433
|
const $dragArea = document.createElement("div");
|
|
1465
1434
|
$dragArea.className = this.wrapClassName("drag-area");
|
|
1466
1435
|
$dragArea.dataset.teleBoxHandle = TeleBoxDragHandleType;
|
|
1467
|
-
this.sideEffect.addEventListener(
|
|
1468
|
-
|
|
1436
|
+
this.sideEffect.addEventListener(
|
|
1437
|
+
$dragArea,
|
|
1438
|
+
"mousedown",
|
|
1439
|
+
this.handleTitleBarClick
|
|
1440
|
+
);
|
|
1441
|
+
this.sideEffect.addEventListener(
|
|
1442
|
+
$dragArea,
|
|
1443
|
+
"touchstart",
|
|
1444
|
+
this.handleTitleBarTouch,
|
|
1445
|
+
{ passive: true }
|
|
1446
|
+
);
|
|
1469
1447
|
return $dragArea;
|
|
1470
1448
|
}
|
|
1471
1449
|
dragHandle() {
|
|
@@ -1536,34 +1514,49 @@ class TeleBox {
|
|
|
1536
1514
|
this._delegateEvents = new EventEmitter();
|
|
1537
1515
|
const boxStatus$ = createVal(boxStatus);
|
|
1538
1516
|
const lastNotMinimizedBoxStatus$ = createVal(lastNotMinimizedBoxStatus);
|
|
1539
|
-
const prefersColorScheme$ = createVal(
|
|
1517
|
+
const prefersColorScheme$ = createVal(
|
|
1518
|
+
prefersColorScheme
|
|
1519
|
+
);
|
|
1540
1520
|
prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
|
|
1541
1521
|
if (!skipUpdate) {
|
|
1542
|
-
this.events.emit(
|
|
1522
|
+
this.events.emit(
|
|
1523
|
+
TELE_BOX_EVENT.PrefersColorScheme,
|
|
1524
|
+
prefersColorScheme2
|
|
1525
|
+
);
|
|
1543
1526
|
}
|
|
1544
1527
|
});
|
|
1545
1528
|
const darkMode$ = createVal(Boolean(darkMode));
|
|
1546
1529
|
if (darkMode == null) {
|
|
1547
|
-
prefersColorScheme$.subscribe(
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1530
|
+
prefersColorScheme$.subscribe(
|
|
1531
|
+
(prefersColorScheme2, _, skipUpdate) => {
|
|
1532
|
+
this._sideEffect.add(() => {
|
|
1533
|
+
if (prefersColorScheme2 === "auto") {
|
|
1534
|
+
const prefersDark = window.matchMedia(
|
|
1535
|
+
"(prefers-color-scheme: dark)"
|
|
1536
|
+
);
|
|
1537
|
+
if (prefersDark) {
|
|
1538
|
+
darkMode$.setValue(
|
|
1539
|
+
prefersDark.matches,
|
|
1540
|
+
skipUpdate
|
|
1541
|
+
);
|
|
1542
|
+
const handler = (evt) => {
|
|
1543
|
+
darkMode$.setValue(evt.matches, skipUpdate);
|
|
1544
|
+
};
|
|
1545
|
+
prefersDark.addListener(handler);
|
|
1546
|
+
return () => prefersDark.removeListener(handler);
|
|
1547
|
+
} else {
|
|
1548
|
+
return noop;
|
|
1549
|
+
}
|
|
1558
1550
|
} else {
|
|
1551
|
+
darkMode$.setValue(
|
|
1552
|
+
prefersColorScheme2 === "dark",
|
|
1553
|
+
skipUpdate
|
|
1554
|
+
);
|
|
1559
1555
|
return noop;
|
|
1560
1556
|
}
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1565
|
-
}, "prefers-color-scheme");
|
|
1566
|
-
});
|
|
1557
|
+
}, "prefers-color-scheme");
|
|
1558
|
+
}
|
|
1559
|
+
);
|
|
1567
1560
|
}
|
|
1568
1561
|
darkMode$.reaction((darkMode2, _, skipUpdate) => {
|
|
1569
1562
|
if (!skipUpdate) {
|
|
@@ -1603,7 +1596,9 @@ class TeleBox {
|
|
|
1603
1596
|
const focus$ = createVal(focus);
|
|
1604
1597
|
focus$.reaction((focus2, _, skipUpdate) => {
|
|
1605
1598
|
if (!skipUpdate) {
|
|
1606
|
-
this.events.emit(
|
|
1599
|
+
this.events.emit(
|
|
1600
|
+
focus2 ? TELE_BOX_EVENT.Focus : TELE_BOX_EVENT.Blur
|
|
1601
|
+
);
|
|
1607
1602
|
}
|
|
1608
1603
|
});
|
|
1609
1604
|
const minimized$ = createVal(minimized);
|
|
@@ -1618,98 +1613,125 @@ class TeleBox {
|
|
|
1618
1613
|
this.events.emit(TELE_BOX_EVENT.Maximized, maximized2);
|
|
1619
1614
|
}
|
|
1620
1615
|
});
|
|
1621
|
-
const state$ = combine(
|
|
1616
|
+
const state$ = combine(
|
|
1617
|
+
[minimized$, maximized$, boxStatus$],
|
|
1618
|
+
([minimized2, maximized2, boxStatus2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : !boxStatus2 ? TELE_BOX_STATE.Normal : boxStatus2
|
|
1619
|
+
);
|
|
1622
1620
|
state$.reaction((state, _, skipUpdate) => {
|
|
1623
1621
|
if (!skipUpdate) {
|
|
1624
1622
|
this.events.emit(TELE_BOX_EVENT.State, state);
|
|
1625
1623
|
}
|
|
1626
1624
|
});
|
|
1627
|
-
const minSize$ = createVal(
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1625
|
+
const minSize$ = createVal(
|
|
1626
|
+
{
|
|
1627
|
+
width: clamp(minWidth, 0, 1),
|
|
1628
|
+
height: clamp(minHeight, 0, 1)
|
|
1629
|
+
},
|
|
1630
|
+
shallowequal
|
|
1631
|
+
);
|
|
1632
|
+
const intrinsicSize$ = createVal(
|
|
1633
|
+
{
|
|
1634
|
+
width: clamp(width, minSize$.value.width, 1),
|
|
1635
|
+
height: clamp(height, minSize$.value.height, 1)
|
|
1636
|
+
},
|
|
1637
|
+
shallowequal
|
|
1638
|
+
);
|
|
1635
1639
|
minSize$.reaction((minSize, _, skipUpdate) => {
|
|
1636
|
-
intrinsicSize$.setValue(
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
+
intrinsicSize$.setValue(
|
|
1641
|
+
{
|
|
1642
|
+
width: clamp(width, minSize.width, 1),
|
|
1643
|
+
height: clamp(height, minSize.height, 1)
|
|
1644
|
+
},
|
|
1645
|
+
skipUpdate
|
|
1646
|
+
);
|
|
1640
1647
|
});
|
|
1641
1648
|
intrinsicSize$.reaction((size, _, skipUpdate) => {
|
|
1642
1649
|
if (!skipUpdate) {
|
|
1643
1650
|
this.events.emit(TELE_BOX_EVENT.IntrinsicResize, size);
|
|
1644
1651
|
}
|
|
1645
1652
|
});
|
|
1646
|
-
const size$ = combine(
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1653
|
+
const size$ = combine(
|
|
1654
|
+
[intrinsicSize$, maximized$, boxStatus$],
|
|
1655
|
+
([intrinsicSize, maximized2, boxStatus2]) => {
|
|
1656
|
+
if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
|
|
1657
|
+
return { width: 1, height: 1 };
|
|
1658
|
+
}
|
|
1659
|
+
return intrinsicSize;
|
|
1660
|
+
},
|
|
1661
|
+
shallowequal
|
|
1662
|
+
);
|
|
1652
1663
|
size$.reaction((size, _, skipUpdate) => {
|
|
1653
1664
|
if (!skipUpdate) {
|
|
1654
1665
|
this.events.emit(TELE_BOX_EVENT.Resize, size);
|
|
1655
1666
|
}
|
|
1656
1667
|
});
|
|
1657
|
-
const visualSize$ = combine(
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1668
|
+
const visualSize$ = combine(
|
|
1669
|
+
[size$, minimized$, containerRect$, collectorRect$, boxStatus$],
|
|
1670
|
+
([size, minimized2, containerRect2, collectorRect2, boxStatus2]) => {
|
|
1671
|
+
if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
|
|
1672
|
+
return {
|
|
1673
|
+
width: collectorRect2.width / size.width / containerRect2.width,
|
|
1674
|
+
height: collectorRect2.height / size.height / containerRect2.height
|
|
1675
|
+
};
|
|
1676
|
+
}
|
|
1677
|
+
return size;
|
|
1678
|
+
},
|
|
1679
|
+
shallowequal
|
|
1680
|
+
);
|
|
1666
1681
|
visualSize$.reaction((size, _, skipUpdate) => {
|
|
1667
1682
|
if (!skipUpdate) {
|
|
1668
1683
|
this.events.emit(TELE_BOX_EVENT.VisualResize, size);
|
|
1669
1684
|
}
|
|
1670
1685
|
});
|
|
1671
|
-
const intrinsicCoord$ = createVal(
|
|
1686
|
+
const intrinsicCoord$ = createVal(
|
|
1687
|
+
{ x: clamp(x, 0, 1), y: clamp(y, 0, 1) },
|
|
1688
|
+
shallowequal
|
|
1689
|
+
);
|
|
1672
1690
|
intrinsicCoord$.reaction((coord, _, skipUpdate) => {
|
|
1673
1691
|
if (!skipUpdate) {
|
|
1674
1692
|
this.events.emit(TELE_BOX_EVENT.IntrinsicMove, coord);
|
|
1675
1693
|
}
|
|
1676
1694
|
});
|
|
1677
|
-
const coord$ = combine(
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1695
|
+
const coord$ = combine(
|
|
1696
|
+
[
|
|
1697
|
+
intrinsicCoord$,
|
|
1698
|
+
intrinsicSize$,
|
|
1699
|
+
containerRect$,
|
|
1700
|
+
collectorRect$,
|
|
1701
|
+
minimized$,
|
|
1702
|
+
maximized$,
|
|
1703
|
+
boxStatus$,
|
|
1704
|
+
lastNotMinimizedBoxStatus$
|
|
1705
|
+
],
|
|
1706
|
+
([
|
|
1707
|
+
intrinsicCoord,
|
|
1708
|
+
intrinsicSize,
|
|
1709
|
+
containerRect2,
|
|
1710
|
+
collectorRect2,
|
|
1711
|
+
minimized2,
|
|
1712
|
+
maximized2,
|
|
1713
|
+
boxStatus2,
|
|
1714
|
+
lastNotMinimizedBoxStatus2
|
|
1715
|
+
]) => {
|
|
1716
|
+
if ((minimized2 || boxStatus2 === TELE_BOX_STATE.Minimized) && collectorRect2) {
|
|
1717
|
+
if (maximized2 || lastNotMinimizedBoxStatus2 === TELE_BOX_STATE.Maximized) {
|
|
1718
|
+
return {
|
|
1719
|
+
x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - 1 / 2,
|
|
1720
|
+
y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - 1 / 2
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1698
1723
|
return {
|
|
1699
|
-
x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width -
|
|
1700
|
-
y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height -
|
|
1724
|
+
x: (collectorRect2.x + collectorRect2.width / 2) / containerRect2.width - intrinsicSize.width / 2,
|
|
1725
|
+
y: (collectorRect2.y + collectorRect2.height / 2) / containerRect2.height - intrinsicSize.height / 2
|
|
1701
1726
|
};
|
|
1702
1727
|
}
|
|
1703
|
-
|
|
1704
|
-
x:
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}
|
|
1711
|
-
return intrinsicCoord;
|
|
1712
|
-
}, shallowequal);
|
|
1728
|
+
if (maximized2 || boxStatus2 === TELE_BOX_STATE.Maximized) {
|
|
1729
|
+
return { x: 0, y: 0 };
|
|
1730
|
+
}
|
|
1731
|
+
return intrinsicCoord;
|
|
1732
|
+
},
|
|
1733
|
+
shallowequal
|
|
1734
|
+
);
|
|
1713
1735
|
coord$.reaction((coord, _, skipUpdate) => {
|
|
1714
1736
|
if (!skipUpdate) {
|
|
1715
1737
|
this.events.emit(TELE_BOX_EVENT.Move, coord);
|
|
@@ -1746,7 +1768,10 @@ class TeleBox {
|
|
|
1746
1768
|
break;
|
|
1747
1769
|
}
|
|
1748
1770
|
default: {
|
|
1749
|
-
console.error(
|
|
1771
|
+
console.error(
|
|
1772
|
+
"Unsupported titleBar event:",
|
|
1773
|
+
event
|
|
1774
|
+
);
|
|
1750
1775
|
break;
|
|
1751
1776
|
}
|
|
1752
1777
|
}
|
|
@@ -1793,7 +1818,13 @@ class TeleBox {
|
|
|
1793
1818
|
this._boxStatus$ = boxStatus$;
|
|
1794
1819
|
this._lastNotMinimizedBoxStatus$ = lastNotMinimizedBoxStatus$;
|
|
1795
1820
|
if (this.fixRatio) {
|
|
1796
|
-
this.transform(
|
|
1821
|
+
this.transform(
|
|
1822
|
+
coord$.value.x,
|
|
1823
|
+
coord$.value.y,
|
|
1824
|
+
size$.value.width,
|
|
1825
|
+
size$.value.height,
|
|
1826
|
+
true
|
|
1827
|
+
);
|
|
1797
1828
|
}
|
|
1798
1829
|
this.$box = this.render();
|
|
1799
1830
|
}
|
|
@@ -1860,11 +1891,17 @@ class TeleBox {
|
|
|
1860
1891
|
return this._minSize$.value.height;
|
|
1861
1892
|
}
|
|
1862
1893
|
setMinWidth(minWidth, skipUpdate = false) {
|
|
1863
|
-
this._minSize$.setValue(
|
|
1894
|
+
this._minSize$.setValue(
|
|
1895
|
+
{ width: minWidth, height: this.minHeight },
|
|
1896
|
+
skipUpdate
|
|
1897
|
+
);
|
|
1864
1898
|
return this;
|
|
1865
1899
|
}
|
|
1866
1900
|
setMinHeight(minHeight, skipUpdate = false) {
|
|
1867
|
-
this._minSize$.setValue(
|
|
1901
|
+
this._minSize$.setValue(
|
|
1902
|
+
{ width: this.minWidth, height: minHeight },
|
|
1903
|
+
skipUpdate
|
|
1904
|
+
);
|
|
1868
1905
|
return this;
|
|
1869
1906
|
}
|
|
1870
1907
|
get intrinsicWidth() {
|
|
@@ -1925,14 +1962,20 @@ class TeleBox {
|
|
|
1925
1962
|
height = this.intrinsicHeight;
|
|
1926
1963
|
}
|
|
1927
1964
|
}
|
|
1928
|
-
this._intrinsicCoord$.setValue(
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1965
|
+
this._intrinsicCoord$.setValue(
|
|
1966
|
+
{
|
|
1967
|
+
x: width >= this.minWidth ? x : this.intrinsicX,
|
|
1968
|
+
y: height >= this.minHeight ? y : this.intrinsicY
|
|
1969
|
+
},
|
|
1970
|
+
skipUpdate
|
|
1971
|
+
);
|
|
1972
|
+
this._intrinsicSize$.setValue(
|
|
1973
|
+
{
|
|
1974
|
+
width: clamp(width, this.minWidth, 1),
|
|
1975
|
+
height: clamp(height, this.minHeight, 1)
|
|
1976
|
+
},
|
|
1977
|
+
skipUpdate
|
|
1978
|
+
);
|
|
1936
1979
|
return this;
|
|
1937
1980
|
}
|
|
1938
1981
|
mount(container) {
|
|
@@ -2008,33 +2051,52 @@ class TeleBox {
|
|
|
2008
2051
|
bindClassName(this.$box, this._resizable$, "no-resize", isFalsy);
|
|
2009
2052
|
bindClassName(this.$box, this._focus$, "blur", isFalsy);
|
|
2010
2053
|
bindClassName(this.$box, this._darkMode$, "color-scheme-dark");
|
|
2011
|
-
bindClassName(
|
|
2054
|
+
bindClassName(
|
|
2055
|
+
this.$box,
|
|
2056
|
+
this._darkMode$,
|
|
2057
|
+
"color-scheme-light",
|
|
2058
|
+
isFalsy
|
|
2059
|
+
);
|
|
2012
2060
|
this._renderSideEffect.add(() => {
|
|
2013
2061
|
const minimizedClassName = this.wrapClassName("minimized");
|
|
2014
2062
|
const maximizedClassName = this.wrapClassName("maximized");
|
|
2015
2063
|
const MAXIMIZED_TIMER_ID = "box-maximized-timer";
|
|
2016
2064
|
return this._state$.subscribe((state) => {
|
|
2017
|
-
this.$box.classList.toggle(
|
|
2065
|
+
this.$box.classList.toggle(
|
|
2066
|
+
minimizedClassName,
|
|
2067
|
+
state === TELE_BOX_STATE.Minimized
|
|
2068
|
+
);
|
|
2018
2069
|
if (state === TELE_BOX_STATE.Maximized) {
|
|
2019
2070
|
this._renderSideEffect.flush(MAXIMIZED_TIMER_ID);
|
|
2020
2071
|
this.$box.classList.toggle(maximizedClassName, true);
|
|
2021
2072
|
} else {
|
|
2022
|
-
this._renderSideEffect.setTimeout(
|
|
2023
|
-
|
|
2024
|
-
|
|
2073
|
+
this._renderSideEffect.setTimeout(
|
|
2074
|
+
() => {
|
|
2075
|
+
this.$box.classList.toggle(
|
|
2076
|
+
maximizedClassName,
|
|
2077
|
+
false
|
|
2078
|
+
);
|
|
2079
|
+
},
|
|
2080
|
+
0,
|
|
2081
|
+
MAXIMIZED_TIMER_ID
|
|
2082
|
+
);
|
|
2025
2083
|
}
|
|
2026
2084
|
});
|
|
2027
2085
|
});
|
|
2028
|
-
this._renderSideEffect.add(
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2086
|
+
this._renderSideEffect.add(
|
|
2087
|
+
() => this._visible$.subscribe((visible) => {
|
|
2088
|
+
if (visible) {
|
|
2089
|
+
this.$box.style.removeProperty("display");
|
|
2090
|
+
} else {
|
|
2091
|
+
this.$box.style.display = "none";
|
|
2092
|
+
}
|
|
2093
|
+
})
|
|
2094
|
+
);
|
|
2095
|
+
this._renderSideEffect.add(
|
|
2096
|
+
() => this._zIndex$.subscribe((zIndex) => {
|
|
2097
|
+
this.$box.style.zIndex = String(zIndex);
|
|
2098
|
+
})
|
|
2099
|
+
);
|
|
2038
2100
|
const boxStyler = index(this.$box);
|
|
2039
2101
|
this.$box.dataset.teleBoxID = this.id;
|
|
2040
2102
|
this.$box.style.width = this.absoluteWidth + "px";
|
|
@@ -2042,25 +2104,29 @@ class TeleBox {
|
|
|
2042
2104
|
const translateX = this.x * this.containerRect.width + this.containerRect.x;
|
|
2043
2105
|
const translateY = this.y * this.containerRect.height + this.containerRect.y;
|
|
2044
2106
|
this.$box.style.transform = `translate(${translateX - 10}px,${translateY - 10}px)`;
|
|
2045
|
-
this._valSideEffectBinder.combine(
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2107
|
+
this._valSideEffectBinder.combine(
|
|
2108
|
+
[
|
|
2109
|
+
this._coord$,
|
|
2110
|
+
this._size$,
|
|
2111
|
+
this._minimized$,
|
|
2112
|
+
this._containerRect$,
|
|
2113
|
+
this._collectorRect$,
|
|
2114
|
+
this._boxStatus$
|
|
2115
|
+
],
|
|
2116
|
+
([coord, size, minimized, containerRect, collectorRect, boxStatus]) => {
|
|
2117
|
+
const absoluteWidth = size.width * containerRect.width;
|
|
2118
|
+
const absoluteHeight = size.height * containerRect.height;
|
|
2119
|
+
return {
|
|
2120
|
+
width: absoluteWidth + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
|
|
2121
|
+
height: absoluteHeight + ((minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? 1 : 0),
|
|
2122
|
+
x: coord.x * containerRect.width,
|
|
2123
|
+
y: coord.y * containerRect.height,
|
|
2124
|
+
scaleX: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.width / absoluteWidth : 1,
|
|
2125
|
+
scaleY: (minimized || boxStatus === TELE_BOX_STATE.Minimized) && collectorRect ? collectorRect.height / absoluteHeight : 1
|
|
2126
|
+
};
|
|
2127
|
+
},
|
|
2128
|
+
shallowequal
|
|
2129
|
+
).subscribe((styles) => {
|
|
2064
2130
|
boxStyler.set(styles);
|
|
2065
2131
|
});
|
|
2066
2132
|
boxStyler.set({ x: translateX, y: translateY });
|
|
@@ -2155,44 +2221,94 @@ class TeleBox {
|
|
|
2155
2221
|
const offsetY = (pageY - trackStartPageY) / this.containerRect.height;
|
|
2156
2222
|
switch (trackingHandle) {
|
|
2157
2223
|
case TELE_BOX_RESIZE_HANDLE.North: {
|
|
2158
|
-
this.transform(
|
|
2224
|
+
this.transform(
|
|
2225
|
+
this.x,
|
|
2226
|
+
trackStartY + offsetY,
|
|
2227
|
+
this.width,
|
|
2228
|
+
trackStartHeight - offsetY
|
|
2229
|
+
);
|
|
2159
2230
|
break;
|
|
2160
2231
|
}
|
|
2161
2232
|
case TELE_BOX_RESIZE_HANDLE.South: {
|
|
2162
|
-
this.transform(
|
|
2233
|
+
this.transform(
|
|
2234
|
+
this.x,
|
|
2235
|
+
this.y,
|
|
2236
|
+
this.width,
|
|
2237
|
+
trackStartHeight + offsetY
|
|
2238
|
+
);
|
|
2163
2239
|
break;
|
|
2164
2240
|
}
|
|
2165
2241
|
case TELE_BOX_RESIZE_HANDLE.West: {
|
|
2166
|
-
this.transform(
|
|
2242
|
+
this.transform(
|
|
2243
|
+
trackStartX + offsetX,
|
|
2244
|
+
this.y,
|
|
2245
|
+
trackStartWidth - offsetX,
|
|
2246
|
+
this.height
|
|
2247
|
+
);
|
|
2167
2248
|
break;
|
|
2168
2249
|
}
|
|
2169
2250
|
case TELE_BOX_RESIZE_HANDLE.East: {
|
|
2170
|
-
this.transform(
|
|
2251
|
+
this.transform(
|
|
2252
|
+
this.x,
|
|
2253
|
+
this.y,
|
|
2254
|
+
trackStartWidth + offsetX,
|
|
2255
|
+
this.height
|
|
2256
|
+
);
|
|
2171
2257
|
break;
|
|
2172
2258
|
}
|
|
2173
2259
|
case TELE_BOX_RESIZE_HANDLE.NorthWest: {
|
|
2174
|
-
this.transform(
|
|
2260
|
+
this.transform(
|
|
2261
|
+
trackStartX + offsetX,
|
|
2262
|
+
trackStartY + offsetY,
|
|
2263
|
+
trackStartWidth - offsetX,
|
|
2264
|
+
trackStartHeight - offsetY
|
|
2265
|
+
);
|
|
2175
2266
|
break;
|
|
2176
2267
|
}
|
|
2177
2268
|
case TELE_BOX_RESIZE_HANDLE.NorthEast: {
|
|
2178
|
-
this.transform(
|
|
2269
|
+
this.transform(
|
|
2270
|
+
this.x,
|
|
2271
|
+
trackStartY + offsetY,
|
|
2272
|
+
trackStartWidth + offsetX,
|
|
2273
|
+
trackStartHeight - offsetY
|
|
2274
|
+
);
|
|
2179
2275
|
break;
|
|
2180
2276
|
}
|
|
2181
2277
|
case TELE_BOX_RESIZE_HANDLE.SouthEast: {
|
|
2182
|
-
this.transform(
|
|
2278
|
+
this.transform(
|
|
2279
|
+
this.x,
|
|
2280
|
+
this.y,
|
|
2281
|
+
trackStartWidth + offsetX,
|
|
2282
|
+
trackStartHeight + offsetY
|
|
2283
|
+
);
|
|
2183
2284
|
break;
|
|
2184
2285
|
}
|
|
2185
2286
|
case TELE_BOX_RESIZE_HANDLE.SouthWest: {
|
|
2186
|
-
this.transform(
|
|
2287
|
+
this.transform(
|
|
2288
|
+
trackStartX + offsetX,
|
|
2289
|
+
this.y,
|
|
2290
|
+
trackStartWidth - offsetX,
|
|
2291
|
+
trackStartHeight + offsetY
|
|
2292
|
+
);
|
|
2187
2293
|
break;
|
|
2188
2294
|
}
|
|
2189
2295
|
default: {
|
|
2190
2296
|
if (this.fence) {
|
|
2191
|
-
this.move(
|
|
2297
|
+
this.move(
|
|
2298
|
+
clamp(trackStartX + offsetX, 0, 1 - this.width),
|
|
2299
|
+
clamp(trackStartY + offsetY, 0, 1 - this.height)
|
|
2300
|
+
);
|
|
2192
2301
|
} else {
|
|
2193
2302
|
const xOverflowOffset = 20 / this.containerRect.width;
|
|
2194
2303
|
const yOverflowOffset = 20 / this.containerRect.height;
|
|
2195
|
-
this.move(
|
|
2304
|
+
this.move(
|
|
2305
|
+
clamp(
|
|
2306
|
+
trackStartX + offsetX,
|
|
2307
|
+
xOverflowOffset - this.width,
|
|
2308
|
+
1 - xOverflowOffset
|
|
2309
|
+
),
|
|
2310
|
+
clamp(trackStartY + offsetY, 0, 1 - yOverflowOffset)
|
|
2311
|
+
);
|
|
2196
2312
|
}
|
|
2197
2313
|
break;
|
|
2198
2314
|
}
|
|
@@ -2232,7 +2348,9 @@ class TeleBox {
|
|
|
2232
2348
|
$trackMask = document.createElement("div");
|
|
2233
2349
|
}
|
|
2234
2350
|
const cursor = trackingHandle ? this.wrapClassName(`cursor-${trackingHandle}`) : "";
|
|
2235
|
-
$trackMask.className = this.wrapClassName(
|
|
2351
|
+
$trackMask.className = this.wrapClassName(
|
|
2352
|
+
`track-mask${cursor ? ` ${cursor}` : ""}`
|
|
2353
|
+
);
|
|
2236
2354
|
this.$box.appendChild($trackMask);
|
|
2237
2355
|
this.$box.classList.add(transformingClassName);
|
|
2238
2356
|
this._sideEffect.add(() => {
|
|
@@ -2252,14 +2370,29 @@ class TeleBox {
|
|
|
2252
2370
|
window.removeEventListener("touchmove", handleTracking);
|
|
2253
2371
|
window.removeEventListener("mouseup", handleTrackEnd);
|
|
2254
2372
|
window.removeEventListener("touchend", handleTrackEnd);
|
|
2255
|
-
window.removeEventListener(
|
|
2373
|
+
window.removeEventListener(
|
|
2374
|
+
"touchcancel",
|
|
2375
|
+
handleTrackEnd
|
|
2376
|
+
);
|
|
2256
2377
|
};
|
|
2257
2378
|
}, TRACKING_DISPOSER_ID);
|
|
2258
2379
|
}
|
|
2259
2380
|
};
|
|
2260
2381
|
this._handleTrackStart = handleTrackStart;
|
|
2261
|
-
this._sideEffect.addEventListener(
|
|
2262
|
-
|
|
2382
|
+
this._sideEffect.addEventListener(
|
|
2383
|
+
$resizeHandles,
|
|
2384
|
+
"mousedown",
|
|
2385
|
+
handleTrackStart,
|
|
2386
|
+
{},
|
|
2387
|
+
"box-resizeHandles-mousedown"
|
|
2388
|
+
);
|
|
2389
|
+
this._sideEffect.addEventListener(
|
|
2390
|
+
$resizeHandles,
|
|
2391
|
+
"touchstart",
|
|
2392
|
+
handleTrackStart,
|
|
2393
|
+
{ passive: false },
|
|
2394
|
+
"box-resizeHandles-touchstart"
|
|
2395
|
+
);
|
|
2263
2396
|
}
|
|
2264
2397
|
destroy() {
|
|
2265
2398
|
this.$box.remove();
|
|
@@ -2276,7 +2409,7 @@ class TeleBox {
|
|
|
2276
2409
|
function noop() {
|
|
2277
2410
|
return;
|
|
2278
2411
|
}
|
|
2279
|
-
var style$
|
|
2412
|
+
var style$2 = "";
|
|
2280
2413
|
var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
|
|
2281
2414
|
class TeleBoxCollector {
|
|
2282
2415
|
constructor({
|
|
@@ -2285,8 +2418,10 @@ class TeleBoxCollector {
|
|
|
2285
2418
|
darkMode = false,
|
|
2286
2419
|
namespace = "telebox",
|
|
2287
2420
|
styles = {},
|
|
2288
|
-
onClick
|
|
2289
|
-
|
|
2421
|
+
onClick,
|
|
2422
|
+
getBoxesStatus
|
|
2423
|
+
}) {
|
|
2424
|
+
this.$appMenuContainer = document.createElement("div");
|
|
2290
2425
|
this.handleCollectorClick = () => {
|
|
2291
2426
|
if (!this._readonly && this.onClick) {
|
|
2292
2427
|
this.onClick();
|
|
@@ -2298,6 +2433,11 @@ class TeleBoxCollector {
|
|
|
2298
2433
|
this.namespace = namespace;
|
|
2299
2434
|
this.styles = styles;
|
|
2300
2435
|
this.onClick = onClick;
|
|
2436
|
+
this.getBoxesStatus = getBoxesStatus;
|
|
2437
|
+
}
|
|
2438
|
+
get boxesStatus() {
|
|
2439
|
+
var _a;
|
|
2440
|
+
return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
|
|
2301
2441
|
}
|
|
2302
2442
|
get visible() {
|
|
2303
2443
|
return this._visible;
|
|
@@ -2318,11 +2458,29 @@ class TeleBoxCollector {
|
|
|
2318
2458
|
}
|
|
2319
2459
|
return this;
|
|
2320
2460
|
}
|
|
2461
|
+
hasMinimizedBox() {
|
|
2462
|
+
const boxesStatus = this.boxesStatus;
|
|
2463
|
+
if (boxesStatus) {
|
|
2464
|
+
for (const status of boxesStatus.values()) {
|
|
2465
|
+
if (status === TELE_BOX_STATE.Minimized) {
|
|
2466
|
+
return true;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return false;
|
|
2471
|
+
}
|
|
2472
|
+
updateBoxesStatus() {
|
|
2473
|
+
const hasMinimizedBox = this.hasMinimizedBox();
|
|
2474
|
+
this.setVisible(hasMinimizedBox);
|
|
2475
|
+
}
|
|
2321
2476
|
setVisible(visible) {
|
|
2322
2477
|
if (this._visible !== visible) {
|
|
2323
2478
|
this._visible = visible;
|
|
2324
2479
|
if (this.$collector) {
|
|
2325
|
-
this.$collector.classList.toggle(
|
|
2480
|
+
this.$collector.classList.toggle(
|
|
2481
|
+
this.wrapClassName("collector-visible"),
|
|
2482
|
+
visible
|
|
2483
|
+
);
|
|
2326
2484
|
}
|
|
2327
2485
|
}
|
|
2328
2486
|
return this;
|
|
@@ -2331,7 +2489,10 @@ class TeleBoxCollector {
|
|
|
2331
2489
|
if (this._readonly !== readonly) {
|
|
2332
2490
|
this._readonly = readonly;
|
|
2333
2491
|
if (this.$collector) {
|
|
2334
|
-
this.$collector.classList.toggle(
|
|
2492
|
+
this.$collector.classList.toggle(
|
|
2493
|
+
this.wrapClassName("collector-readonly"),
|
|
2494
|
+
readonly
|
|
2495
|
+
);
|
|
2335
2496
|
}
|
|
2336
2497
|
}
|
|
2337
2498
|
return this;
|
|
@@ -2340,8 +2501,14 @@ class TeleBoxCollector {
|
|
|
2340
2501
|
if (this._darkMode !== darkMode) {
|
|
2341
2502
|
this._darkMode = darkMode;
|
|
2342
2503
|
if (this.$collector) {
|
|
2343
|
-
this.$collector.classList.toggle(
|
|
2344
|
-
|
|
2504
|
+
this.$collector.classList.toggle(
|
|
2505
|
+
this.wrapClassName("color-scheme-dark"),
|
|
2506
|
+
darkMode
|
|
2507
|
+
);
|
|
2508
|
+
this.$collector.classList.toggle(
|
|
2509
|
+
this.wrapClassName("color-scheme-light"),
|
|
2510
|
+
!darkMode
|
|
2511
|
+
);
|
|
2345
2512
|
}
|
|
2346
2513
|
}
|
|
2347
2514
|
return this;
|
|
@@ -2364,21 +2531,37 @@ class TeleBoxCollector {
|
|
|
2364
2531
|
this.$collector = document.createElement("button");
|
|
2365
2532
|
this.$collector.className = this.wrapClassName("collector");
|
|
2366
2533
|
this.$collector.style.backgroundImage = `url('${collectorSVG}')`;
|
|
2367
|
-
this.$collector.addEventListener(
|
|
2534
|
+
this.$collector.addEventListener(
|
|
2535
|
+
"click",
|
|
2536
|
+
this.handleCollectorClick
|
|
2537
|
+
);
|
|
2368
2538
|
if (this._visible) {
|
|
2369
|
-
this.$collector.classList.add(
|
|
2539
|
+
this.$collector.classList.add(
|
|
2540
|
+
this.wrapClassName("collector-visible")
|
|
2541
|
+
);
|
|
2370
2542
|
}
|
|
2371
2543
|
if (this._readonly) {
|
|
2372
|
-
this.$collector.classList.add(
|
|
2373
|
-
|
|
2374
|
-
|
|
2544
|
+
this.$collector.classList.add(
|
|
2545
|
+
this.wrapClassName("collector-readonly")
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2548
|
+
this.$collector.classList.add(
|
|
2549
|
+
this.wrapClassName(
|
|
2550
|
+
this._darkMode ? "color-scheme-dark" : "color-scheme-light"
|
|
2551
|
+
)
|
|
2552
|
+
);
|
|
2553
|
+
this.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow"));
|
|
2554
|
+
this.$collector.append(this.$appMenuContainer);
|
|
2375
2555
|
this.setStyles(this.styles);
|
|
2376
2556
|
}
|
|
2377
2557
|
return this.$collector;
|
|
2378
2558
|
}
|
|
2379
2559
|
destroy() {
|
|
2380
2560
|
if (this.$collector) {
|
|
2381
|
-
this.$collector.removeEventListener(
|
|
2561
|
+
this.$collector.removeEventListener(
|
|
2562
|
+
"click",
|
|
2563
|
+
this.handleCollectorClick
|
|
2564
|
+
);
|
|
2382
2565
|
this.$collector.remove();
|
|
2383
2566
|
this.$collector = void 0;
|
|
2384
2567
|
}
|
|
@@ -2388,8 +2571,7 @@ class TeleBoxCollector {
|
|
|
2388
2571
|
return `${this.namespace}-${className}`;
|
|
2389
2572
|
}
|
|
2390
2573
|
}
|
|
2391
|
-
var TELE_BOX_MANAGER_EVENT
|
|
2392
|
-
(function(TELE_BOX_MANAGER_EVENT2) {
|
|
2574
|
+
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
2393
2575
|
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
|
2394
2576
|
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
|
2395
2577
|
TELE_BOX_MANAGER_EVENT2["Created"] = "created";
|
|
@@ -2407,8 +2589,9 @@ var TELE_BOX_MANAGER_EVENT;
|
|
|
2407
2589
|
TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
|
|
2408
2590
|
TELE_BOX_MANAGER_EVENT2["BoxStatus"] = "box_status";
|
|
2409
2591
|
TELE_BOX_MANAGER_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
2410
|
-
|
|
2411
|
-
|
|
2592
|
+
return TELE_BOX_MANAGER_EVENT2;
|
|
2593
|
+
})(TELE_BOX_MANAGER_EVENT || {});
|
|
2594
|
+
var style$1 = "";
|
|
2412
2595
|
class MaxTitleBar extends DefaultTitleBar {
|
|
2413
2596
|
constructor(config) {
|
|
2414
2597
|
super(config);
|
|
@@ -2416,20 +2599,30 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2416
2599
|
this.focusedBox = config.focusedBox;
|
|
2417
2600
|
this.containerRect = config.containerRect;
|
|
2418
2601
|
this.darkMode = config.darkMode;
|
|
2419
|
-
this.
|
|
2602
|
+
this.getBoxesStatus = config.getBoxesStatus;
|
|
2603
|
+
}
|
|
2604
|
+
get boxesStatus() {
|
|
2605
|
+
var _a;
|
|
2606
|
+
return (_a = this.getBoxesStatus) == null ? void 0 : _a.call(this);
|
|
2420
2607
|
}
|
|
2421
2608
|
hasMaximizedBoxInStatus() {
|
|
2422
|
-
if (
|
|
2423
|
-
|
|
2609
|
+
if (this.getBoxesStatus) {
|
|
2610
|
+
const boxesStatus = this.getBoxesStatus();
|
|
2611
|
+
if (boxesStatus.size) {
|
|
2612
|
+
const hasMaximizedBox = [...boxesStatus.values()].find((state) => state === TELE_BOX_STATE.Maximized);
|
|
2613
|
+
return !!hasMaximizedBox;
|
|
2614
|
+
}
|
|
2424
2615
|
}
|
|
2425
|
-
|
|
2426
|
-
return !!hasMaximizedBox;
|
|
2616
|
+
return false;
|
|
2427
2617
|
}
|
|
2428
2618
|
get MaximizedBoxes() {
|
|
2429
|
-
if (
|
|
2430
|
-
|
|
2619
|
+
if (this.getBoxesStatus) {
|
|
2620
|
+
const boxesStatus = this.getBoxesStatus();
|
|
2621
|
+
if (boxesStatus) {
|
|
2622
|
+
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
|
|
2623
|
+
}
|
|
2431
2624
|
}
|
|
2432
|
-
return
|
|
2625
|
+
return [];
|
|
2433
2626
|
}
|
|
2434
2627
|
focusBox(box) {
|
|
2435
2628
|
var _a, _b;
|
|
@@ -2444,9 +2637,15 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2444
2637
|
const id = (_a = $tab.dataset) == null ? void 0 : _a.teleBoxID;
|
|
2445
2638
|
if (id) {
|
|
2446
2639
|
if (box && id === box.id) {
|
|
2447
|
-
$tab.classList.toggle(
|
|
2640
|
+
$tab.classList.toggle(
|
|
2641
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2642
|
+
true
|
|
2643
|
+
);
|
|
2448
2644
|
} else if (this.focusedBox && id === this.focusedBox.id) {
|
|
2449
|
-
$tab.classList.toggle(
|
|
2645
|
+
$tab.classList.toggle(
|
|
2646
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2647
|
+
false
|
|
2648
|
+
);
|
|
2450
2649
|
}
|
|
2451
2650
|
}
|
|
2452
2651
|
}
|
|
@@ -2456,9 +2655,15 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2456
2655
|
const id = (_b = $tab.dataset) == null ? void 0 : _b.teleBoxID;
|
|
2457
2656
|
if (id) {
|
|
2458
2657
|
if (box && id === box.id) {
|
|
2459
|
-
$tab.classList.toggle(
|
|
2658
|
+
$tab.classList.toggle(
|
|
2659
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2660
|
+
true
|
|
2661
|
+
);
|
|
2460
2662
|
} else if (this.focusedBox && id === this.focusedBox.id) {
|
|
2461
|
-
$tab.classList.toggle(
|
|
2663
|
+
$tab.classList.toggle(
|
|
2664
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2665
|
+
false
|
|
2666
|
+
);
|
|
2462
2667
|
}
|
|
2463
2668
|
}
|
|
2464
2669
|
}
|
|
@@ -2474,42 +2679,59 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2474
2679
|
this.$titleBar.style.width = width + "px";
|
|
2475
2680
|
}
|
|
2476
2681
|
}
|
|
2477
|
-
|
|
2478
|
-
this.boxesStatus = boxesStatus;
|
|
2682
|
+
updateBoxesStatus() {
|
|
2479
2683
|
if (this.hasMaximizedBoxInStatus()) {
|
|
2480
2684
|
this.setBoxStatus(TELE_BOX_STATE.Maximized);
|
|
2481
2685
|
}
|
|
2482
2686
|
if (this.$titleBar) {
|
|
2483
|
-
this.$titleBar.classList.toggle(
|
|
2687
|
+
this.$titleBar.classList.toggle(
|
|
2688
|
+
this.wrapClassName("max-titlebar-maximized"),
|
|
2689
|
+
this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
|
|
2690
|
+
);
|
|
2484
2691
|
}
|
|
2485
2692
|
this.updateTitles();
|
|
2486
2693
|
}
|
|
2487
2694
|
setBoxes(boxes) {
|
|
2488
2695
|
this.boxes = boxes;
|
|
2489
2696
|
if (this.$titleBar) {
|
|
2490
|
-
this.$titleBar.classList.toggle(
|
|
2697
|
+
this.$titleBar.classList.toggle(
|
|
2698
|
+
this.wrapClassName("max-titlebar-maximized"),
|
|
2699
|
+
this.state === TELE_BOX_STATE.Maximized && boxes.length > 0 || this.hasMaximizedBoxInStatus()
|
|
2700
|
+
);
|
|
2491
2701
|
}
|
|
2492
2702
|
this.updateTitles();
|
|
2493
2703
|
}
|
|
2494
2704
|
setState(state) {
|
|
2495
2705
|
super.setState(state);
|
|
2496
2706
|
if (this.$titleBar) {
|
|
2497
|
-
this.$titleBar.classList.toggle(
|
|
2707
|
+
this.$titleBar.classList.toggle(
|
|
2708
|
+
this.wrapClassName("max-titlebar-maximized"),
|
|
2709
|
+
state === TELE_BOX_STATE.Maximized && this.boxes.length > 0 || this.hasMaximizedBoxInStatus()
|
|
2710
|
+
);
|
|
2498
2711
|
}
|
|
2499
2712
|
this.updateTitles();
|
|
2500
2713
|
}
|
|
2501
2714
|
setReadonly(readonly) {
|
|
2502
2715
|
super.setReadonly(readonly);
|
|
2503
2716
|
if (this.$titleBar) {
|
|
2504
|
-
this.$titleBar.classList.toggle(
|
|
2717
|
+
this.$titleBar.classList.toggle(
|
|
2718
|
+
this.wrapClassName("readonly"),
|
|
2719
|
+
this.readonly
|
|
2720
|
+
);
|
|
2505
2721
|
}
|
|
2506
2722
|
}
|
|
2507
2723
|
setDarkMode(darkMode) {
|
|
2508
2724
|
if (darkMode !== this.darkMode) {
|
|
2509
2725
|
this.darkMode = darkMode;
|
|
2510
2726
|
if (this.$titleBar) {
|
|
2511
|
-
this.$titleBar.classList.toggle(
|
|
2512
|
-
|
|
2727
|
+
this.$titleBar.classList.toggle(
|
|
2728
|
+
this.wrapClassName("color-scheme-dark"),
|
|
2729
|
+
darkMode
|
|
2730
|
+
);
|
|
2731
|
+
this.$titleBar.classList.toggle(
|
|
2732
|
+
this.wrapClassName("color-scheme-light"),
|
|
2733
|
+
!darkMode
|
|
2734
|
+
);
|
|
2513
2735
|
}
|
|
2514
2736
|
}
|
|
2515
2737
|
}
|
|
@@ -2519,9 +2741,19 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2519
2741
|
$titleBar.style.transform = `translate(${x}px, ${y}px)`;
|
|
2520
2742
|
$titleBar.style.width = width + "px";
|
|
2521
2743
|
$titleBar.classList.add(this.wrapClassName("max-titlebar"));
|
|
2522
|
-
$titleBar.classList.toggle(
|
|
2523
|
-
|
|
2524
|
-
|
|
2744
|
+
$titleBar.classList.toggle(
|
|
2745
|
+
this.wrapClassName("max-titlebar-maximized"),
|
|
2746
|
+
this.state === TELE_BOX_STATE.Maximized && this.boxes.length > 0
|
|
2747
|
+
);
|
|
2748
|
+
$titleBar.classList.toggle(
|
|
2749
|
+
this.wrapClassName("readonly"),
|
|
2750
|
+
this.readonly
|
|
2751
|
+
);
|
|
2752
|
+
$titleBar.classList.add(
|
|
2753
|
+
this.wrapClassName(
|
|
2754
|
+
this.darkMode ? "color-scheme-dark" : "color-scheme-light"
|
|
2755
|
+
)
|
|
2756
|
+
);
|
|
2525
2757
|
const $titlesArea = document.createElement("div");
|
|
2526
2758
|
$titlesArea.classList.add(this.wrapClassName("titles-area"));
|
|
2527
2759
|
$titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
|
|
@@ -2536,23 +2768,33 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2536
2768
|
}
|
|
2537
2769
|
updateTitles() {
|
|
2538
2770
|
if (this.$titleBar && (this.state === TELE_BOX_STATE.Maximized || this.hasMaximizedBoxInStatus())) {
|
|
2539
|
-
this.$titleBar.classList.toggle(
|
|
2771
|
+
this.$titleBar.classList.toggle(
|
|
2772
|
+
this.wrapClassName("max-titlebar-single-title"),
|
|
2773
|
+
this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1
|
|
2774
|
+
);
|
|
2540
2775
|
if (this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1) {
|
|
2541
2776
|
this.setTitle(this.boxes[0].title);
|
|
2542
2777
|
} else {
|
|
2543
|
-
this.$titleBar.replaceChild(
|
|
2778
|
+
this.$titleBar.replaceChild(
|
|
2779
|
+
this.renderTitles(),
|
|
2780
|
+
this.$titleBar.firstElementChild
|
|
2781
|
+
);
|
|
2544
2782
|
}
|
|
2545
2783
|
}
|
|
2546
2784
|
}
|
|
2547
2785
|
renderTitles() {
|
|
2548
2786
|
this.$titles = document.createElement("div");
|
|
2549
2787
|
this.$titles.className = this.wrapClassName("titles");
|
|
2550
|
-
this.$titles.addEventListener(
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2788
|
+
this.$titles.addEventListener(
|
|
2789
|
+
"wheel",
|
|
2790
|
+
(ev) => {
|
|
2791
|
+
ev.currentTarget.scrollBy({
|
|
2792
|
+
left: ev.deltaY > 0 ? 250 : -250,
|
|
2793
|
+
behavior: "smooth"
|
|
2794
|
+
});
|
|
2795
|
+
},
|
|
2796
|
+
{ passive: false }
|
|
2797
|
+
);
|
|
2556
2798
|
const $content = document.createElement("div");
|
|
2557
2799
|
$content.className = this.wrapClassName("titles-content");
|
|
2558
2800
|
this.$titles.appendChild($content);
|
|
@@ -2570,6 +2812,126 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2570
2812
|
return this.$titles;
|
|
2571
2813
|
}
|
|
2572
2814
|
}
|
|
2815
|
+
var style = "";
|
|
2816
|
+
class AppMenu {
|
|
2817
|
+
constructor(props) {
|
|
2818
|
+
this.namespace = "telebox-app-menu";
|
|
2819
|
+
this.badge = document.createElement("div");
|
|
2820
|
+
this.menuView = document.createElement("div");
|
|
2821
|
+
this.containerClickHandler = () => {
|
|
2822
|
+
if (this.manager.readonly) {
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
const isShowMenuView = getComputedStyle(this.menuView).display === "flex";
|
|
2826
|
+
if (isShowMenuView) {
|
|
2827
|
+
this.menuView.style.display = "none";
|
|
2828
|
+
} else {
|
|
2829
|
+
this.menuView.style.display = "flex";
|
|
2830
|
+
}
|
|
2831
|
+
};
|
|
2832
|
+
this.menuViewClickHandler = (e2) => {
|
|
2833
|
+
e2.stopPropagation();
|
|
2834
|
+
e2.stopImmediatePropagation();
|
|
2835
|
+
const target = e2.target;
|
|
2836
|
+
const id = target.getAttribute(`data-${this.c("app-id")}`);
|
|
2837
|
+
if (id) {
|
|
2838
|
+
const lastNotMinimizedBoxStatus = this.manager.getLastNotMinimizedBoxStatus(id) || TELE_BOX_STATE.Normal;
|
|
2839
|
+
const zIndex = (lastNotMinimizedBoxStatus === TELE_BOX_STATE.Maximized ? this.manager.getMaxMaximizedBoxZIndex() : this.manager.getMaxNormalBoxZIndex()) + 1;
|
|
2840
|
+
this.manager.setBox(id, {
|
|
2841
|
+
status: lastNotMinimizedBoxStatus,
|
|
2842
|
+
zIndex
|
|
2843
|
+
}, false, () => {
|
|
2844
|
+
this.manager.focusBox(id);
|
|
2845
|
+
});
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
this.updatePrefersColorSchemeHandler = () => {
|
|
2850
|
+
this.container.classList.remove(this.theme);
|
|
2851
|
+
this.theme = this.manager.prefersColorScheme;
|
|
2852
|
+
this.container.classList.add(this.theme);
|
|
2853
|
+
};
|
|
2854
|
+
this.appMenuChange = () => {
|
|
2855
|
+
const minimizedBoxesStatus = this.manager.getMinimizedBoxesStatus();
|
|
2856
|
+
this.render(minimizedBoxesStatus);
|
|
2857
|
+
};
|
|
2858
|
+
this.container = props.container;
|
|
2859
|
+
this.manager = props.manager;
|
|
2860
|
+
this.theme = props.theme;
|
|
2861
|
+
this.getBoxesStatus = props.getBoxesStatus;
|
|
2862
|
+
this.init();
|
|
2863
|
+
}
|
|
2864
|
+
get boxesStatus() {
|
|
2865
|
+
var _a;
|
|
2866
|
+
return ((_a = this.getBoxesStatus) == null ? void 0 : _a.call(this)) || /* @__PURE__ */ new Map();
|
|
2867
|
+
}
|
|
2868
|
+
get minimizedBoxesStatus() {
|
|
2869
|
+
const arr = [];
|
|
2870
|
+
this.boxesStatus.forEach((status) => {
|
|
2871
|
+
if (status === TELE_BOX_STATE.Minimized) {
|
|
2872
|
+
arr.push(status);
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
return arr;
|
|
2876
|
+
}
|
|
2877
|
+
c(className) {
|
|
2878
|
+
return `${this.namespace}-${className}`;
|
|
2879
|
+
}
|
|
2880
|
+
setContainer(container) {
|
|
2881
|
+
if (this.container) {
|
|
2882
|
+
this.container.remove();
|
|
2883
|
+
}
|
|
2884
|
+
this.container = container;
|
|
2885
|
+
this.init();
|
|
2886
|
+
}
|
|
2887
|
+
createDefaultAppMenu() {
|
|
2888
|
+
this.badge.classList.add(this.c("app-menu-badge"));
|
|
2889
|
+
this.menuView.classList.add(this.c("app-menu-tooltip"));
|
|
2890
|
+
this.container.classList.add(this.c("app-menu-container"), this.theme);
|
|
2891
|
+
this.menuView.addEventListener("click", this.menuViewClickHandler);
|
|
2892
|
+
this.container.append(this.badge, this.menuView);
|
|
2893
|
+
}
|
|
2894
|
+
async init() {
|
|
2895
|
+
this.createDefaultAppMenu();
|
|
2896
|
+
this.appMenuChange();
|
|
2897
|
+
}
|
|
2898
|
+
createMinimizedItem(appId) {
|
|
2899
|
+
const appItem = document.createElement("div");
|
|
2900
|
+
appItem.classList.add(this.c("app-menu-item"));
|
|
2901
|
+
appItem.setAttribute(`data-${this.c("app-id")}`, appId);
|
|
2902
|
+
const titleDiv = document.createElement("div");
|
|
2903
|
+
titleDiv.classList.add(this.c("app-menu-item-title"));
|
|
2904
|
+
const app = this.manager.getBox(appId);
|
|
2905
|
+
titleDiv.innerText = (app == null ? void 0 : app.title) || appId;
|
|
2906
|
+
appItem.appendChild(titleDiv);
|
|
2907
|
+
return appItem;
|
|
2908
|
+
}
|
|
2909
|
+
renderMenuView(minimizedBoxesStatus) {
|
|
2910
|
+
const items = [];
|
|
2911
|
+
minimizedBoxesStatus.forEach((_, appId) => {
|
|
2912
|
+
items.push(this.createMinimizedItem(appId));
|
|
2913
|
+
});
|
|
2914
|
+
this.menuView.append(...items);
|
|
2915
|
+
}
|
|
2916
|
+
render(minimizedBoxesStatus) {
|
|
2917
|
+
this.menuView.style.display = "none";
|
|
2918
|
+
this.badge.innerText = "";
|
|
2919
|
+
this.menuView.innerHTML = "";
|
|
2920
|
+
if (minimizedBoxesStatus.size === 0) {
|
|
2921
|
+
this.container.style.display = "none";
|
|
2922
|
+
} else {
|
|
2923
|
+
this.badge.innerText = minimizedBoxesStatus.size.toString();
|
|
2924
|
+
this.renderMenuView(minimizedBoxesStatus);
|
|
2925
|
+
this.container.style.display = "block";
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
destroy() {
|
|
2929
|
+
this.badge.remove();
|
|
2930
|
+
this.menuView.removeEventListener("click", this.menuViewClickHandler);
|
|
2931
|
+
this.menuView.remove();
|
|
2932
|
+
this.container.remove();
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2573
2935
|
class TeleBoxManager {
|
|
2574
2936
|
constructor({
|
|
2575
2937
|
root = document.body,
|
|
@@ -2585,28 +2947,35 @@ class TeleBoxManager {
|
|
|
2585
2947
|
},
|
|
2586
2948
|
collector,
|
|
2587
2949
|
namespace = "telebox",
|
|
2588
|
-
readonly = false
|
|
2950
|
+
readonly = false,
|
|
2951
|
+
useBoxesStatus = false
|
|
2589
2952
|
} = {}) {
|
|
2590
2953
|
this.events = new EventEmitter();
|
|
2591
2954
|
this._sideEffect = new o();
|
|
2955
|
+
this.useBoxesStatus = useBoxesStatus;
|
|
2592
2956
|
const { combine, createVal } = c(this._sideEffect);
|
|
2593
2957
|
this.root = root;
|
|
2594
2958
|
this.namespace = namespace;
|
|
2595
2959
|
this.boxes$ = createVal([]);
|
|
2596
2960
|
this.topBox$ = this.boxes$.derive((boxes) => {
|
|
2597
2961
|
if (boxes.length > 0) {
|
|
2962
|
+
let currentTopBox = void 0;
|
|
2598
2963
|
const topBox = boxes.reduce((topBox2, box) => {
|
|
2599
2964
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
2600
2965
|
return topBox2;
|
|
2601
2966
|
}
|
|
2967
|
+
if (!topBox2) {
|
|
2968
|
+
topBox2 = box;
|
|
2969
|
+
return topBox2;
|
|
2970
|
+
}
|
|
2602
2971
|
return topBox2.zIndex > box.zIndex ? topBox2 : box;
|
|
2603
|
-
});
|
|
2972
|
+
}, currentTopBox);
|
|
2604
2973
|
return topBox;
|
|
2605
2974
|
}
|
|
2606
2975
|
return;
|
|
2607
2976
|
});
|
|
2608
|
-
this.boxesStatus$ = new Map();
|
|
2609
|
-
this.lastNotMinimizedBoxesStatus$ = new Map();
|
|
2977
|
+
this.boxesStatus$ = /* @__PURE__ */ new Map();
|
|
2978
|
+
this.lastNotMinimizedBoxesStatus$ = /* @__PURE__ */ new Map();
|
|
2610
2979
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2611
2980
|
const prefersDark$ = createVal(false);
|
|
2612
2981
|
if (prefersDark) {
|
|
@@ -2621,12 +2990,20 @@ class TeleBoxManager {
|
|
|
2621
2990
|
}
|
|
2622
2991
|
const prefersColorScheme$ = createVal(prefersColorScheme);
|
|
2623
2992
|
prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
|
|
2624
|
-
this.boxes.forEach(
|
|
2993
|
+
this.boxes.forEach(
|
|
2994
|
+
(box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate)
|
|
2995
|
+
);
|
|
2625
2996
|
if (!skipUpdate) {
|
|
2626
|
-
this.events.emit(
|
|
2997
|
+
this.events.emit(
|
|
2998
|
+
TELE_BOX_MANAGER_EVENT.PrefersColorScheme,
|
|
2999
|
+
prefersColorScheme2
|
|
3000
|
+
);
|
|
2627
3001
|
}
|
|
2628
3002
|
});
|
|
2629
|
-
this._darkMode$ = combine(
|
|
3003
|
+
this._darkMode$ = combine(
|
|
3004
|
+
[prefersDark$, prefersColorScheme$],
|
|
3005
|
+
([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark"
|
|
3006
|
+
);
|
|
2630
3007
|
this._darkMode$.reaction((darkMode, _, skipUpdate) => {
|
|
2631
3008
|
this.boxes.forEach((box) => box.setDarkMode(darkMode, skipUpdate));
|
|
2632
3009
|
if (!skipUpdate) {
|
|
@@ -2640,12 +3017,17 @@ class TeleBoxManager {
|
|
|
2640
3017
|
const minimized$ = createVal(minimized);
|
|
2641
3018
|
const maximized$ = createVal(maximized);
|
|
2642
3019
|
maximized$.reaction((maximized2, _, skipUpdate) => {
|
|
2643
|
-
this.boxes.forEach(
|
|
3020
|
+
this.boxes.forEach(
|
|
3021
|
+
(box) => box.setMaximized(maximized2, skipUpdate)
|
|
3022
|
+
);
|
|
2644
3023
|
if (!skipUpdate) {
|
|
2645
3024
|
this.events.emit(TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
|
|
2646
3025
|
}
|
|
2647
3026
|
});
|
|
2648
|
-
const state$ = combine(
|
|
3027
|
+
const state$ = combine(
|
|
3028
|
+
[minimized$, maximized$],
|
|
3029
|
+
([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal
|
|
3030
|
+
);
|
|
2649
3031
|
state$.reaction((state, _, skipUpdate) => {
|
|
2650
3032
|
this.maxTitleBar.setState(state);
|
|
2651
3033
|
if (!skipUpdate) {
|
|
@@ -2658,43 +3040,49 @@ class TeleBoxManager {
|
|
|
2658
3040
|
});
|
|
2659
3041
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
2660
3042
|
containerRect$.reaction((containerRect2, _, skipUpdate) => {
|
|
2661
|
-
this.boxes.forEach(
|
|
3043
|
+
this.boxes.forEach(
|
|
3044
|
+
(box) => box.setContainerRect(containerRect2, skipUpdate)
|
|
3045
|
+
);
|
|
2662
3046
|
this.maxTitleBar.setContainerRect(containerRect2);
|
|
2663
3047
|
});
|
|
2664
|
-
const collector$ = createVal(
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
3048
|
+
const collector$ = createVal(
|
|
3049
|
+
collector === null ? null : collector || new TeleBoxCollector({
|
|
3050
|
+
visible: minimized,
|
|
3051
|
+
readonly,
|
|
3052
|
+
namespace
|
|
3053
|
+
}).mount(root)
|
|
3054
|
+
);
|
|
2669
3055
|
collector$.subscribe((collector2) => {
|
|
2670
3056
|
if (collector2) {
|
|
2671
3057
|
collector2.setVisible(minimized$.value);
|
|
2672
3058
|
collector2.setReadonly(readonly$.value);
|
|
2673
3059
|
collector2.setDarkMode(this._darkMode$.value);
|
|
3060
|
+
if (this.useBoxesStatus && this.appMenu) {
|
|
3061
|
+
this.appMenu.setContainer(collector2.$appMenuContainer);
|
|
3062
|
+
}
|
|
2674
3063
|
this._sideEffect.add(() => {
|
|
3064
|
+
collector2.getBoxesStatus = () => {
|
|
3065
|
+
return this.boxesStatus$;
|
|
3066
|
+
};
|
|
2675
3067
|
collector2.onClick = () => {
|
|
2676
3068
|
if (!readonly$.value) {
|
|
2677
|
-
if (this.
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
this.setBoxStatus(box.id, lastNotMinimizedBoxStatus);
|
|
2682
|
-
} else {
|
|
2683
|
-
this.setBoxStatus(box.id, TELE_BOX_STATE.Normal);
|
|
2684
|
-
}
|
|
2685
|
-
});
|
|
3069
|
+
if (!this.useBoxesStatus) {
|
|
3070
|
+
minimized$.setValue(false);
|
|
3071
|
+
} else if (this.useBoxesStatus && this.appMenu) {
|
|
3072
|
+
this.appMenu.containerClickHandler();
|
|
2686
3073
|
}
|
|
2687
|
-
minimized$.setValue(false);
|
|
2688
3074
|
}
|
|
2689
3075
|
};
|
|
2690
3076
|
return () => collector2.destroy();
|
|
2691
3077
|
}, "collect-onClick");
|
|
2692
3078
|
}
|
|
2693
3079
|
});
|
|
2694
|
-
readonly$.subscribe(
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
3080
|
+
readonly$.subscribe(
|
|
3081
|
+
(readonly2) => {
|
|
3082
|
+
var _a;
|
|
3083
|
+
return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
|
|
3084
|
+
}
|
|
3085
|
+
);
|
|
2698
3086
|
this._darkMode$.subscribe((darkMode) => {
|
|
2699
3087
|
var _a;
|
|
2700
3088
|
(_a = collector$.value) == null ? void 0 : _a.setDarkMode(darkMode);
|
|
@@ -2713,21 +3101,29 @@ class TeleBoxManager {
|
|
|
2713
3101
|
}
|
|
2714
3102
|
return;
|
|
2715
3103
|
};
|
|
2716
|
-
|
|
3104
|
+
this._setCollectorRect = (collectorRect) => {
|
|
3105
|
+
var _a;
|
|
3106
|
+
if ((_a = collector$.value) == null ? void 0 : _a.$collector) {
|
|
3107
|
+
collectorRect$.setValue(collectorRect);
|
|
3108
|
+
}
|
|
3109
|
+
};
|
|
3110
|
+
const collectorRect$ = createVal(
|
|
3111
|
+
minimized$.value ? this._calcCollectorRect() : void 0
|
|
3112
|
+
);
|
|
2717
3113
|
collectorRect$.subscribe((collectorRect, _, skipUpdate) => {
|
|
2718
3114
|
this.boxes.forEach((box) => {
|
|
2719
3115
|
box.setCollectorRect(collectorRect, skipUpdate);
|
|
2720
3116
|
});
|
|
2721
3117
|
});
|
|
2722
3118
|
minimized$.subscribe((minimized2, _, skipUpdate) => {
|
|
2723
|
-
var _a
|
|
3119
|
+
var _a;
|
|
2724
3120
|
(_a = collector$.value) == null ? void 0 : _a.setVisible(minimized2);
|
|
2725
3121
|
if (minimized2) {
|
|
2726
|
-
|
|
2727
|
-
collectorRect$.setValue(this._calcCollectorRect());
|
|
2728
|
-
}
|
|
3122
|
+
this._setCollectorRect(this._calcCollectorRect());
|
|
2729
3123
|
}
|
|
2730
|
-
this.boxes.forEach(
|
|
3124
|
+
this.boxes.forEach(
|
|
3125
|
+
(box) => box.setMinimized(minimized2, skipUpdate)
|
|
3126
|
+
);
|
|
2731
3127
|
if (!skipUpdate) {
|
|
2732
3128
|
this.events.emit(TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
|
|
2733
3129
|
}
|
|
@@ -2750,17 +3146,44 @@ class TeleBoxManager {
|
|
|
2750
3146
|
if (id) {
|
|
2751
3147
|
const box = this.getBox(id);
|
|
2752
3148
|
if (box) {
|
|
2753
|
-
this.
|
|
2754
|
-
if (box.boxStatus && box.boxStatus !== TELE_BOX_STATE.Maximized || !box.boxStatus) {
|
|
3149
|
+
if (!this.useBoxesStatus) {
|
|
2755
3150
|
this.makeBoxTop(box);
|
|
3151
|
+
} else {
|
|
3152
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3153
|
+
const maxNormalBoxZIndex = this.getMaxNormalBoxZIndex();
|
|
3154
|
+
if (maxNormalBoxZIndex > box.zIndex) {
|
|
3155
|
+
this.setBox(box, {
|
|
3156
|
+
zIndex: maxNormalBoxZIndex + 1
|
|
3157
|
+
}, false);
|
|
3158
|
+
}
|
|
3159
|
+
} else if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3160
|
+
const maxMaximizedBoxZIndex = this.getMaxMaximizedBoxZIndex();
|
|
3161
|
+
if (maxMaximizedBoxZIndex > box.zIndex) {
|
|
3162
|
+
this.setBox(box, {
|
|
3163
|
+
zIndex: maxMaximizedBoxZIndex + 1
|
|
3164
|
+
}, false);
|
|
3165
|
+
}
|
|
3166
|
+
this.makeMaximizedTopBoxFocus();
|
|
3167
|
+
}
|
|
2756
3168
|
}
|
|
3169
|
+
this.focusBox(box);
|
|
2757
3170
|
return;
|
|
2758
3171
|
}
|
|
2759
3172
|
}
|
|
2760
3173
|
}
|
|
2761
3174
|
};
|
|
2762
|
-
this._sideEffect.addEventListener(
|
|
2763
|
-
|
|
3175
|
+
this._sideEffect.addEventListener(
|
|
3176
|
+
window,
|
|
3177
|
+
"mousedown",
|
|
3178
|
+
checkFocusBox,
|
|
3179
|
+
true
|
|
3180
|
+
);
|
|
3181
|
+
this._sideEffect.addEventListener(
|
|
3182
|
+
window,
|
|
3183
|
+
"touchstart",
|
|
3184
|
+
checkFocusBox,
|
|
3185
|
+
true
|
|
3186
|
+
);
|
|
2764
3187
|
this.maxTitleBar = new MaxTitleBar({
|
|
2765
3188
|
darkMode: this.darkMode,
|
|
2766
3189
|
readonly: readonly$.value,
|
|
@@ -2768,32 +3191,85 @@ class TeleBoxManager {
|
|
|
2768
3191
|
state: state$.value,
|
|
2769
3192
|
boxes: this.boxes$.value,
|
|
2770
3193
|
containerRect: containerRect$.value,
|
|
2771
|
-
|
|
3194
|
+
getBoxesStatus: () => {
|
|
3195
|
+
return this.boxesStatus$;
|
|
3196
|
+
},
|
|
2772
3197
|
onEvent: (event) => {
|
|
2773
|
-
var _a, _b, _c;
|
|
2774
3198
|
switch (event.type) {
|
|
2775
3199
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
2776
|
-
if (this.hasBoxesStatus()
|
|
2777
|
-
this.
|
|
2778
|
-
|
|
3200
|
+
if (this.hasBoxesStatus()) {
|
|
3201
|
+
let targetBox = this.maxTitleBar.focusedBox;
|
|
3202
|
+
if (!targetBox) {
|
|
3203
|
+
targetBox = this.getMaximizedTopBox();
|
|
3204
|
+
}
|
|
3205
|
+
if (targetBox == null ? void 0 : targetBox.id) {
|
|
3206
|
+
const box = this.getBox(targetBox.id);
|
|
3207
|
+
if (box) {
|
|
3208
|
+
this.setBox(box, {
|
|
3209
|
+
status: TELE_BOX_STATE.Normal,
|
|
3210
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3211
|
+
}, false, () => {
|
|
3212
|
+
this.makeMaximizedTopBoxFocus();
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
2779
3216
|
} else {
|
|
2780
3217
|
maximized$.setValue(!maximized$.value);
|
|
2781
3218
|
}
|
|
2782
3219
|
break;
|
|
2783
3220
|
}
|
|
2784
3221
|
case TELE_BOX_DELEGATE_EVENT.Minimize: {
|
|
2785
|
-
if (this.hasBoxesStatus()
|
|
2786
|
-
this.
|
|
2787
|
-
|
|
3222
|
+
if (this.hasBoxesStatus()) {
|
|
3223
|
+
let targetBox = this.maxTitleBar.focusedBox;
|
|
3224
|
+
if (!targetBox) {
|
|
3225
|
+
targetBox = this.getMaximizedTopBox();
|
|
3226
|
+
}
|
|
3227
|
+
if (targetBox == null ? void 0 : targetBox.id) {
|
|
3228
|
+
const box = this.getBox(targetBox.id);
|
|
3229
|
+
if (box) {
|
|
3230
|
+
let isFocusChanged = false;
|
|
3231
|
+
if (box.focus) {
|
|
3232
|
+
this.blurBox(box);
|
|
3233
|
+
isFocusChanged = true;
|
|
3234
|
+
}
|
|
3235
|
+
this.setBox(box, {
|
|
3236
|
+
status: TELE_BOX_STATE.Minimized,
|
|
3237
|
+
zIndex: -1
|
|
3238
|
+
}, false);
|
|
3239
|
+
if (isFocusChanged) {
|
|
3240
|
+
this.focusTopBox();
|
|
3241
|
+
} else {
|
|
3242
|
+
this.makeMaximizedTopBoxFocus();
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
2788
3246
|
} else {
|
|
2789
3247
|
minimized$.setValue(true);
|
|
2790
3248
|
}
|
|
2791
3249
|
break;
|
|
2792
3250
|
}
|
|
2793
3251
|
case TELE_BOX_EVENT.Close: {
|
|
2794
|
-
if (this.hasBoxesStatus()
|
|
2795
|
-
this.
|
|
2796
|
-
|
|
3252
|
+
if (this.hasBoxesStatus()) {
|
|
3253
|
+
let targetBox = this.maxTitleBar.focusedBox;
|
|
3254
|
+
if (!targetBox) {
|
|
3255
|
+
targetBox = this.getMaximizedTopBox();
|
|
3256
|
+
}
|
|
3257
|
+
if (targetBox == null ? void 0 : targetBox.id) {
|
|
3258
|
+
const box = this.getBox(targetBox.id);
|
|
3259
|
+
if (box) {
|
|
3260
|
+
let isFocusChanged = false;
|
|
3261
|
+
if (box.focus) {
|
|
3262
|
+
this.blurBox(box);
|
|
3263
|
+
isFocusChanged = true;
|
|
3264
|
+
}
|
|
3265
|
+
this.remove(box, false);
|
|
3266
|
+
if (isFocusChanged) {
|
|
3267
|
+
this.focusTopBox();
|
|
3268
|
+
} else {
|
|
3269
|
+
this.makeMaximizedTopBoxFocus();
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
2797
3273
|
} else {
|
|
2798
3274
|
this.removeTopBox();
|
|
2799
3275
|
this.focusTopBox();
|
|
@@ -2803,7 +3279,9 @@ class TeleBoxManager {
|
|
|
2803
3279
|
}
|
|
2804
3280
|
}
|
|
2805
3281
|
});
|
|
2806
|
-
readonly$.subscribe(
|
|
3282
|
+
readonly$.subscribe(
|
|
3283
|
+
(readonly2) => this.maxTitleBar.setReadonly(readonly2)
|
|
3284
|
+
);
|
|
2807
3285
|
this._darkMode$.subscribe((darkMode) => {
|
|
2808
3286
|
this.maxTitleBar.setDarkMode(darkMode);
|
|
2809
3287
|
});
|
|
@@ -2823,6 +3301,9 @@ class TeleBoxManager {
|
|
|
2823
3301
|
i(this, valConfig);
|
|
2824
3302
|
this._state$ = state$;
|
|
2825
3303
|
this.root.appendChild(this.maxTitleBar.render());
|
|
3304
|
+
if (useBoxesStatus) {
|
|
3305
|
+
this.appMenu = this.createMinimizedAppMenu();
|
|
3306
|
+
}
|
|
2826
3307
|
}
|
|
2827
3308
|
get boxes() {
|
|
2828
3309
|
return this.boxes$.value;
|
|
@@ -2857,92 +3338,270 @@ class TeleBoxManager {
|
|
|
2857
3338
|
return this;
|
|
2858
3339
|
}
|
|
2859
3340
|
setBoxStatus(boxId, boxStatus, skipUpdate = false) {
|
|
2860
|
-
const boxesStatus = this.boxesStatus$;
|
|
2861
3341
|
if (boxStatus) {
|
|
2862
|
-
const oldBoxStatus = boxesStatus
|
|
2863
|
-
boxesStatus
|
|
3342
|
+
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
3343
|
+
this.boxesStatus$.set(boxId, boxStatus);
|
|
2864
3344
|
if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
|
|
2865
3345
|
this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
|
|
2866
3346
|
} else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
2867
3347
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2868
3348
|
}
|
|
2869
3349
|
} else {
|
|
2870
|
-
boxesStatus
|
|
3350
|
+
this.boxesStatus$.delete(boxId);
|
|
2871
3351
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2872
3352
|
}
|
|
2873
|
-
this.setBoxesStatus(boxesStatus, skipUpdate);
|
|
2874
3353
|
if (!skipUpdate) {
|
|
2875
3354
|
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
|
|
2876
3355
|
}
|
|
2877
3356
|
}
|
|
3357
|
+
getBoxStatus(boxId) {
|
|
3358
|
+
return this.boxesStatus$.get(boxId);
|
|
3359
|
+
}
|
|
3360
|
+
get boxesStatus() {
|
|
3361
|
+
return this.boxesStatus$;
|
|
3362
|
+
}
|
|
3363
|
+
get lastNotMinimizedBoxesStatus() {
|
|
3364
|
+
return this.lastNotMinimizedBoxesStatus$;
|
|
3365
|
+
}
|
|
2878
3366
|
setBoxesStatus(boxesStatus, skipUpdate = false) {
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3367
|
+
this.boxesStatus$ = boxesStatus;
|
|
3368
|
+
this.effectBoxesStatusChange(skipUpdate);
|
|
3369
|
+
}
|
|
3370
|
+
getBoxesStatus() {
|
|
3371
|
+
return this.boxesStatus$;
|
|
3372
|
+
}
|
|
3373
|
+
effectBoxStatusChange() {
|
|
3374
|
+
if (!this.useBoxesStatus) {
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
if (this.collector) {
|
|
3378
|
+
this.collector.updateBoxesStatus();
|
|
3379
|
+
if (this.hasMinimizedBox()) {
|
|
3380
|
+
this._setCollectorRect(this._calcCollectorRect());
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
if (this.appMenu) {
|
|
3384
|
+
this.appMenu.appMenuChange();
|
|
3385
|
+
}
|
|
3386
|
+
if (this.maxTitleBar) {
|
|
3387
|
+
this.maxTitleBar.updateBoxesStatus();
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
effectBoxesStatusTimerFunc(skipUpdate) {
|
|
3391
|
+
if (!this.useBoxesStatus) {
|
|
3392
|
+
return;
|
|
3393
|
+
}
|
|
3394
|
+
let newTopBox;
|
|
3395
|
+
const curTopBox = this.topBox;
|
|
2883
3396
|
this.boxes.forEach((box) => {
|
|
2884
|
-
var
|
|
2885
|
-
const boxStatus = boxesStatus
|
|
3397
|
+
var _a;
|
|
3398
|
+
const boxStatus = this.boxesStatus$.get(box.id);
|
|
2886
3399
|
if (boxStatus) {
|
|
2887
|
-
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((
|
|
2888
|
-
|
|
3400
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3401
|
+
newTopBox = box;
|
|
2889
3402
|
}
|
|
2890
3403
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
2891
|
-
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
2892
|
-
hasMinimizedBox = true;
|
|
2893
|
-
}
|
|
2894
3404
|
}
|
|
2895
3405
|
});
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
3406
|
+
this.effectBoxStatusChange();
|
|
3407
|
+
if (newTopBox && curTopBox !== newTopBox) {
|
|
3408
|
+
this.topBox$.setValue(newTopBox);
|
|
3409
|
+
}
|
|
3410
|
+
if (!newTopBox && curTopBox) {
|
|
3411
|
+
this.topBox$.setValue(void 0);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
async effectBoxesStatusChange(skipUpdate = false) {
|
|
3415
|
+
var _a, _b;
|
|
3416
|
+
if (!this.useBoxesStatus) {
|
|
3417
|
+
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
3418
|
+
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3419
|
+
if (this.effectBoxesStatusTimer.resolve) {
|
|
3420
|
+
this.effectBoxesStatusTimer.resolve(!!((_a = this.effectBoxesStatusTimer) == null ? void 0 : _a.skipUpdate));
|
|
3421
|
+
}
|
|
2900
3422
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
3423
|
+
this.effectBoxesStatusTimer = void 0;
|
|
3424
|
+
return;
|
|
2903
3425
|
}
|
|
2904
|
-
if (
|
|
2905
|
-
this.
|
|
2906
|
-
|
|
2907
|
-
|
|
3426
|
+
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
3427
|
+
if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
|
|
3428
|
+
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3429
|
+
if (this.effectBoxesStatusTimer.resolve) {
|
|
3430
|
+
this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3431
|
+
}
|
|
3432
|
+
this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
|
|
3433
|
+
} else {
|
|
3434
|
+
return;
|
|
3435
|
+
}
|
|
2908
3436
|
}
|
|
2909
|
-
if (this.
|
|
2910
|
-
this.
|
|
3437
|
+
if (!this.effectBoxesStatusTimer) {
|
|
3438
|
+
this.effectBoxesStatusTimer = {
|
|
3439
|
+
skipUpdate,
|
|
3440
|
+
timer: void 0,
|
|
3441
|
+
resolve: void 0
|
|
3442
|
+
};
|
|
3443
|
+
}
|
|
3444
|
+
if (this.effectBoxesStatusTimer) {
|
|
3445
|
+
const _skipUpdate = await new Promise((resolve) => {
|
|
3446
|
+
this.effectBoxesStatusTimer.resolve = resolve;
|
|
3447
|
+
this.effectBoxesStatusTimer.timer = setTimeout(() => {
|
|
3448
|
+
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
|
|
3449
|
+
this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
|
|
3450
|
+
}
|
|
3451
|
+
}, 100);
|
|
3452
|
+
});
|
|
3453
|
+
this.effectBoxesStatusTimerFunc(_skipUpdate);
|
|
3454
|
+
this.effectBoxesStatusTimer = void 0;
|
|
2911
3455
|
}
|
|
2912
3456
|
}
|
|
2913
3457
|
hasBoxesStatus() {
|
|
3458
|
+
if (!this.useBoxesStatus) {
|
|
3459
|
+
return false;
|
|
3460
|
+
}
|
|
2914
3461
|
return this.boxesStatus$.size > 0;
|
|
2915
3462
|
}
|
|
2916
3463
|
hasMinimizedBox() {
|
|
3464
|
+
if (!this.useBoxesStatus) {
|
|
3465
|
+
return false;
|
|
3466
|
+
}
|
|
2917
3467
|
return this.boxes.some((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
|
|
2918
3468
|
}
|
|
3469
|
+
getMinimizedBoxesStatus() {
|
|
3470
|
+
const minimizedBoxes = /* @__PURE__ */ new Map();
|
|
3471
|
+
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3472
|
+
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3473
|
+
minimizedBoxes.set(boxId, boxStatus);
|
|
3474
|
+
}
|
|
3475
|
+
});
|
|
3476
|
+
return minimizedBoxes;
|
|
3477
|
+
}
|
|
3478
|
+
getNotMinimizedBoxesStatus() {
|
|
3479
|
+
const notMinimizedBoxes = /* @__PURE__ */ new Map();
|
|
3480
|
+
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3481
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
3482
|
+
notMinimizedBoxes.set(boxId, boxStatus);
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
return notMinimizedBoxes;
|
|
3486
|
+
}
|
|
3487
|
+
getAllMaximizedBoxesStatus() {
|
|
3488
|
+
const maximizedBoxes = /* @__PURE__ */ new Map();
|
|
3489
|
+
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3490
|
+
if (boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3491
|
+
maximizedBoxes.set(boxId, boxStatus);
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
return maximizedBoxes;
|
|
3495
|
+
}
|
|
3496
|
+
getAllNormalBoxesStatus() {
|
|
3497
|
+
const normalBoxes = /* @__PURE__ */ new Map();
|
|
3498
|
+
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3499
|
+
if (boxStatus === TELE_BOX_STATE.Normal) {
|
|
3500
|
+
normalBoxes.set(boxId, boxStatus);
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3503
|
+
return normalBoxes;
|
|
3504
|
+
}
|
|
3505
|
+
getLastNotMinimizedBoxStatus(boxId) {
|
|
3506
|
+
return this.lastNotMinimizedBoxesStatus$.get(boxId);
|
|
3507
|
+
}
|
|
2919
3508
|
setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
|
|
2920
|
-
const boxesStatus = this.lastNotMinimizedBoxesStatus$;
|
|
2921
3509
|
if (lastNotMinimizedBoxStatus) {
|
|
2922
|
-
|
|
3510
|
+
this.lastNotMinimizedBoxesStatus$.set(boxId, lastNotMinimizedBoxStatus);
|
|
2923
3511
|
} else {
|
|
2924
|
-
|
|
3512
|
+
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
2925
3513
|
}
|
|
2926
|
-
this.setLastNotMinimizedBoxesStatus(boxesStatus, skipUpdate);
|
|
2927
3514
|
if (!skipUpdate) {
|
|
2928
3515
|
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus: lastNotMinimizedBoxStatus });
|
|
2929
3516
|
}
|
|
2930
3517
|
}
|
|
2931
3518
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus, skipUpdate = false) {
|
|
3519
|
+
this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
|
|
3520
|
+
this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
|
|
3521
|
+
}
|
|
3522
|
+
async effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
|
|
3523
|
+
var _a, _b;
|
|
3524
|
+
if (!this.useBoxesStatus) {
|
|
3525
|
+
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
|
|
3526
|
+
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3527
|
+
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3528
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_a = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _a.skipUpdate));
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
3532
|
+
return;
|
|
3533
|
+
}
|
|
3534
|
+
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
|
|
3535
|
+
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3536
|
+
if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
|
|
3537
|
+
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3538
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3539
|
+
}
|
|
3540
|
+
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
|
|
3541
|
+
} else {
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
if (!this.effectLastNotMinimizedBoxStatusTimer) {
|
|
3546
|
+
this.effectLastNotMinimizedBoxStatusTimer = {
|
|
3547
|
+
skipUpdate,
|
|
3548
|
+
timer: void 0,
|
|
3549
|
+
resolve: void 0
|
|
3550
|
+
};
|
|
3551
|
+
}
|
|
3552
|
+
if (this.effectLastNotMinimizedBoxStatusTimer) {
|
|
3553
|
+
const _skipUpdate = await new Promise((resolve) => {
|
|
3554
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
|
|
3555
|
+
this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
|
|
3556
|
+
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3557
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
|
|
3558
|
+
}
|
|
3559
|
+
}, 100);
|
|
3560
|
+
});
|
|
3561
|
+
this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
|
|
3562
|
+
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
|
|
3566
|
+
if (!this.useBoxesStatus) {
|
|
3567
|
+
return;
|
|
3568
|
+
}
|
|
2932
3569
|
this.boxes.forEach((box) => {
|
|
2933
|
-
const boxStatus = lastNotMinimizedBoxesStatus
|
|
3570
|
+
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
2934
3571
|
if (boxStatus) {
|
|
2935
3572
|
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
2936
3573
|
}
|
|
2937
3574
|
});
|
|
2938
3575
|
}
|
|
2939
|
-
|
|
2940
|
-
return this.
|
|
3576
|
+
getUnabledBoxesStatusZIndex() {
|
|
3577
|
+
return this.topBox ? this.topBox.zIndex : 99;
|
|
3578
|
+
}
|
|
3579
|
+
getMaxMaximizedBoxZIndex() {
|
|
3580
|
+
if (!this.useBoxesStatus) {
|
|
3581
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
3582
|
+
}
|
|
3583
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
3584
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3585
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
3586
|
+
}
|
|
3587
|
+
return maxZIndex;
|
|
3588
|
+
}, 99);
|
|
3589
|
+
}
|
|
3590
|
+
getMaxNormalBoxZIndex() {
|
|
3591
|
+
if (!this.useBoxesStatus) {
|
|
3592
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
3593
|
+
}
|
|
3594
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
3595
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3596
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
3597
|
+
}
|
|
3598
|
+
return maxZIndex;
|
|
3599
|
+
}, 299);
|
|
2941
3600
|
}
|
|
2942
3601
|
create(config = {}, smartPosition = true) {
|
|
2943
|
-
const box = new TeleBox(
|
|
2944
|
-
zIndex: this.
|
|
2945
|
-
|
|
3602
|
+
const box = new TeleBox({
|
|
3603
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
3604
|
+
...smartPosition ? this.smartPosition(config) : config,
|
|
2946
3605
|
darkMode: this.darkMode,
|
|
2947
3606
|
prefersColorScheme: this.prefersColorScheme,
|
|
2948
3607
|
maximized: this.maximized,
|
|
@@ -2952,49 +3611,62 @@ class TeleBoxManager {
|
|
|
2952
3611
|
containerRect: this.containerRect,
|
|
2953
3612
|
readonly: this.readonly,
|
|
2954
3613
|
collectorRect: this.collectorRect
|
|
2955
|
-
})
|
|
3614
|
+
});
|
|
2956
3615
|
box.mount(this.root);
|
|
3616
|
+
this.boxes$.setValue([...this.boxes, box]);
|
|
3617
|
+
if (box.boxStatus && this.useBoxesStatus) {
|
|
3618
|
+
this.setBox(box, {
|
|
3619
|
+
status: box.boxStatus,
|
|
3620
|
+
lastNotMinimizedBoxStatus: box._lastNotMinimizedBoxStatus$.value
|
|
3621
|
+
}, true);
|
|
3622
|
+
}
|
|
2957
3623
|
if (box.focus) {
|
|
2958
3624
|
this.focusBox(box);
|
|
2959
3625
|
if (smartPosition) {
|
|
2960
3626
|
this.makeBoxTop(box);
|
|
2961
3627
|
}
|
|
2962
3628
|
}
|
|
2963
|
-
this.boxes$.setValue([...this.boxes, box]);
|
|
2964
|
-
if (box.boxStatus) {
|
|
2965
|
-
this.setBoxStatus(box.id, box.boxStatus, true);
|
|
2966
|
-
}
|
|
2967
|
-
if (box._lastNotMinimizedBoxStatus$.value) {
|
|
2968
|
-
this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
|
|
2969
|
-
}
|
|
2970
3629
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
2971
|
-
if (box.boxStatus) {
|
|
3630
|
+
if (this.useBoxesStatus && box.boxStatus) {
|
|
2972
3631
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
2973
|
-
this.
|
|
3632
|
+
this.setBox(box.id, {
|
|
3633
|
+
status: TELE_BOX_STATE.Normal,
|
|
3634
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3635
|
+
}, false);
|
|
2974
3636
|
} else {
|
|
2975
|
-
this.boxes.forEach((box2) => {
|
|
3637
|
+
[...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
2976
3638
|
if (box2.boxStatus === TELE_BOX_STATE.Normal) {
|
|
2977
|
-
this.
|
|
3639
|
+
this.setBox(box2.id, {
|
|
3640
|
+
status: TELE_BOX_STATE.Maximized,
|
|
3641
|
+
zIndex: this.getMaxMaximizedBoxZIndex() + 1
|
|
3642
|
+
}, false);
|
|
2978
3643
|
}
|
|
2979
3644
|
});
|
|
3645
|
+
this.makeMaximizedTopBoxFocus();
|
|
2980
3646
|
}
|
|
2981
|
-
this.makeMaximizedTopBoxFocus();
|
|
2982
3647
|
} else {
|
|
2983
3648
|
this.setMaximized(!this.maximized);
|
|
2984
3649
|
}
|
|
2985
3650
|
});
|
|
2986
3651
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
2987
|
-
if (box.boxStatus) {
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
if (oldBoxStatus === TELE_BOX_STATE.Maximized) {
|
|
2991
|
-
this.makeMaximizedTopBoxFocus();
|
|
3652
|
+
if (box.boxStatus && this.useBoxesStatus) {
|
|
3653
|
+
if (box.focus) {
|
|
3654
|
+
this.blurBox(box);
|
|
2992
3655
|
}
|
|
3656
|
+
this.setBox(box, {
|
|
3657
|
+
status: TELE_BOX_STATE.Minimized,
|
|
3658
|
+
zIndex: -1
|
|
3659
|
+
}, false, () => {
|
|
3660
|
+
this.focusTopBox();
|
|
3661
|
+
});
|
|
2993
3662
|
} else {
|
|
2994
3663
|
this.setMinimized(true);
|
|
2995
3664
|
}
|
|
2996
3665
|
});
|
|
2997
3666
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
|
|
3667
|
+
if (this.useBoxesStatus && box.focus) {
|
|
3668
|
+
this.blurBox(box);
|
|
3669
|
+
}
|
|
2998
3670
|
this.remove(box);
|
|
2999
3671
|
this.focusTopBox();
|
|
3000
3672
|
});
|
|
@@ -3025,12 +3697,17 @@ class TeleBoxManager {
|
|
|
3025
3697
|
});
|
|
3026
3698
|
box._zIndex$.reaction((_, __, skipUpdate) => {
|
|
3027
3699
|
if (this.boxes.length > 0) {
|
|
3700
|
+
let currentTopBox = void 0;
|
|
3028
3701
|
const topBox = this.boxes.reduce((topBox2, box2) => {
|
|
3029
3702
|
if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3030
3703
|
return topBox2;
|
|
3031
3704
|
}
|
|
3705
|
+
if (!topBox2) {
|
|
3706
|
+
topBox2 = box2;
|
|
3707
|
+
return topBox2;
|
|
3708
|
+
}
|
|
3032
3709
|
return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
|
|
3033
|
-
});
|
|
3710
|
+
}, currentTopBox);
|
|
3034
3711
|
this.topBox$.setValue(topBox);
|
|
3035
3712
|
}
|
|
3036
3713
|
if (!skipUpdate) {
|
|
@@ -3057,18 +3734,39 @@ class TeleBoxManager {
|
|
|
3057
3734
|
this.updateBox(box, config, skipUpdate);
|
|
3058
3735
|
});
|
|
3059
3736
|
}
|
|
3060
|
-
|
|
3737
|
+
setBox(boxOrID, options, skipUpdate = false, effectFunc) {
|
|
3061
3738
|
const box = this.getBox(boxOrID);
|
|
3062
3739
|
if (box) {
|
|
3063
|
-
|
|
3064
|
-
|
|
3740
|
+
const { status, zIndex, lastNotMinimizedBoxStatus } = options;
|
|
3741
|
+
if (status) {
|
|
3742
|
+
this.setBoxStatus(box.id, status, skipUpdate);
|
|
3743
|
+
box.setBoxStatus(status, skipUpdate);
|
|
3744
|
+
this.effectBoxStatusChange();
|
|
3745
|
+
}
|
|
3746
|
+
if (zIndex) {
|
|
3747
|
+
box.setZIndex(zIndex, skipUpdate);
|
|
3748
|
+
}
|
|
3749
|
+
if (lastNotMinimizedBoxStatus) {
|
|
3750
|
+
this.setLastNotMinimizedBoxStatus(box.id, lastNotMinimizedBoxStatus, skipUpdate);
|
|
3751
|
+
box.setLastNotMinimizedBoxStatus(lastNotMinimizedBoxStatus, skipUpdate);
|
|
3752
|
+
}
|
|
3753
|
+
effectFunc && effectFunc();
|
|
3065
3754
|
}
|
|
3755
|
+
}
|
|
3756
|
+
remove(boxOrID, skipUpdate = false, effectFunc) {
|
|
3757
|
+
const box = this.getBox(boxOrID);
|
|
3066
3758
|
const index2 = this.getBoxIndex(boxOrID);
|
|
3067
3759
|
if (index2 >= 0) {
|
|
3068
3760
|
const boxes = this.boxes.slice();
|
|
3069
3761
|
const deletedBoxes = boxes.splice(index2, 1);
|
|
3070
3762
|
this.boxes$.setValue(boxes);
|
|
3071
3763
|
deletedBoxes.forEach((box2) => box2.destroy());
|
|
3764
|
+
if (box && this.useBoxesStatus) {
|
|
3765
|
+
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3766
|
+
this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
|
|
3767
|
+
this.effectBoxStatusChange();
|
|
3768
|
+
effectFunc && effectFunc();
|
|
3769
|
+
}
|
|
3072
3770
|
if (!skipUpdate) {
|
|
3073
3771
|
if (this.boxes.length <= 0) {
|
|
3074
3772
|
this.setMaximized(false);
|
|
@@ -3126,16 +3824,19 @@ class TeleBoxManager {
|
|
|
3126
3824
|
targetBox.setFocus(true, skipUpdate);
|
|
3127
3825
|
}
|
|
3128
3826
|
if (focusChanged && !skipUpdate) {
|
|
3129
|
-
this.events.emit(
|
|
3827
|
+
this.events.emit(
|
|
3828
|
+
TELE_BOX_MANAGER_EVENT.Focused,
|
|
3829
|
+
targetBox
|
|
3830
|
+
);
|
|
3130
3831
|
}
|
|
3131
3832
|
} else if (box.focus) {
|
|
3132
3833
|
this.blurBox(box, skipUpdate);
|
|
3133
3834
|
}
|
|
3134
3835
|
});
|
|
3135
|
-
if (this.
|
|
3136
|
-
this.makeMaximizedBoxFocus(targetBox);
|
|
3137
|
-
} else {
|
|
3836
|
+
if (!this.useBoxesStatus) {
|
|
3138
3837
|
this.maxTitleBar.focusBox(targetBox);
|
|
3838
|
+
} else if (this.useBoxesStatus && this.maxTitleBar.hasMaximizedBoxInStatus()) {
|
|
3839
|
+
this.makeMaximizedTopBoxFocus();
|
|
3139
3840
|
}
|
|
3140
3841
|
}
|
|
3141
3842
|
}
|
|
@@ -3154,11 +3855,7 @@ class TeleBoxManager {
|
|
|
3154
3855
|
}
|
|
3155
3856
|
}
|
|
3156
3857
|
if (this.maxTitleBar.focusedBox === targetBox) {
|
|
3157
|
-
|
|
3158
|
-
this.makeMaximizedTopBoxFocus();
|
|
3159
|
-
} else {
|
|
3160
|
-
this.maxTitleBar.focusBox();
|
|
3161
|
-
}
|
|
3858
|
+
this.maxTitleBar.focusBox();
|
|
3162
3859
|
}
|
|
3163
3860
|
}
|
|
3164
3861
|
}
|
|
@@ -3172,11 +3869,7 @@ class TeleBoxManager {
|
|
|
3172
3869
|
}
|
|
3173
3870
|
});
|
|
3174
3871
|
if (this.maxTitleBar.focusedBox) {
|
|
3175
|
-
|
|
3176
|
-
this.makeMaximizedBoxBlur();
|
|
3177
|
-
} else {
|
|
3178
|
-
this.maxTitleBar.focusBox();
|
|
3179
|
-
}
|
|
3872
|
+
this.maxTitleBar.focusBox();
|
|
3180
3873
|
}
|
|
3181
3874
|
}
|
|
3182
3875
|
teleBoxMatcher(config) {
|
|
@@ -3185,10 +3878,18 @@ class TeleBoxManager {
|
|
|
3185
3878
|
}
|
|
3186
3879
|
updateBox(box, config, skipUpdate = false) {
|
|
3187
3880
|
if (config.x != null || config.y != null) {
|
|
3188
|
-
box.move(
|
|
3881
|
+
box.move(
|
|
3882
|
+
config.x == null ? box.intrinsicX : config.x,
|
|
3883
|
+
config.y == null ? box.intrinsicY : config.y,
|
|
3884
|
+
skipUpdate
|
|
3885
|
+
);
|
|
3189
3886
|
}
|
|
3190
3887
|
if (config.width != null || config.height != null) {
|
|
3191
|
-
box.resize(
|
|
3888
|
+
box.resize(
|
|
3889
|
+
config.width == null ? box.intrinsicWidth : config.width,
|
|
3890
|
+
config.height == null ? box.intrinsicHeight : config.height,
|
|
3891
|
+
skipUpdate
|
|
3892
|
+
);
|
|
3192
3893
|
}
|
|
3193
3894
|
if (config.title != null) {
|
|
3194
3895
|
box.setTitle(config.title);
|
|
@@ -3221,11 +3922,11 @@ class TeleBoxManager {
|
|
|
3221
3922
|
if (config.footer != null) {
|
|
3222
3923
|
box.mountFooter(config.footer);
|
|
3223
3924
|
}
|
|
3224
|
-
if (config.boxStatus) {
|
|
3225
|
-
this.
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3925
|
+
if (this.useBoxesStatus && (config.boxStatus || config.lastNotMinimizedBoxStatus)) {
|
|
3926
|
+
this.setBox(box, {
|
|
3927
|
+
status: config.boxStatus,
|
|
3928
|
+
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
|
|
3929
|
+
}, skipUpdate);
|
|
3229
3930
|
}
|
|
3230
3931
|
}
|
|
3231
3932
|
smartPosition(config = {}) {
|
|
@@ -3238,6 +3939,10 @@ class TeleBoxManager {
|
|
|
3238
3939
|
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
3239
3940
|
vx = 20;
|
|
3240
3941
|
}
|
|
3942
|
+
} else if (this.hasMinimizedBox()) {
|
|
3943
|
+
vx = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxX, box) => {
|
|
3944
|
+
return Math.max(maxX, box.intrinsicX * this.containerRect.width + 20);
|
|
3945
|
+
}, vx);
|
|
3241
3946
|
}
|
|
3242
3947
|
x = vx / this.containerRect.width;
|
|
3243
3948
|
}
|
|
@@ -3248,22 +3953,27 @@ class TeleBoxManager {
|
|
|
3248
3953
|
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
3249
3954
|
vy = 20;
|
|
3250
3955
|
}
|
|
3956
|
+
} else if (this.hasMinimizedBox()) {
|
|
3957
|
+
vy = [...this.boxes].filter((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal).reduce((maxY, box) => {
|
|
3958
|
+
return Math.max(maxY, box.intrinsicY * this.containerRect.height + 20);
|
|
3959
|
+
}, vy);
|
|
3251
3960
|
}
|
|
3252
3961
|
y = vy / this.containerRect.height;
|
|
3253
3962
|
}
|
|
3254
|
-
return
|
|
3963
|
+
return { ...config, x, y, width, height };
|
|
3255
3964
|
}
|
|
3256
3965
|
makeBoxTop(box, skipUpdate = false) {
|
|
3257
|
-
if (this.topBox) {
|
|
3966
|
+
if (!this.useBoxesStatus && this.topBox) {
|
|
3258
3967
|
if (box !== this.topBox) {
|
|
3259
|
-
const currentBoxZIndex = box.zIndex;
|
|
3260
|
-
const addZIndex = this.topBox.zIndex + 1 - box.zIndex;
|
|
3261
3968
|
box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
|
|
3262
|
-
this.makeTopBoxEffect(box.id, addZIndex, currentBoxZIndex, skipUpdate);
|
|
3263
3969
|
}
|
|
3264
|
-
}
|
|
3970
|
+
} else if (this.useBoxesStatus)
|
|
3971
|
+
;
|
|
3265
3972
|
}
|
|
3266
|
-
|
|
3973
|
+
getMaximizedTopBox() {
|
|
3974
|
+
if (!this.useBoxesStatus) {
|
|
3975
|
+
return void 0;
|
|
3976
|
+
}
|
|
3267
3977
|
let maximizedBox;
|
|
3268
3978
|
if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
|
|
3269
3979
|
maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, currentBox) => {
|
|
@@ -3272,45 +3982,15 @@ class TeleBoxManager {
|
|
|
3272
3982
|
}
|
|
3273
3983
|
return topBox.zIndex > currentBox.zIndex ? topBox : currentBox;
|
|
3274
3984
|
});
|
|
3275
|
-
if (maximizedBox) {
|
|
3276
|
-
this.maxTitleBar.focusBox(maximizedBox);
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
makeTopBoxEffect(boxId, addZIndex, currentZIndex, skipUpdate = false) {
|
|
3281
|
-
if (this.hasBoxesStatus() && this.hasMinimizedBox()) {
|
|
3282
|
-
this.boxes.forEach((b) => {
|
|
3283
|
-
if (b.boxStatus && b.id !== boxId && b.zIndex >= currentZIndex) {
|
|
3284
|
-
b.setZIndex(b.zIndex + addZIndex, skipUpdate);
|
|
3285
|
-
}
|
|
3286
|
-
});
|
|
3287
3985
|
}
|
|
3986
|
+
return maximizedBox;
|
|
3288
3987
|
}
|
|
3289
|
-
|
|
3290
|
-
if (this.
|
|
3291
|
-
|
|
3292
|
-
const currentMaximizedTopBox = this.maxTitleBar.MaximizedBoxes.reduce((topBox, box) => {
|
|
3293
|
-
if (!topBox) {
|
|
3294
|
-
return box;
|
|
3295
|
-
}
|
|
3296
|
-
return topBox.zIndex > box.zIndex ? topBox : box;
|
|
3297
|
-
});
|
|
3298
|
-
if (currentMaximizedTopBox !== maximizedBox) {
|
|
3299
|
-
const addZIndex = currentMaximizedTopBox.zIndex - currentZIndex + 1;
|
|
3300
|
-
this.boxes.forEach((box) => {
|
|
3301
|
-
if (this.maxTitleBar.MaximizedBoxes.find((b) => b.id === box.id && b.id !== maximizedBox.id)) {
|
|
3302
|
-
return;
|
|
3303
|
-
}
|
|
3304
|
-
if (box.zIndex >= currentZIndex) {
|
|
3305
|
-
box.setZIndex(box.zIndex + addZIndex, skipUpdate);
|
|
3306
|
-
}
|
|
3307
|
-
});
|
|
3308
|
-
}
|
|
3309
|
-
this.maxTitleBar.focusBox(maximizedBox);
|
|
3988
|
+
makeMaximizedTopBoxFocus() {
|
|
3989
|
+
if (!this.useBoxesStatus) {
|
|
3990
|
+
return;
|
|
3310
3991
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
this.maxTitleBar.focusBox();
|
|
3992
|
+
const maximizedBox = this.getMaximizedTopBox();
|
|
3993
|
+
this.maxTitleBar.focusBox(maximizedBox);
|
|
3314
3994
|
}
|
|
3315
3995
|
getBoxIndex(boxOrID) {
|
|
3316
3996
|
return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
|
|
@@ -3318,6 +3998,20 @@ class TeleBoxManager {
|
|
|
3318
3998
|
getBox(boxOrID) {
|
|
3319
3999
|
return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
|
|
3320
4000
|
}
|
|
4001
|
+
createMinimizedAppMenu() {
|
|
4002
|
+
var _a, _b;
|
|
4003
|
+
if ((_a = this.collector) == null ? void 0 : _a.$appMenuContainer) {
|
|
4004
|
+
return new AppMenu({
|
|
4005
|
+
manager: this,
|
|
4006
|
+
container: (_b = this.collector) == null ? void 0 : _b.$appMenuContainer,
|
|
4007
|
+
theme: this.prefersColorScheme ? "dark" : "light",
|
|
4008
|
+
getBoxesStatus: () => {
|
|
4009
|
+
return this.boxesStatus$;
|
|
4010
|
+
}
|
|
4011
|
+
});
|
|
4012
|
+
}
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
3321
4015
|
}
|
|
3322
4016
|
export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager };
|
|
3323
4017
|
//# sourceMappingURL=telebox-insider.es.js.map
|