@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
|
@@ -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
|
@@ -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-
|
|
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
|
|
1043
|
-
$titleBar.classList.toggle(this.wrapClassName("max-titlebar-
|
|
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();
|
|
@@ -1176,8 +1176,13 @@ class TeleBoxManager {
|
|
|
1176
1176
|
const handler = (evt) => {
|
|
1177
1177
|
prefersDark$.setValue(evt.matches);
|
|
1178
1178
|
};
|
|
1179
|
-
prefersDarkMatch.addEventListener
|
|
1180
|
-
|
|
1179
|
+
if (prefersDarkMatch.addEventListener) {
|
|
1180
|
+
prefersDarkMatch.addEventListener("change", handler);
|
|
1181
|
+
return () => prefersDarkMatch.removeEventListener("change", handler);
|
|
1182
|
+
} else {
|
|
1183
|
+
prefersDarkMatch.addListener(handler);
|
|
1184
|
+
return () => prefersDarkMatch.removeListener(handler);
|
|
1185
|
+
}
|
|
1181
1186
|
});
|
|
1182
1187
|
}
|
|
1183
1188
|
const prefersColorScheme$ = new valueEnhancer.Val(prefersColorScheme);
|
|
@@ -1188,6 +1193,9 @@ class TeleBoxManager {
|
|
|
1188
1193
|
}));
|
|
1189
1194
|
const darkMode$ = valueEnhancer.combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
|
|
1190
1195
|
const state$ = valueEnhancer.combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
|
|
1196
|
+
const theme$ = new valueEnhancer.Val(theme, {
|
|
1197
|
+
compare: shallowequal__default["default"]
|
|
1198
|
+
});
|
|
1191
1199
|
const readonlyValConfig = {
|
|
1192
1200
|
darkMode: darkMode$,
|
|
1193
1201
|
state: state$,
|
|
@@ -1207,7 +1215,8 @@ class TeleBoxManager {
|
|
|
1207
1215
|
containerStyle: containerStyle$,
|
|
1208
1216
|
stageStyle: stageStyle$,
|
|
1209
1217
|
defaultBoxBodyStyle: defaultBoxBodyStyle$,
|
|
1210
|
-
defaultBoxStageStyle: defaultBoxStageStyle
|
|
1218
|
+
defaultBoxStageStyle: defaultBoxStageStyle$,
|
|
1219
|
+
theme: theme$
|
|
1211
1220
|
};
|
|
1212
1221
|
valueEnhancer.withValueEnhancer(this, valConfig, valManager);
|
|
1213
1222
|
const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
|
|
@@ -1259,8 +1268,14 @@ class TeleBoxManager {
|
|
|
1259
1268
|
minimized$.subscribe((minimized2) => {
|
|
1260
1269
|
this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
|
|
1261
1270
|
}),
|
|
1262
|
-
containerStyle
|
|
1271
|
+
valueEnhancer.combine([containerStyle$, theme$]).subscribe(([containerStyle2, theme2]) => {
|
|
1263
1272
|
this.$container.style.cssText = containerStyle2;
|
|
1273
|
+
if (theme2) {
|
|
1274
|
+
Object.keys(theme2).forEach((key) => {
|
|
1275
|
+
var _a;
|
|
1276
|
+
this.$container.style.setProperty(`--tele-${key}`, (_a = theme2[key]) != null ? _a : null);
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1264
1279
|
}),
|
|
1265
1280
|
stageStyle$.subscribe((stageStyle2) => {
|
|
1266
1281
|
this.$stage.style.cssText = stageStyle2;
|
|
@@ -1477,12 +1492,6 @@ class TeleBoxManager {
|
|
|
1477
1492
|
}
|
|
1478
1493
|
return deletedBoxes;
|
|
1479
1494
|
}
|
|
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
1495
|
mount(root) {
|
|
1487
1496
|
this._root$.setValue(root);
|
|
1488
1497
|
}
|