@netless/telebox-insider 1.0.0-alpha.33 → 1.0.0-alpha.36
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/TeleBoxManager/index.d.ts +1 -1
- package/dist/TeleBoxManager/typings.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/telebox-insider.cjs.js +23 -14
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +23 -14
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBoxManager/MaxTitleBar/index.ts +9 -6
- package/src/TeleBoxManager/MaxTitleBar/style.scss +1 -1
- package/src/TeleBoxManager/index.ts +30 -16
- package/src/TeleBoxManager/typings.ts +1 -1
|
@@ -994,7 +994,7 @@ var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
|
994
994
|
TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
|
|
995
995
|
return TELE_BOX_MANAGER_EVENT2;
|
|
996
996
|
})(TELE_BOX_MANAGER_EVENT || {});
|
|
997
|
-
var style = /* @__PURE__ */ (() => ".telebox-max-titlebar {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 5100;\n border-top-left-radius: 6px;\n border-top-right-radius: 6px;\n}\n.telebox-max-titlebar .telebox-title {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-titles {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-title {\n display: block;\n}\n.telebox-max-titlebar-
|
|
997
|
+
var style = /* @__PURE__ */ (() => ".telebox-max-titlebar {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n display: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 5100;\n border-top-left-radius: 6px;\n border-top-right-radius: 6px;\n}\n.telebox-max-titlebar .telebox-title {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-titles {\n display: none;\n}\n.telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-title {\n display: block;\n}\n.telebox-max-titlebar-active {\n display: flex;\n}\n.telebox-titles {\n height: 100%;\n margin: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n overflow-x: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.telebox-titles::-webkit-scrollbar {\n height: 4px;\n width: 4px;\n}\n.telebox-titles::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.telebox-titles::-webkit-scrollbar-thumb {\n background-color: rgba(238, 238, 247, 0.8);\n background-color: transparent;\n border-radius: 2px;\n transition: background-color 0.4s;\n}\n.telebox-titles:hover::-webkit-scrollbar-thumb {\n background-color: rgba(238, 238, 247, 0.8);\n}\n.telebox-titles::-webkit-scrollbar-thumb:hover {\n background-color: #eeeef7;\n}\n.telebox-titles::-webkit-scrollbar-thumb:active {\n background-color: #eeeef7;\n}\n.telebox-titles::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.telebox-titles::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}\n.telebox-titles-content {\n height: 100%;\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n padding: 0;\n}\n.telebox-titles-tab {\n height: 100%;\n overflow: hidden;\n max-width: 182px;\n min-width: 150px;\n padding: 0 26px 0 16px;\n outline: none;\n font-size: 13px;\n font-family: PingFangSC-Regular, PingFang SC;\n font-weight: 400;\n text-overflow: ellipsis;\n white-space: nowrap;\n word-break: keep-all;\n border: none;\n border-right-width: 1px;\n border-right-style: solid;\n cursor: pointer;\n user-select: none;\n color: #7b88a0;\n color: var(--tele-titlebarTabColor, #7b88a0);\n background-color: transparent;\n background-color: var(--tele-titlebarTabBackground, transparent);\n border-right-color: #e5e5f0;\n border-right-color: var(--tele-titlebarTabDividerColor, #e5e5f0);\n}\n.telebox-titles-tab-focus {\n color: #357bf6;\n color: var(--tele-titlebarTabFocusColor, #357bf6);\n}\n.telebox-readonly .telebox-titles-tab {\n cursor: not-allowed;\n}\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n.telebox-color-scheme-dark .telebox-titles-tab {\n color: #e9e9e9;\n color: var(--tele-titlebarTabColor, #e9e9e9);\n background-color: transparent;\n background-color: var(--tele-titlebarTabBackground, transparent);\n border-right-color: #7b88a0;\n border-right-color: var(--tele-titlebarTabDividerColor, #7b88a0);\n}\n.telebox-color-scheme-dark .telebox-titles-tab-focus {\n color: #357bf6;\n color: var(--tele-titlebarTabFocusColor, #357bf6);\n}")();
|
|
998
998
|
class MaxTitleBar extends DefaultTitleBar {
|
|
999
999
|
constructor(config) {
|
|
1000
1000
|
super(config);
|
|
@@ -1031,8 +1031,8 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
1031
1031
|
const $titleBar = super.render();
|
|
1032
1032
|
$titleBar.classList.add(this.wrapClassName("max-titlebar"));
|
|
1033
1033
|
this.sideEffect.addDisposer([
|
|
1034
|
-
this.state
|
|
1035
|
-
$titleBar.classList.toggle(this.wrapClassName("max-titlebar-
|
|
1034
|
+
combine([this.boxes$, this.state$]).subscribe(([boxes, state]) => {
|
|
1035
|
+
$titleBar.classList.toggle(this.wrapClassName("max-titlebar-active"), state === TELE_BOX_STATE.Maximized && boxes.length > 0);
|
|
1036
1036
|
}),
|
|
1037
1037
|
this.readonly$.subscribe((readonly) => {
|
|
1038
1038
|
$titleBar.classList.toggle(this.wrapClassName("readonly"), readonly);
|
|
@@ -1101,7 +1101,7 @@ class TeleBoxManager {
|
|
|
1101
1101
|
stageStyle = "",
|
|
1102
1102
|
defaultBoxBodyStyle = null,
|
|
1103
1103
|
defaultBoxStageStyle = null,
|
|
1104
|
-
theme =
|
|
1104
|
+
theme = null
|
|
1105
1105
|
} = {}) {
|
|
1106
1106
|
this.events = new Emittery();
|
|
1107
1107
|
this._sideEffect = new SideEffectManager();
|
|
@@ -1168,8 +1168,13 @@ class TeleBoxManager {
|
|
|
1168
1168
|
const handler = (evt) => {
|
|
1169
1169
|
prefersDark$.setValue(evt.matches);
|
|
1170
1170
|
};
|
|
1171
|
-
prefersDarkMatch.addEventListener
|
|
1172
|
-
|
|
1171
|
+
if (prefersDarkMatch.addEventListener) {
|
|
1172
|
+
prefersDarkMatch.addEventListener("change", handler);
|
|
1173
|
+
return () => prefersDarkMatch.removeEventListener("change", handler);
|
|
1174
|
+
} else {
|
|
1175
|
+
prefersDarkMatch.addListener(handler);
|
|
1176
|
+
return () => prefersDarkMatch.removeListener(handler);
|
|
1177
|
+
}
|
|
1173
1178
|
});
|
|
1174
1179
|
}
|
|
1175
1180
|
const prefersColorScheme$ = new Val(prefersColorScheme);
|
|
@@ -1180,6 +1185,9 @@ class TeleBoxManager {
|
|
|
1180
1185
|
}));
|
|
1181
1186
|
const darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
|
|
1182
1187
|
const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
|
|
1188
|
+
const theme$ = new Val(theme, {
|
|
1189
|
+
compare: shallowequal
|
|
1190
|
+
});
|
|
1183
1191
|
const readonlyValConfig = {
|
|
1184
1192
|
darkMode: darkMode$,
|
|
1185
1193
|
state: state$,
|
|
@@ -1199,7 +1207,8 @@ class TeleBoxManager {
|
|
|
1199
1207
|
containerStyle: containerStyle$,
|
|
1200
1208
|
stageStyle: stageStyle$,
|
|
1201
1209
|
defaultBoxBodyStyle: defaultBoxBodyStyle$,
|
|
1202
|
-
defaultBoxStageStyle: defaultBoxStageStyle
|
|
1210
|
+
defaultBoxStageStyle: defaultBoxStageStyle$,
|
|
1211
|
+
theme: theme$
|
|
1203
1212
|
};
|
|
1204
1213
|
withValueEnhancer(this, valConfig, valManager);
|
|
1205
1214
|
const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
|
|
@@ -1251,8 +1260,14 @@ class TeleBoxManager {
|
|
|
1251
1260
|
minimized$.subscribe((minimized2) => {
|
|
1252
1261
|
this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
|
|
1253
1262
|
}),
|
|
1254
|
-
containerStyle
|
|
1263
|
+
combine([containerStyle$, theme$]).subscribe(([containerStyle2, theme2]) => {
|
|
1255
1264
|
this.$container.style.cssText = containerStyle2;
|
|
1265
|
+
if (theme2) {
|
|
1266
|
+
Object.keys(theme2).forEach((key) => {
|
|
1267
|
+
var _a;
|
|
1268
|
+
this.$container.style.setProperty(`--tele-${key}`, (_a = theme2[key]) != null ? _a : null);
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1256
1271
|
}),
|
|
1257
1272
|
stageStyle$.subscribe((stageStyle2) => {
|
|
1258
1273
|
this.$stage.style.cssText = stageStyle2;
|
|
@@ -1469,12 +1484,6 @@ class TeleBoxManager {
|
|
|
1469
1484
|
}
|
|
1470
1485
|
return deletedBoxes;
|
|
1471
1486
|
}
|
|
1472
|
-
setTheme(theme) {
|
|
1473
|
-
Object.keys(theme).forEach((key) => {
|
|
1474
|
-
var _a;
|
|
1475
|
-
this.$container.style.setProperty(`--tele-${key}`, (_a = theme[key]) != null ? _a : null);
|
|
1476
|
-
});
|
|
1477
|
-
}
|
|
1478
1487
|
mount(root) {
|
|
1479
1488
|
this._root$.setValue(root);
|
|
1480
1489
|
}
|