@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.
@@ -29,6 +29,7 @@ declare type ValConfig = {
29
29
  stageStyle: Val<string>;
30
30
  defaultBoxBodyStyle: Val<string | null>;
31
31
  defaultBoxStageStyle: Val<string | null>;
32
+ theme: Val<TeleBoxManagerThemeConfig | null>;
32
33
  };
33
34
  declare type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> & ReadonlyValEnhancedResult<ReadonlyValConfig>;
34
35
  export interface TeleBoxManager extends CombinedValEnhancedResult {
@@ -86,7 +87,6 @@ export declare class TeleBoxManager {
86
87
  remove(boxOrID: string | TeleBox, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
87
88
  removeTopBox(): ReadonlyTeleBox | undefined;
88
89
  removeAll(skipUpdate?: boolean): ReadonlyTeleBox[];
89
- setTheme(theme: TeleBoxManagerThemeConfig): void;
90
90
  /**
91
91
  * Mount manager to a container element.
92
92
  */
@@ -31,7 +31,7 @@ export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "namespace"> {
31
31
  /** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
32
32
  readonly defaultBoxStageStyle?: string | null;
33
33
  /** Theme variable */
34
- readonly theme?: TeleBoxManagerThemeConfig;
34
+ readonly theme?: TeleBoxManagerThemeConfig | null;
35
35
  }
36
36
  declare type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "boxRatio" | "zIndex" | "stageRatio";
37
37
  export declare type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "stage" | "footer" | "styles" | "bodyStyle" | "stageStyle" | "id" | "focus" | "enableShadowDOM">;
package/dist/style.css CHANGED
@@ -553,7 +553,7 @@
553
553
  .telebox-max-titlebar.telebox-max-titlebar-single-title .telebox-title {
554
554
  display: block;
555
555
  }
556
- .telebox-max-titlebar-maximized {
556
+ .telebox-max-titlebar-active {
557
557
  display: flex;
558
558
  }
559
559
  .telebox-titles {
@@ -398,8 +398,8 @@ class TeleBox {
398
398
  },
399
399
  onEvent: (event) => this._delegateEvents.emit(event.type)
400
400
  });
401
- this._sideEffect.addDisposer(boxRatio$.subscribe((boxRatio2) => {
402
- if (boxRatio2 > 0) {
401
+ this._sideEffect.addDisposer(valueEnhancer.combine([boxRatio$, minimized$]).subscribe(([boxRatio2, minimized]) => {
402
+ if (!minimized && boxRatio2 > 0) {
403
403
  this.transform(pxIntrinsicCoord$.value.x, pxIntrinsicCoord$.value.y, pxIntrinsicSize$.value.width, pxIntrinsicSize$.value.height);
404
404
  }
405
405
  }));
@@ -1002,7 +1002,7 @@ var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
1002
1002
  TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
1003
1003
  return TELE_BOX_MANAGER_EVENT2;
1004
1004
  })(TELE_BOX_MANAGER_EVENT || {});
1005
- 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}")();
1005
+ 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}")();
1006
1006
  class MaxTitleBar extends DefaultTitleBar {
1007
1007
  constructor(config) {
1008
1008
  super(config);
@@ -1039,8 +1039,8 @@ class MaxTitleBar extends DefaultTitleBar {
1039
1039
  const $titleBar = super.render();
1040
1040
  $titleBar.classList.add(this.wrapClassName("max-titlebar"));
1041
1041
  this.sideEffect.addDisposer([
1042
- this.state$.subscribe((state) => {
1043
- $titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), state === TELE_BOX_STATE.Maximized);
1042
+ valueEnhancer.combine([this.boxes$, this.state$]).subscribe(([boxes, state]) => {
1043
+ $titleBar.classList.toggle(this.wrapClassName("max-titlebar-active"), state === TELE_BOX_STATE.Maximized && boxes.length > 0);
1044
1044
  }),
1045
1045
  this.readonly$.subscribe((readonly) => {
1046
1046
  $titleBar.classList.toggle(this.wrapClassName("readonly"), readonly);
@@ -1109,7 +1109,7 @@ class TeleBoxManager {
1109
1109
  stageStyle = "",
1110
1110
  defaultBoxBodyStyle = null,
1111
1111
  defaultBoxStageStyle = null,
1112
- theme = {}
1112
+ theme = null
1113
1113
  } = {}) {
1114
1114
  this.events = new Emittery__default["default"]();
1115
1115
  this._sideEffect = new sideEffectManager.SideEffectManager();
@@ -1188,6 +1188,9 @@ class TeleBoxManager {
1188
1188
  }));
1189
1189
  const darkMode$ = valueEnhancer.combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
1190
1190
  const state$ = valueEnhancer.combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
1191
+ const theme$ = new valueEnhancer.Val(theme, {
1192
+ compare: shallowequal__default["default"]
1193
+ });
1191
1194
  const readonlyValConfig = {
1192
1195
  darkMode: darkMode$,
1193
1196
  state: state$,
@@ -1207,7 +1210,8 @@ class TeleBoxManager {
1207
1210
  containerStyle: containerStyle$,
1208
1211
  stageStyle: stageStyle$,
1209
1212
  defaultBoxBodyStyle: defaultBoxBodyStyle$,
1210
- defaultBoxStageStyle: defaultBoxStageStyle$
1213
+ defaultBoxStageStyle: defaultBoxStageStyle$,
1214
+ theme: theme$
1211
1215
  };
1212
1216
  valueEnhancer.withValueEnhancer(this, valConfig, valManager);
1213
1217
  const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
@@ -1259,8 +1263,14 @@ class TeleBoxManager {
1259
1263
  minimized$.subscribe((minimized2) => {
1260
1264
  this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
1261
1265
  }),
1262
- containerStyle$.subscribe((containerStyle2) => {
1266
+ valueEnhancer.combine([containerStyle$, theme$]).subscribe(([containerStyle2, theme2]) => {
1263
1267
  this.$container.style.cssText = containerStyle2;
1268
+ if (theme2) {
1269
+ Object.keys(theme2).forEach((key) => {
1270
+ var _a;
1271
+ this.$container.style.setProperty(`--tele-${key}`, (_a = theme2[key]) != null ? _a : null);
1272
+ });
1273
+ }
1264
1274
  }),
1265
1275
  stageStyle$.subscribe((stageStyle2) => {
1266
1276
  this.$stage.style.cssText = stageStyle2;
@@ -1477,12 +1487,6 @@ class TeleBoxManager {
1477
1487
  }
1478
1488
  return deletedBoxes;
1479
1489
  }
1480
- setTheme(theme) {
1481
- Object.keys(theme).forEach((key) => {
1482
- var _a;
1483
- this.$container.style.setProperty(`--tele-${key}`, (_a = theme[key]) != null ? _a : null);
1484
- });
1485
- }
1486
1490
  mount(root) {
1487
1491
  this._root$.setValue(root);
1488
1492
  }