@netless/telebox-insider 0.3.0-beta.6 → 0.3.0-beta.8
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 +6 -3
- package/dist/style.css +10 -10
- package/dist/telebox-insider.cjs.js +692 -419
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +582 -314
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +2 -2
- package/src/AppMenu/index.ts +9 -1
- package/src/TeleBox/style.scss +2 -2
- package/src/TeleBoxCollector/style.scss +2 -2
- package/src/TeleBoxManager/MaxTitleBar/style.scss +2 -2
- package/src/TeleBoxManager/index.ts +8 -1
- 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$4 = '.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$3 =
|
|
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$2 = "
|
|
2412
|
+
var style$2 = "";
|
|
2280
2413
|
var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
|
|
2281
2414
|
class TeleBoxCollector {
|
|
2282
2415
|
constructor({
|
|
@@ -2344,7 +2477,10 @@ class TeleBoxCollector {
|
|
|
2344
2477
|
if (this._visible !== visible) {
|
|
2345
2478
|
this._visible = visible;
|
|
2346
2479
|
if (this.$collector) {
|
|
2347
|
-
this.$collector.classList.toggle(
|
|
2480
|
+
this.$collector.classList.toggle(
|
|
2481
|
+
this.wrapClassName("collector-visible"),
|
|
2482
|
+
visible
|
|
2483
|
+
);
|
|
2348
2484
|
}
|
|
2349
2485
|
}
|
|
2350
2486
|
return this;
|
|
@@ -2353,7 +2489,10 @@ class TeleBoxCollector {
|
|
|
2353
2489
|
if (this._readonly !== readonly) {
|
|
2354
2490
|
this._readonly = readonly;
|
|
2355
2491
|
if (this.$collector) {
|
|
2356
|
-
this.$collector.classList.toggle(
|
|
2492
|
+
this.$collector.classList.toggle(
|
|
2493
|
+
this.wrapClassName("collector-readonly"),
|
|
2494
|
+
readonly
|
|
2495
|
+
);
|
|
2357
2496
|
}
|
|
2358
2497
|
}
|
|
2359
2498
|
return this;
|
|
@@ -2362,8 +2501,14 @@ class TeleBoxCollector {
|
|
|
2362
2501
|
if (this._darkMode !== darkMode) {
|
|
2363
2502
|
this._darkMode = darkMode;
|
|
2364
2503
|
if (this.$collector) {
|
|
2365
|
-
this.$collector.classList.toggle(
|
|
2366
|
-
|
|
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
|
+
);
|
|
2367
2512
|
}
|
|
2368
2513
|
}
|
|
2369
2514
|
return this;
|
|
@@ -2386,14 +2531,25 @@ class TeleBoxCollector {
|
|
|
2386
2531
|
this.$collector = document.createElement("button");
|
|
2387
2532
|
this.$collector.className = this.wrapClassName("collector");
|
|
2388
2533
|
this.$collector.style.backgroundImage = `url('${collectorSVG}')`;
|
|
2389
|
-
this.$collector.addEventListener(
|
|
2534
|
+
this.$collector.addEventListener(
|
|
2535
|
+
"click",
|
|
2536
|
+
this.handleCollectorClick
|
|
2537
|
+
);
|
|
2390
2538
|
if (this._visible) {
|
|
2391
|
-
this.$collector.classList.add(
|
|
2539
|
+
this.$collector.classList.add(
|
|
2540
|
+
this.wrapClassName("collector-visible")
|
|
2541
|
+
);
|
|
2392
2542
|
}
|
|
2393
2543
|
if (this._readonly) {
|
|
2394
|
-
this.$collector.classList.add(
|
|
2395
|
-
|
|
2396
|
-
|
|
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
|
+
);
|
|
2397
2553
|
this.$appMenuContainer.classList.add(this.wrapClassName("collector-shadow"));
|
|
2398
2554
|
this.$collector.append(this.$appMenuContainer);
|
|
2399
2555
|
this.setStyles(this.styles);
|
|
@@ -2402,7 +2558,10 @@ class TeleBoxCollector {
|
|
|
2402
2558
|
}
|
|
2403
2559
|
destroy() {
|
|
2404
2560
|
if (this.$collector) {
|
|
2405
|
-
this.$collector.removeEventListener(
|
|
2561
|
+
this.$collector.removeEventListener(
|
|
2562
|
+
"click",
|
|
2563
|
+
this.handleCollectorClick
|
|
2564
|
+
);
|
|
2406
2565
|
this.$collector.remove();
|
|
2407
2566
|
this.$collector = void 0;
|
|
2408
2567
|
}
|
|
@@ -2412,8 +2571,7 @@ class TeleBoxCollector {
|
|
|
2412
2571
|
return `${this.namespace}-${className}`;
|
|
2413
2572
|
}
|
|
2414
2573
|
}
|
|
2415
|
-
var TELE_BOX_MANAGER_EVENT
|
|
2416
|
-
(function(TELE_BOX_MANAGER_EVENT2) {
|
|
2574
|
+
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
2417
2575
|
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
|
2418
2576
|
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
|
2419
2577
|
TELE_BOX_MANAGER_EVENT2["Created"] = "created";
|
|
@@ -2431,8 +2589,9 @@ var TELE_BOX_MANAGER_EVENT;
|
|
|
2431
2589
|
TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
|
|
2432
2590
|
TELE_BOX_MANAGER_EVENT2["BoxStatus"] = "box_status";
|
|
2433
2591
|
TELE_BOX_MANAGER_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
2434
|
-
|
|
2435
|
-
|
|
2592
|
+
return TELE_BOX_MANAGER_EVENT2;
|
|
2593
|
+
})(TELE_BOX_MANAGER_EVENT || {});
|
|
2594
|
+
var style$1 = "";
|
|
2436
2595
|
class MaxTitleBar extends DefaultTitleBar {
|
|
2437
2596
|
constructor(config) {
|
|
2438
2597
|
super(config);
|
|
@@ -2478,9 +2637,15 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2478
2637
|
const id = (_a = $tab.dataset) == null ? void 0 : _a.teleBoxID;
|
|
2479
2638
|
if (id) {
|
|
2480
2639
|
if (box && id === box.id) {
|
|
2481
|
-
$tab.classList.toggle(
|
|
2640
|
+
$tab.classList.toggle(
|
|
2641
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2642
|
+
true
|
|
2643
|
+
);
|
|
2482
2644
|
} else if (this.focusedBox && id === this.focusedBox.id) {
|
|
2483
|
-
$tab.classList.toggle(
|
|
2645
|
+
$tab.classList.toggle(
|
|
2646
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2647
|
+
false
|
|
2648
|
+
);
|
|
2484
2649
|
}
|
|
2485
2650
|
}
|
|
2486
2651
|
}
|
|
@@ -2490,9 +2655,15 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2490
2655
|
const id = (_b = $tab.dataset) == null ? void 0 : _b.teleBoxID;
|
|
2491
2656
|
if (id) {
|
|
2492
2657
|
if (box && id === box.id) {
|
|
2493
|
-
$tab.classList.toggle(
|
|
2658
|
+
$tab.classList.toggle(
|
|
2659
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2660
|
+
true
|
|
2661
|
+
);
|
|
2494
2662
|
} else if (this.focusedBox && id === this.focusedBox.id) {
|
|
2495
|
-
$tab.classList.toggle(
|
|
2663
|
+
$tab.classList.toggle(
|
|
2664
|
+
this.wrapClassName("titles-tab-focus"),
|
|
2665
|
+
false
|
|
2666
|
+
);
|
|
2496
2667
|
}
|
|
2497
2668
|
}
|
|
2498
2669
|
}
|
|
@@ -2513,36 +2684,54 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2513
2684
|
this.setBoxStatus(TELE_BOX_STATE.Maximized);
|
|
2514
2685
|
}
|
|
2515
2686
|
if (this.$titleBar) {
|
|
2516
|
-
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
|
+
);
|
|
2517
2691
|
}
|
|
2518
2692
|
this.updateTitles();
|
|
2519
2693
|
}
|
|
2520
2694
|
setBoxes(boxes) {
|
|
2521
2695
|
this.boxes = boxes;
|
|
2522
2696
|
if (this.$titleBar) {
|
|
2523
|
-
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
|
+
);
|
|
2524
2701
|
}
|
|
2525
2702
|
this.updateTitles();
|
|
2526
2703
|
}
|
|
2527
2704
|
setState(state) {
|
|
2528
2705
|
super.setState(state);
|
|
2529
2706
|
if (this.$titleBar) {
|
|
2530
|
-
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
|
+
);
|
|
2531
2711
|
}
|
|
2532
2712
|
this.updateTitles();
|
|
2533
2713
|
}
|
|
2534
2714
|
setReadonly(readonly) {
|
|
2535
2715
|
super.setReadonly(readonly);
|
|
2536
2716
|
if (this.$titleBar) {
|
|
2537
|
-
this.$titleBar.classList.toggle(
|
|
2717
|
+
this.$titleBar.classList.toggle(
|
|
2718
|
+
this.wrapClassName("readonly"),
|
|
2719
|
+
this.readonly
|
|
2720
|
+
);
|
|
2538
2721
|
}
|
|
2539
2722
|
}
|
|
2540
2723
|
setDarkMode(darkMode) {
|
|
2541
2724
|
if (darkMode !== this.darkMode) {
|
|
2542
2725
|
this.darkMode = darkMode;
|
|
2543
2726
|
if (this.$titleBar) {
|
|
2544
|
-
this.$titleBar.classList.toggle(
|
|
2545
|
-
|
|
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
|
+
);
|
|
2546
2735
|
}
|
|
2547
2736
|
}
|
|
2548
2737
|
}
|
|
@@ -2552,9 +2741,19 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2552
2741
|
$titleBar.style.transform = `translate(${x}px, ${y}px)`;
|
|
2553
2742
|
$titleBar.style.width = width + "px";
|
|
2554
2743
|
$titleBar.classList.add(this.wrapClassName("max-titlebar"));
|
|
2555
|
-
$titleBar.classList.toggle(
|
|
2556
|
-
|
|
2557
|
-
|
|
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
|
+
);
|
|
2558
2757
|
const $titlesArea = document.createElement("div");
|
|
2559
2758
|
$titlesArea.classList.add(this.wrapClassName("titles-area"));
|
|
2560
2759
|
$titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
|
|
@@ -2569,23 +2768,33 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2569
2768
|
}
|
|
2570
2769
|
updateTitles() {
|
|
2571
2770
|
if (this.$titleBar && (this.state === TELE_BOX_STATE.Maximized || this.hasMaximizedBoxInStatus())) {
|
|
2572
|
-
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
|
+
);
|
|
2573
2775
|
if (this.boxes.length === 1 || this.hasMaximizedBoxInStatus() && this.MaximizedBoxes.length === 1) {
|
|
2574
2776
|
this.setTitle(this.boxes[0].title);
|
|
2575
2777
|
} else {
|
|
2576
|
-
this.$titleBar.replaceChild(
|
|
2778
|
+
this.$titleBar.replaceChild(
|
|
2779
|
+
this.renderTitles(),
|
|
2780
|
+
this.$titleBar.firstElementChild
|
|
2781
|
+
);
|
|
2577
2782
|
}
|
|
2578
2783
|
}
|
|
2579
2784
|
}
|
|
2580
2785
|
renderTitles() {
|
|
2581
2786
|
this.$titles = document.createElement("div");
|
|
2582
2787
|
this.$titles.className = this.wrapClassName("titles");
|
|
2583
|
-
this.$titles.addEventListener(
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
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
|
+
);
|
|
2589
2798
|
const $content = document.createElement("div");
|
|
2590
2799
|
$content.className = this.wrapClassName("titles-content");
|
|
2591
2800
|
this.$titles.appendChild($content);
|
|
@@ -2603,7 +2812,7 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2603
2812
|
return this.$titles;
|
|
2604
2813
|
}
|
|
2605
2814
|
}
|
|
2606
|
-
var style = "
|
|
2815
|
+
var style = "";
|
|
2607
2816
|
class AppMenu {
|
|
2608
2817
|
constructor(props) {
|
|
2609
2818
|
this.namespace = "telebox-app-menu";
|
|
@@ -2654,7 +2863,7 @@ class AppMenu {
|
|
|
2654
2863
|
}
|
|
2655
2864
|
get boxesStatus() {
|
|
2656
2865
|
var _a;
|
|
2657
|
-
return ((_a = this.getBoxesStatus) == null ? void 0 : _a.call(this)) || new Map();
|
|
2866
|
+
return ((_a = this.getBoxesStatus) == null ? void 0 : _a.call(this)) || /* @__PURE__ */ new Map();
|
|
2658
2867
|
}
|
|
2659
2868
|
get minimizedBoxesStatus() {
|
|
2660
2869
|
const arr = [];
|
|
@@ -2668,6 +2877,13 @@ class AppMenu {
|
|
|
2668
2877
|
c(className) {
|
|
2669
2878
|
return `${this.namespace}-${className}`;
|
|
2670
2879
|
}
|
|
2880
|
+
setContainer(container) {
|
|
2881
|
+
if (this.container) {
|
|
2882
|
+
this.container.remove();
|
|
2883
|
+
}
|
|
2884
|
+
this.container = container;
|
|
2885
|
+
this.init();
|
|
2886
|
+
}
|
|
2671
2887
|
createDefaultAppMenu() {
|
|
2672
2888
|
this.badge.classList.add(this.c("app-menu-badge"));
|
|
2673
2889
|
this.menuView.classList.add(this.c("app-menu-tooltip"));
|
|
@@ -2761,8 +2977,8 @@ class TeleBoxManager {
|
|
|
2761
2977
|
}
|
|
2762
2978
|
return;
|
|
2763
2979
|
});
|
|
2764
|
-
this.boxesStatus$ = new Map();
|
|
2765
|
-
this.lastNotMinimizedBoxesStatus$ = new Map();
|
|
2980
|
+
this.boxesStatus$ = /* @__PURE__ */ new Map();
|
|
2981
|
+
this.lastNotMinimizedBoxesStatus$ = /* @__PURE__ */ new Map();
|
|
2766
2982
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2767
2983
|
const prefersDark$ = createVal(false);
|
|
2768
2984
|
if (prefersDark) {
|
|
@@ -2777,12 +2993,20 @@ class TeleBoxManager {
|
|
|
2777
2993
|
}
|
|
2778
2994
|
const prefersColorScheme$ = createVal(prefersColorScheme);
|
|
2779
2995
|
prefersColorScheme$.reaction((prefersColorScheme2, _, skipUpdate) => {
|
|
2780
|
-
this.boxes.forEach(
|
|
2996
|
+
this.boxes.forEach(
|
|
2997
|
+
(box) => box.setPrefersColorScheme(prefersColorScheme2, skipUpdate)
|
|
2998
|
+
);
|
|
2781
2999
|
if (!skipUpdate) {
|
|
2782
|
-
this.events.emit(
|
|
3000
|
+
this.events.emit(
|
|
3001
|
+
TELE_BOX_MANAGER_EVENT.PrefersColorScheme,
|
|
3002
|
+
prefersColorScheme2
|
|
3003
|
+
);
|
|
2783
3004
|
}
|
|
2784
3005
|
});
|
|
2785
|
-
this._darkMode$ = combine(
|
|
3006
|
+
this._darkMode$ = combine(
|
|
3007
|
+
[prefersDark$, prefersColorScheme$],
|
|
3008
|
+
([prefersDark2, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark2 : prefersColorScheme2 === "dark"
|
|
3009
|
+
);
|
|
2786
3010
|
this._darkMode$.reaction((darkMode, _, skipUpdate) => {
|
|
2787
3011
|
this.boxes.forEach((box) => box.setDarkMode(darkMode, skipUpdate));
|
|
2788
3012
|
if (!skipUpdate) {
|
|
@@ -2796,12 +3020,17 @@ class TeleBoxManager {
|
|
|
2796
3020
|
const minimized$ = createVal(minimized);
|
|
2797
3021
|
const maximized$ = createVal(maximized);
|
|
2798
3022
|
maximized$.reaction((maximized2, _, skipUpdate) => {
|
|
2799
|
-
this.boxes.forEach(
|
|
3023
|
+
this.boxes.forEach(
|
|
3024
|
+
(box) => box.setMaximized(maximized2, skipUpdate)
|
|
3025
|
+
);
|
|
2800
3026
|
if (!skipUpdate) {
|
|
2801
3027
|
this.events.emit(TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
|
|
2802
3028
|
}
|
|
2803
3029
|
});
|
|
2804
|
-
const state$ = combine(
|
|
3030
|
+
const state$ = combine(
|
|
3031
|
+
[minimized$, maximized$],
|
|
3032
|
+
([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal
|
|
3033
|
+
);
|
|
2805
3034
|
state$.reaction((state, _, skipUpdate) => {
|
|
2806
3035
|
this.maxTitleBar.setState(state);
|
|
2807
3036
|
if (!skipUpdate) {
|
|
@@ -2814,19 +3043,26 @@ class TeleBoxManager {
|
|
|
2814
3043
|
});
|
|
2815
3044
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
2816
3045
|
containerRect$.reaction((containerRect2, _, skipUpdate) => {
|
|
2817
|
-
this.boxes.forEach(
|
|
3046
|
+
this.boxes.forEach(
|
|
3047
|
+
(box) => box.setContainerRect(containerRect2, skipUpdate)
|
|
3048
|
+
);
|
|
2818
3049
|
this.maxTitleBar.setContainerRect(containerRect2);
|
|
2819
3050
|
});
|
|
2820
|
-
const collector$ = createVal(
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
3051
|
+
const collector$ = createVal(
|
|
3052
|
+
collector === null ? null : collector || new TeleBoxCollector({
|
|
3053
|
+
visible: minimized,
|
|
3054
|
+
readonly,
|
|
3055
|
+
namespace
|
|
3056
|
+
}).mount(root)
|
|
3057
|
+
);
|
|
2825
3058
|
collector$.subscribe((collector2) => {
|
|
2826
3059
|
if (collector2) {
|
|
2827
3060
|
collector2.setVisible(minimized$.value);
|
|
2828
3061
|
collector2.setReadonly(readonly$.value);
|
|
2829
3062
|
collector2.setDarkMode(this._darkMode$.value);
|
|
3063
|
+
if (this.useBoxesStatus && this.appMenu) {
|
|
3064
|
+
this.appMenu.setContainer(collector2.$appMenuContainer);
|
|
3065
|
+
}
|
|
2830
3066
|
this._sideEffect.add(() => {
|
|
2831
3067
|
collector2.getBoxesStatus = () => {
|
|
2832
3068
|
return this.boxesStatus$;
|
|
@@ -2844,10 +3080,12 @@ class TeleBoxManager {
|
|
|
2844
3080
|
}, "collect-onClick");
|
|
2845
3081
|
}
|
|
2846
3082
|
});
|
|
2847
|
-
readonly$.subscribe(
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
3083
|
+
readonly$.subscribe(
|
|
3084
|
+
(readonly2) => {
|
|
3085
|
+
var _a;
|
|
3086
|
+
return (_a = collector$.value) == null ? void 0 : _a.setReadonly(readonly2);
|
|
3087
|
+
}
|
|
3088
|
+
);
|
|
2851
3089
|
this._darkMode$.subscribe((darkMode) => {
|
|
2852
3090
|
var _a;
|
|
2853
3091
|
(_a = collector$.value) == null ? void 0 : _a.setDarkMode(darkMode);
|
|
@@ -2872,7 +3110,9 @@ class TeleBoxManager {
|
|
|
2872
3110
|
collectorRect$.setValue(collectorRect);
|
|
2873
3111
|
}
|
|
2874
3112
|
};
|
|
2875
|
-
const collectorRect$ = createVal(
|
|
3113
|
+
const collectorRect$ = createVal(
|
|
3114
|
+
minimized$.value ? this._calcCollectorRect() : void 0
|
|
3115
|
+
);
|
|
2876
3116
|
collectorRect$.subscribe((collectorRect, _, skipUpdate) => {
|
|
2877
3117
|
this.boxes.forEach((box) => {
|
|
2878
3118
|
box.setCollectorRect(collectorRect, skipUpdate);
|
|
@@ -2884,7 +3124,9 @@ class TeleBoxManager {
|
|
|
2884
3124
|
if (minimized2) {
|
|
2885
3125
|
this._setCollectorRect(this._calcCollectorRect());
|
|
2886
3126
|
}
|
|
2887
|
-
this.boxes.forEach(
|
|
3127
|
+
this.boxes.forEach(
|
|
3128
|
+
(box) => box.setMinimized(minimized2, skipUpdate)
|
|
3129
|
+
);
|
|
2888
3130
|
if (!skipUpdate) {
|
|
2889
3131
|
this.events.emit(TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
|
|
2890
3132
|
}
|
|
@@ -2934,8 +3176,18 @@ class TeleBoxManager {
|
|
|
2934
3176
|
}
|
|
2935
3177
|
}
|
|
2936
3178
|
};
|
|
2937
|
-
this._sideEffect.addEventListener(
|
|
2938
|
-
|
|
3179
|
+
this._sideEffect.addEventListener(
|
|
3180
|
+
window,
|
|
3181
|
+
"mousedown",
|
|
3182
|
+
checkFocusBox,
|
|
3183
|
+
true
|
|
3184
|
+
);
|
|
3185
|
+
this._sideEffect.addEventListener(
|
|
3186
|
+
window,
|
|
3187
|
+
"touchstart",
|
|
3188
|
+
checkFocusBox,
|
|
3189
|
+
true
|
|
3190
|
+
);
|
|
2939
3191
|
this.maxTitleBar = new MaxTitleBar({
|
|
2940
3192
|
darkMode: this.darkMode,
|
|
2941
3193
|
readonly: readonly$.value,
|
|
@@ -3031,7 +3283,9 @@ class TeleBoxManager {
|
|
|
3031
3283
|
}
|
|
3032
3284
|
}
|
|
3033
3285
|
});
|
|
3034
|
-
readonly$.subscribe(
|
|
3286
|
+
readonly$.subscribe(
|
|
3287
|
+
(readonly2) => this.maxTitleBar.setReadonly(readonly2)
|
|
3288
|
+
);
|
|
3035
3289
|
this._darkMode$.subscribe((darkMode) => {
|
|
3036
3290
|
this.maxTitleBar.setDarkMode(darkMode);
|
|
3037
3291
|
});
|
|
@@ -3113,10 +3367,13 @@ class TeleBoxManager {
|
|
|
3113
3367
|
get lastNotMinimizedBoxesStatus() {
|
|
3114
3368
|
return this.lastNotMinimizedBoxesStatus$;
|
|
3115
3369
|
}
|
|
3116
|
-
|
|
3370
|
+
setBoxesStatus(boxesStatus, skipUpdate = false) {
|
|
3117
3371
|
this.boxesStatus$ = boxesStatus;
|
|
3118
3372
|
this.effectBoxesStatusChange(skipUpdate);
|
|
3119
3373
|
}
|
|
3374
|
+
getBoxesStatus() {
|
|
3375
|
+
return this.boxesStatus$;
|
|
3376
|
+
}
|
|
3120
3377
|
effectBoxStatusChange() {
|
|
3121
3378
|
if (!this.useBoxesStatus) {
|
|
3122
3379
|
return;
|
|
@@ -3222,7 +3479,7 @@ class TeleBoxManager {
|
|
|
3222
3479
|
return this.boxes.some((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
|
|
3223
3480
|
}
|
|
3224
3481
|
getMinimizedBoxesStatus() {
|
|
3225
|
-
const minimizedBoxes = new Map();
|
|
3482
|
+
const minimizedBoxes = /* @__PURE__ */ new Map();
|
|
3226
3483
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3227
3484
|
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3228
3485
|
minimizedBoxes.set(boxId, boxStatus);
|
|
@@ -3231,7 +3488,7 @@ class TeleBoxManager {
|
|
|
3231
3488
|
return minimizedBoxes;
|
|
3232
3489
|
}
|
|
3233
3490
|
getNotMinimizedBoxesStatus() {
|
|
3234
|
-
const notMinimizedBoxes = new Map();
|
|
3491
|
+
const notMinimizedBoxes = /* @__PURE__ */ new Map();
|
|
3235
3492
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3236
3493
|
if (boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
3237
3494
|
notMinimizedBoxes.set(boxId, boxStatus);
|
|
@@ -3240,7 +3497,7 @@ class TeleBoxManager {
|
|
|
3240
3497
|
return notMinimizedBoxes;
|
|
3241
3498
|
}
|
|
3242
3499
|
getAllMaximizedBoxesStatus() {
|
|
3243
|
-
const maximizedBoxes = new Map();
|
|
3500
|
+
const maximizedBoxes = /* @__PURE__ */ new Map();
|
|
3244
3501
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3245
3502
|
if (boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3246
3503
|
maximizedBoxes.set(boxId, boxStatus);
|
|
@@ -3249,7 +3506,7 @@ class TeleBoxManager {
|
|
|
3249
3506
|
return maximizedBoxes;
|
|
3250
3507
|
}
|
|
3251
3508
|
getAllNormalBoxesStatus() {
|
|
3252
|
-
const normalBoxes = new Map();
|
|
3509
|
+
const normalBoxes = /* @__PURE__ */ new Map();
|
|
3253
3510
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3254
3511
|
if (boxStatus === TELE_BOX_STATE.Normal) {
|
|
3255
3512
|
normalBoxes.set(boxId, boxStatus);
|
|
@@ -3362,9 +3619,9 @@ class TeleBoxManager {
|
|
|
3362
3619
|
create(config = {}, smartPosition = true) {
|
|
3363
3620
|
var _a;
|
|
3364
3621
|
console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
|
|
3365
|
-
const box = new TeleBox(
|
|
3366
|
-
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3367
|
-
|
|
3622
|
+
const box = new TeleBox({
|
|
3623
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
3624
|
+
...smartPosition ? this.smartPosition(config) : config,
|
|
3368
3625
|
darkMode: this.darkMode,
|
|
3369
3626
|
prefersColorScheme: this.prefersColorScheme,
|
|
3370
3627
|
maximized: this.maximized,
|
|
@@ -3374,7 +3631,7 @@ class TeleBoxManager {
|
|
|
3374
3631
|
containerRect: this.containerRect,
|
|
3375
3632
|
readonly: this.readonly,
|
|
3376
3633
|
collectorRect: this.collectorRect
|
|
3377
|
-
})
|
|
3634
|
+
});
|
|
3378
3635
|
box.mount(this.root);
|
|
3379
3636
|
this.boxes$.setValue([...this.boxes, box]);
|
|
3380
3637
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
@@ -3590,7 +3847,10 @@ class TeleBoxManager {
|
|
|
3590
3847
|
targetBox.setFocus(true, skipUpdate);
|
|
3591
3848
|
}
|
|
3592
3849
|
if (focusChanged && !skipUpdate) {
|
|
3593
|
-
this.events.emit(
|
|
3850
|
+
this.events.emit(
|
|
3851
|
+
TELE_BOX_MANAGER_EVENT.Focused,
|
|
3852
|
+
targetBox
|
|
3853
|
+
);
|
|
3594
3854
|
}
|
|
3595
3855
|
} else if (box.focus) {
|
|
3596
3856
|
this.blurBox(box, skipUpdate);
|
|
@@ -3641,10 +3901,18 @@ class TeleBoxManager {
|
|
|
3641
3901
|
}
|
|
3642
3902
|
updateBox(box, config, skipUpdate = false) {
|
|
3643
3903
|
if (config.x != null || config.y != null) {
|
|
3644
|
-
box.move(
|
|
3904
|
+
box.move(
|
|
3905
|
+
config.x == null ? box.intrinsicX : config.x,
|
|
3906
|
+
config.y == null ? box.intrinsicY : config.y,
|
|
3907
|
+
skipUpdate
|
|
3908
|
+
);
|
|
3645
3909
|
}
|
|
3646
3910
|
if (config.width != null || config.height != null) {
|
|
3647
|
-
box.resize(
|
|
3911
|
+
box.resize(
|
|
3912
|
+
config.width == null ? box.intrinsicWidth : config.width,
|
|
3913
|
+
config.height == null ? box.intrinsicHeight : config.height,
|
|
3914
|
+
skipUpdate
|
|
3915
|
+
);
|
|
3648
3916
|
}
|
|
3649
3917
|
if (config.title != null) {
|
|
3650
3918
|
box.setTitle(config.title);
|
|
@@ -3715,7 +3983,7 @@ class TeleBoxManager {
|
|
|
3715
3983
|
}
|
|
3716
3984
|
y = vy / this.containerRect.height;
|
|
3717
3985
|
}
|
|
3718
|
-
return
|
|
3986
|
+
return { ...config, x, y, width, height };
|
|
3719
3987
|
}
|
|
3720
3988
|
makeBoxTop(box, skipUpdate = false) {
|
|
3721
3989
|
if (!this.useBoxesStatus && this.topBox) {
|