@netless/telebox-insider 1.0.0-alpha.32 → 1.0.0-alpha.35

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.
@@ -390,8 +390,8 @@ class TeleBox {
390
390
  },
391
391
  onEvent: (event) => this._delegateEvents.emit(event.type)
392
392
  });
393
- this._sideEffect.addDisposer(boxRatio$.subscribe((boxRatio2) => {
394
- if (boxRatio2 > 0) {
393
+ this._sideEffect.addDisposer(combine([boxRatio$, minimized$]).subscribe(([boxRatio2, minimized]) => {
394
+ if (!minimized && boxRatio2 > 0) {
395
395
  this.transform(pxIntrinsicCoord$.value.x, pxIntrinsicCoord$.value.y, pxIntrinsicSize$.value.width, pxIntrinsicSize$.value.height);
396
396
  }
397
397
  }));
@@ -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-maximized {\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}")();
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$.subscribe((state) => {
1035
- $titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), state === TELE_BOX_STATE.Maximized);
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();
@@ -1180,6 +1180,9 @@ class TeleBoxManager {
1180
1180
  }));
1181
1181
  const darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
1182
1182
  const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
1183
+ const theme$ = new Val(theme, {
1184
+ compare: shallowequal
1185
+ });
1183
1186
  const readonlyValConfig = {
1184
1187
  darkMode: darkMode$,
1185
1188
  state: state$,
@@ -1199,7 +1202,8 @@ class TeleBoxManager {
1199
1202
  containerStyle: containerStyle$,
1200
1203
  stageStyle: stageStyle$,
1201
1204
  defaultBoxBodyStyle: defaultBoxBodyStyle$,
1202
- defaultBoxStageStyle: defaultBoxStageStyle$
1205
+ defaultBoxStageStyle: defaultBoxStageStyle$,
1206
+ theme: theme$
1203
1207
  };
1204
1208
  withValueEnhancer(this, valConfig, valManager);
1205
1209
  const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
@@ -1251,8 +1255,14 @@ class TeleBoxManager {
1251
1255
  minimized$.subscribe((minimized2) => {
1252
1256
  this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
1253
1257
  }),
1254
- containerStyle$.subscribe((containerStyle2) => {
1258
+ combine([containerStyle$, theme$]).subscribe(([containerStyle2, theme2]) => {
1255
1259
  this.$container.style.cssText = containerStyle2;
1260
+ if (theme2) {
1261
+ Object.keys(theme2).forEach((key) => {
1262
+ var _a;
1263
+ this.$container.style.setProperty(`--tele-${key}`, (_a = theme2[key]) != null ? _a : null);
1264
+ });
1265
+ }
1256
1266
  }),
1257
1267
  stageStyle$.subscribe((stageStyle2) => {
1258
1268
  this.$stage.style.cssText = stageStyle2;
@@ -1469,12 +1479,6 @@ class TeleBoxManager {
1469
1479
  }
1470
1480
  return deletedBoxes;
1471
1481
  }
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
1482
  mount(root) {
1479
1483
  this._root$.setValue(root);
1480
1484
  }