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

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.
Files changed (38) hide show
  1. package/dist/TeleBox/index.d.ts +62 -38
  2. package/dist/TeleBox/typings.d.ts +28 -16
  3. package/dist/TeleBox/utils.d.ts +5 -0
  4. package/dist/TeleBoxCollector/index.d.ts +7 -8
  5. package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +1 -1
  6. package/dist/TeleBoxManager/index.d.ts +15 -5
  7. package/dist/TeleBoxManager/typings.d.ts +50 -6
  8. package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +4 -12
  9. package/dist/TeleTitleBar/typings.d.ts +2 -2
  10. package/dist/index.d.ts +0 -1
  11. package/dist/style.css +650 -1
  12. package/dist/telebox-insider.cjs.js +1659 -1
  13. package/dist/telebox-insider.cjs.js.map +1 -1
  14. package/dist/telebox-insider.es.js +1641 -1
  15. package/dist/telebox-insider.es.js.map +1 -1
  16. package/dist/utils.d.ts +0 -1
  17. package/package.json +67 -67
  18. package/src/TeleBox/index.ts +443 -300
  19. package/src/TeleBox/style.scss +13 -25
  20. package/src/TeleBox/style.shadow.scss +77 -0
  21. package/src/TeleBox/typings.ts +28 -16
  22. package/src/TeleBox/utils.ts +32 -0
  23. package/src/TeleBoxCollector/index.ts +41 -38
  24. package/src/TeleBoxCollector/style.scss +6 -4
  25. package/src/TeleBoxManager/MaxTitleBar/index.ts +3 -28
  26. package/src/TeleBoxManager/MaxTitleBar/style.scss +18 -16
  27. package/src/TeleBoxManager/index.ts +187 -80
  28. package/src/TeleBoxManager/style.scss +55 -0
  29. package/src/TeleBoxManager/typings.ts +69 -7
  30. package/src/TeleTitleBar/DefaultTitleBar/index.ts +47 -61
  31. package/src/TeleTitleBar/DefaultTitleBar/style.scss +30 -10
  32. package/src/TeleTitleBar/typings.ts +2 -2
  33. package/src/index.ts +0 -2
  34. package/src/scss/variables.scss +72 -0
  35. package/src/utils.ts +0 -6
  36. package/dist/TeleStage/index.d.ts +0 -21
  37. package/src/TeleStage/index.ts +0 -178
  38. package/src/TeleStage/style.scss +0 -49
@@ -13,22 +13,33 @@ declare type ValConfig = {
13
13
  visible: Val<RequiredTeleBoxConfig["visible"], boolean>;
14
14
  resizable: Val<RequiredTeleBoxConfig["resizable"], boolean>;
15
15
  draggable: Val<RequiredTeleBoxConfig["draggable"], boolean>;
16
- ratio: Val<RequiredTeleBoxConfig["ratio"], boolean>;
16
+ boxRatio: Val<RequiredTeleBoxConfig["boxRatio"], boolean>;
17
+ boxMinimized: Val<boolean | null, boolean>;
18
+ boxMaximized: Val<boolean | null, boolean>;
19
+ boxReadonly: Val<boolean | null, boolean>;
20
+ stageRatio: Val<RequiredTeleBoxConfig["stageRatio"], boolean>;
21
+ stageStyle: Val<RequiredTeleBoxConfig["stageStyle"], boolean>;
22
+ bodyStyle: Val<RequiredTeleBoxConfig["bodyStyle"], boolean>;
17
23
  };
18
- declare type ReadonlyValConfig = {
24
+ declare type PropsValConfig = {
19
25
  darkMode: RequiredTeleBoxConfig["darkMode$"];
20
26
  fence: RequiredTeleBoxConfig["fence$"];
21
- minimized: RequiredTeleBoxConfig["minimized$"];
22
- maximized: RequiredTeleBoxConfig["maximized$"];
23
- readonly: RequiredTeleBoxConfig["readonly$"];
24
27
  rootRect: RequiredTeleBoxConfig["rootRect$"];
28
+ managerMinimized: RequiredTeleBoxConfig["managerMinimized$"];
29
+ managerMaximized: RequiredTeleBoxConfig["managerMaximized$"];
30
+ managerReadonly: RequiredTeleBoxConfig["managerReadonly$"];
25
31
  managerStageRect: RequiredTeleBoxConfig["managerStageRect$"];
32
+ managerStageRatio: RequiredTeleBoxConfig["managerStageRatio$"];
33
+ defaultBoxStageStyle: RequiredTeleBoxConfig["defaultBoxStageStyle$"];
34
+ defaultBoxBodyStyle: RequiredTeleBoxConfig["defaultBoxBodyStyle$"];
26
35
  collectorRect: RequiredTeleBoxConfig["collectorRect$"];
36
+ };
37
+ declare type MyReadonlyValConfig = {
27
38
  zIndex: Val<RequiredTeleBoxConfig["zIndex"], boolean>;
28
39
  focus: Val<RequiredTeleBoxConfig["focus"], boolean>;
29
- $userContent: Val<TeleBoxConfig["content"], boolean>;
30
- $userFooter: Val<TeleBoxConfig["footer"], boolean>;
31
- $userStyles: Val<TeleBoxConfig["styles"], boolean>;
40
+ minimized: ReadonlyVal<boolean, boolean>;
41
+ maximized: ReadonlyVal<boolean, boolean>;
42
+ readonly: ReadonlyVal<boolean, boolean>;
32
43
  minSize: Val<TeleBoxSize, boolean>;
33
44
  intrinsicSize: Val<TeleBoxSize, boolean>;
34
45
  intrinsicCoord: Val<TeleBoxCoord, boolean>;
@@ -36,19 +47,19 @@ declare type ReadonlyValConfig = {
36
47
  pxIntrinsicSize: ReadonlyVal<TeleBoxSize, boolean>;
37
48
  pxIntrinsicCoord: ReadonlyVal<TeleBoxCoord, boolean>;
38
49
  state: ReadonlyVal<TeleBoxState, boolean>;
39
- highlightStage: ReadonlyVal<boolean, boolean>;
40
- boxHighlightStage: Val<boolean | null, boolean>;
41
- contentRect: Val<TeleBoxRect>;
42
- contentStageRect: ReadonlyVal<TeleBoxRect | null>;
50
+ bodyRect: Val<TeleBoxRect>;
51
+ stageRect: ReadonlyVal<TeleBoxRect>;
43
52
  };
44
- declare type CombinedValEnhancedResult = ReadonlyValEnhancedResult<ReadonlyValConfig> & ValEnhancedResult<ValConfig>;
53
+ declare type CombinedValEnhancedResult = ReadonlyValEnhancedResult<PropsValConfig & MyReadonlyValConfig> & ValEnhancedResult<ValConfig>;
45
54
  export interface TeleBox extends CombinedValEnhancedResult {
46
55
  }
47
56
  export declare class TeleBox {
48
- constructor({ id, title, namespace, visible, width, height, minWidth, minHeight, x, y, resizable, draggable, ratio, focus, zIndex, titleBar, content, footer, styles, highlightStage, darkMode$, fence$, minimized$, maximized$, readonly$, root$, rootRect$, managerStageRect$, stageRatio$, collectorRect$, managerHighlightStage$, }: TeleBoxConfig);
57
+ constructor({ id, title, namespace, visible, width, height, minWidth, minHeight, x, y, resizable, draggable, boxRatio, focus, zIndex, stageRatio, enableShadowDOM, titleBar, content, stage, footer, styles, userStyles, bodyStyle, stageStyle, darkMode$, fence$, root, rootRect$, managerMinimized$, managerMaximized$, managerReadonly$, managerStageRect$, managerStageRatio$, defaultBoxBodyStyle$, defaultBoxStageStyle$, collectorRect$, }: TeleBoxConfig);
49
58
  readonly id: string;
50
59
  /** ClassName Prefix. For CSS styling. Default "telebox" */
51
60
  readonly namespace: string;
61
+ /** Enable shadow DOM for box content. Default true. */
62
+ readonly enableShadowDOM: boolean;
52
63
  readonly events: Emittery<{
53
64
  dark_mode: boolean;
54
65
  prefers_color_scheme: "light" | "dark" | "auto";
@@ -149,39 +160,52 @@ export declare class TeleBox {
149
160
  * @returns this
150
161
  */
151
162
  protected transform(x: number, y: number, width: number, height: number, skipUpdate?: boolean): void;
152
- /**
153
- * Mount dom to box content.
154
- */
163
+ private $authorContent?;
164
+ /** Mount dom to box content. */
155
165
  mountContent(content: HTMLElement): void;
156
- /**
157
- * Unmount content from the box.
158
- */
166
+ /** Unmount content from the box. */
159
167
  unmountContent(): void;
160
- /**
161
- * Mount dom to box Footer.
162
- */
168
+ private $authorStage?;
169
+ /** Mount dom to box stage. */
170
+ mountStage(stage: HTMLElement): void;
171
+ /** Unmount content from the box. */
172
+ unmountStage(): void;
173
+ private $authorFooter?;
174
+ /** Mount dom to box Footer. */
163
175
  mountFooter(footer: HTMLElement): void;
164
- /**
165
- * Unmount Footer from the box.
166
- */
176
+ /** Unmount Footer from the box. */
167
177
  unmountFooter(): void;
168
- getUserStyles(): HTMLStyleElement | undefined;
169
- mountStyles(styles: string | HTMLStyleElement): void;
178
+ /** Mount styles for box content */
179
+ mountStyles(styles: string): void;
180
+ /** Umount styles for box content */
170
181
  unmountStyles(): void;
171
- /** Show stage frame and grey-out the non-stage area. Inherit setting from manager if null. */
172
- setHighlightStage(highlightStage: boolean | null): void;
182
+ /** Mount user styles for box content */
183
+ mountUserStyles(styles: string): void;
184
+ /** Umount user styles for box content */
185
+ unmountUserStyles(): void;
173
186
  /** DOM of the box */
174
187
  $box: HTMLElement;
175
- /** DOM of the box content */
188
+ /** DOM of main area of the box. Including $body and $footer. */
189
+ $main: HTMLElement;
190
+ /** DOM of the box body */
191
+ $body: HTMLElement;
192
+ /** DOM of the box content container inside box body */
176
193
  $content: HTMLElement;
177
- /** DOM of the box title bar */
194
+ /** DOM of the box stage area inside box body */
195
+ $stage?: HTMLElement;
196
+ /** DOM of custom box content styles */
197
+ $styles: HTMLStyleElement;
198
+ /** DOM of end user custom box content styles */
199
+ $userStyles: HTMLStyleElement;
200
+ /** DOM of the box title bar container */
178
201
  $titleBar: HTMLElement;
179
- /** DOM of the box footer */
202
+ /** DOM of the box footer container */
180
203
  $footer: HTMLElement;
181
- protected render(): HTMLElement;
182
- protected _handleTrackStart?: (ev: MouseEvent | TouchEvent) => void;
183
- handleTrackStart: (ev: MouseEvent | TouchEvent) => void;
184
- protected _renderResizeHandlers(): void;
204
+ private _render;
205
+ private _renderStage;
206
+ private _handleTrackStart?;
207
+ handleTrackStart: (ev: PointerEvent) => void;
208
+ private _renderResizeHandlers;
185
209
  destroy(): Promise<void>;
186
210
  /**
187
211
  * Wrap a className with namespace
@@ -189,4 +213,4 @@ export declare class TeleBox {
189
213
  wrapClassName(className: string): string;
190
214
  }
191
215
  declare type PropKeys<K = keyof TeleBox> = K extends keyof TeleBox ? TeleBox[K] extends Function ? never : K : never;
192
- export declare type ReadonlyTeleBox = Pick<TeleBox, PropKeys | "wrapClassName" | "mountContent" | "mountFooter" | "mountStyles" | "handleTrackStart">;
216
+ export declare type ReadonlyTeleBox = Pick<TeleBox, PropKeys | "wrapClassName" | "mountContent" | "unmountContent" | "mountFooter" | "unmountFooter" | "mountStage" | "unmountStage" | "mountStyles" | "unmountStyles" | "setTitle" | "setDraggable" | "setResizable" | "setVisible" | "setBoxRatio" | "setStageRatio" | "setStageStyle" | "setBodyStyle" | "handleTrackStart" | "onValChanged">;
@@ -44,45 +44,57 @@ export interface TeleBoxConfig {
44
44
  /** Able to drag box window Default true. */
45
45
  readonly draggable?: boolean;
46
46
  /** Fixed height/width ratio for box window. No ratio limit if <= 0. Default -1. */
47
- readonly ratio?: number;
47
+ readonly boxRatio?: number;
48
48
  /** Box focused. */
49
49
  readonly focus?: boolean;
50
50
  /** Base z-index for box. */
51
51
  readonly zIndex?: number;
52
+ /** Box content stage ratio. Follow manager stage ratio if null. Default null. */
53
+ readonly stageRatio?: number | null;
52
54
  /** Classname Prefix. For CSS styling. Default "telebox". */
53
55
  readonly namespace?: string;
56
+ /** Enable shadow DOM for box content. Default true. */
57
+ readonly enableShadowDOM?: boolean;
54
58
  /** TeleTitleBar Instance. */
55
59
  readonly titleBar?: TeleTitleBar;
56
- /** Box content. */
60
+ /** Box content element. */
57
61
  readonly content?: HTMLElement;
58
- /** Box footer. */
62
+ /** Stage element. */
63
+ readonly stage?: HTMLElement;
64
+ /** Box footer element. */
59
65
  readonly footer?: HTMLElement;
60
66
  /** Box content styles. */
61
- readonly styles?: HTMLStyleElement;
62
- /** Show stage frame and grey-out the non-stage area. Inherit setting from manager if null. Default null. */
63
- readonly highlightStage?: boolean | null;
67
+ readonly styles?: string;
68
+ /** Box content styles from end users. */
69
+ readonly userStyles?: string;
70
+ /** Custom styles for box content container. Inherit from manager container style if null. Default null. */
71
+ readonly bodyStyle?: string | null;
72
+ /** Custom styles for box content stage. Inherit from manager stage style if null. Default null. */
73
+ readonly stageStyle?: string | null;
64
74
  /** Actual Box Dark Mode */
65
75
  readonly darkMode$: ReadonlyVal<boolean, boolean>;
66
76
  /** Restrict box to always be within the stage area. Default false. */
67
77
  readonly fence$: ReadonlyVal<boolean, boolean>;
68
- /** Maximize box. Default false. */
69
- readonly maximized$: ReadonlyVal<boolean, boolean>;
70
- /** Minimize box. Overwrites maximized state. Default false. */
71
- readonly minimized$: ReadonlyVal<boolean, boolean>;
72
- /** Is box readonly */
73
- readonly readonly$: ReadonlyVal<boolean, boolean>;
74
78
  /** Root element to mount boxes */
75
- readonly root$: ReadonlyVal<HTMLElement | null>;
79
+ readonly root: HTMLElement;
76
80
  /** Position and dimension of root element */
77
81
  readonly rootRect$: ReadonlyVal<TeleBoxRect>;
82
+ /** Maximize state from manager. Default false. */
83
+ readonly managerMaximized$: ReadonlyVal<boolean, boolean>;
84
+ /** Minimize state from manager. Overwrites maximized state. Default false. */
85
+ readonly managerMinimized$: ReadonlyVal<boolean, boolean>;
86
+ /** Manager readonly state. */
87
+ readonly managerReadonly$: ReadonlyVal<boolean, boolean>;
78
88
  /** Position and dimension of stage area */
79
89
  readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
80
90
  /** Stage area height/with ratio. No ratio if <= 0. */
81
- readonly stageRatio$: ReadonlyVal<number, boolean>;
91
+ readonly managerStageRatio$: ReadonlyVal<number, boolean>;
92
+ /** Default content styles for all boxes */
93
+ readonly defaultBoxBodyStyle$: ReadonlyVal<string | null>;
94
+ /** Default stage styles for all boxes */
95
+ readonly defaultBoxStageStyle$: ReadonlyVal<string | null>;
82
96
  /** Position and dimension of collector */
83
97
  readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
84
- /** highlight stage settings from manager */
85
- readonly managerHighlightStage$: ReadonlyVal<boolean>;
86
98
  }
87
99
  declare type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
88
100
  export declare type TeleBoxEventConfig = CheckTeleBoxConfig<{
@@ -0,0 +1,5 @@
1
+ import type { TeleBoxRect } from "./typings";
2
+ export declare function calcStageRect([rootRect, ratio]: [
3
+ TeleBoxRect,
4
+ number
5
+ ]): TeleBoxRect;
@@ -7,26 +7,25 @@ import type { TeleBoxRect } from "../TeleBox/typings";
7
7
  export interface TeleBoxCollectorConfig {
8
8
  namespace?: string;
9
9
  styles?: TeleStyles;
10
- root$: ReadonlyVal<HTMLElement | null>;
11
- minimized$: Val<boolean>;
10
+ root: HTMLElement;
11
+ minimized$: ReadonlyVal<boolean>;
12
12
  readonly$: ReadonlyVal<boolean>;
13
13
  darkMode$: ReadonlyVal<boolean>;
14
- rootRect$: ReadonlyVal<TeleBoxRect>;
14
+ onClick?: () => void;
15
15
  }
16
16
  declare type ValConfig = {
17
17
  styles: Val<TeleStyles>;
18
- el: Val<HTMLElement>;
18
+ $collector: Val<HTMLElement>;
19
19
  };
20
- declare type ReadonlyValConfig = {
20
+ declare type MyReadonlyValConfig = {
21
21
  rect: ReadonlyVal<TeleBoxRect | undefined>;
22
22
  visible: ReadonlyVal<boolean>;
23
- root: ReadonlyVal<HTMLElement | null>;
24
23
  };
25
- declare type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> & ReadonlyValEnhancedResult<ReadonlyValConfig>;
24
+ declare type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> & ReadonlyValEnhancedResult<MyReadonlyValConfig>;
26
25
  export interface TeleBoxCollector extends CombinedValEnhancedResult {
27
26
  }
28
27
  export declare class TeleBoxCollector {
29
- constructor({ minimized$, readonly$, darkMode$, rootRect$, namespace, styles, root$, }: TeleBoxCollectorConfig);
28
+ constructor({ minimized$, readonly$, darkMode$, namespace, styles, root, onClick, }: TeleBoxCollectorConfig);
30
29
  readonly namespace: string;
31
30
  protected readonly _sideEffect: SideEffectManager;
32
31
  destroy(): void;
@@ -9,7 +9,7 @@ export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
9
9
  darkMode$: ReadonlyVal<boolean>;
10
10
  boxes$: ReadonlyVal<TeleBox[]>;
11
11
  rootRect$: ReadonlyVal<TeleBoxRect>;
12
- root$: ReadonlyVal<HTMLElement | null>;
12
+ root: HTMLElement;
13
13
  }
14
14
  export declare class MaxTitleBar extends DefaultTitleBar {
15
15
  constructor(config: MaxTitleBarConfig);
@@ -1,3 +1,4 @@
1
+ import "./style.scss";
1
2
  import { SideEffectManager } from "side-effect-manager";
2
3
  import type { ReadonlyVal, ValEnhancedResult, ReadonlyValEnhancedResult } from "value-enhancer";
3
4
  import { Val } from "value-enhancer";
@@ -5,7 +6,7 @@ import Emittery from "emittery";
5
6
  import type { ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxState } from "../TeleBox";
6
7
  import { TeleBox } from "../TeleBox";
7
8
  import { TeleBoxCollector } from "../TeleBoxCollector";
8
- import type { TeleBoxManagerConfig, TeleBoxManagerCreateConfig, TeleBoxManagerQueryConfig, TeleBoxManagerUpdateConfig } from "./typings";
9
+ import type { TeleBoxManagerConfig, TeleBoxManagerCreateConfig, TeleBoxFullscreen, TeleBoxManagerQueryConfig, TeleBoxManagerThemeConfig, TeleBoxManagerUpdateConfig } from "./typings";
9
10
  import { MaxTitleBar } from "./MaxTitleBar";
10
11
  export * from "./typings";
11
12
  export * from "./constants";
@@ -15,21 +16,27 @@ declare type ReadonlyValConfig = {
15
16
  root: Val<HTMLElement | null>;
16
17
  rootRect: Val<TeleBoxRect>;
17
18
  stageRect: ReadonlyVal<TeleBoxRect>;
19
+ minimized: ReadonlyVal<boolean, boolean>;
20
+ maximized: ReadonlyVal<boolean, boolean>;
18
21
  };
19
22
  declare type ValConfig = {
23
+ fullscreen: Val<TeleBoxFullscreen>;
20
24
  prefersColorScheme: Val<TeleBoxColorScheme, boolean>;
21
25
  readonly: Val<boolean, boolean>;
22
- minimized: Val<boolean, boolean>;
23
- maximized: Val<boolean, boolean>;
24
26
  fence: Val<boolean, boolean>;
25
27
  stageRatio: Val<number, boolean>;
26
- highlightStage: Val<boolean, boolean>;
28
+ containerStyle: Val<string>;
29
+ stageStyle: Val<string>;
30
+ defaultBoxBodyStyle: Val<string | null>;
31
+ defaultBoxStageStyle: Val<string | null>;
27
32
  };
28
33
  declare type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> & ReadonlyValEnhancedResult<ReadonlyValConfig>;
29
34
  export interface TeleBoxManager extends CombinedValEnhancedResult {
30
35
  }
31
36
  export declare class TeleBoxManager {
32
- constructor({ root, prefersColorScheme, minimized, maximized, fence, collector, namespace, readonly, stageRatio, highlightStage, }?: TeleBoxManagerConfig);
37
+ constructor({ root, fullscreen, prefersColorScheme, minimized, maximized, fence, collector, namespace, readonly, stageRatio, containerStyle, stageStyle, defaultBoxBodyStyle, defaultBoxStageStyle, theme, }?: TeleBoxManagerConfig);
38
+ readonly $container: HTMLDivElement;
39
+ readonly $stage: HTMLDivElement;
33
40
  get boxes(): ReadonlyArray<TeleBox>;
34
41
  get topBox(): TeleBox | undefined;
35
42
  readonly events: Emittery<{
@@ -67,6 +74,8 @@ export declare class TeleBoxManager {
67
74
  }, never>;
68
75
  protected _sideEffect: SideEffectManager;
69
76
  readonly namespace: string;
77
+ setMinimized: (minimized: boolean, skipUpdate?: boolean) => void;
78
+ setMaximized: (maximized: boolean, skipUpdate?: boolean) => void;
70
79
  /** @deprecated use setMaximized and setMinimized instead */
71
80
  setState(state: TeleBoxState, skipUpdate?: boolean): this;
72
81
  create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
@@ -77,6 +86,7 @@ export declare class TeleBoxManager {
77
86
  remove(boxOrID: string | TeleBox, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
78
87
  removeTopBox(): ReadonlyTeleBox | undefined;
79
88
  removeAll(skipUpdate?: boolean): ReadonlyTeleBox[];
89
+ setTheme(theme: TeleBoxManagerThemeConfig): void;
80
90
  /**
81
91
  * Mount manager to a container element.
82
92
  */
@@ -6,6 +6,8 @@ import type { TELE_BOX_MANAGER_EVENT } from "./constants";
6
6
  export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "namespace"> {
7
7
  /** Element to mount boxes. */
8
8
  readonly root?: HTMLElement | null;
9
+ /** Fullscreen mode. Default false. */
10
+ readonly fullscreen?: TeleBoxFullscreen;
9
11
  /** Stage area height/with ratio. No ratio if <= 0. Default -1. */
10
12
  readonly stageRatio?: number;
11
13
  /** Where the minimized boxes go. */
@@ -20,13 +22,21 @@ export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "namespace"> {
20
22
  readonly minimized?: boolean;
21
23
  /** Is box readonly */
22
24
  readonly readonly?: boolean;
23
- /** Show stage frame and grey-out the non-stage area. Default true. */
24
- readonly highlightStage?: boolean;
25
+ /** Custom styles for telebox manager container */
26
+ readonly containerStyle?: string;
27
+ /** Custom styles for telebox manager stage */
28
+ readonly stageStyle?: string;
29
+ /** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
30
+ readonly defaultBoxBodyStyle?: string | null;
31
+ /** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
32
+ readonly defaultBoxStageStyle?: string | null;
33
+ /** Theme variable */
34
+ readonly theme?: TeleBoxManagerThemeConfig;
25
35
  }
26
- declare type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "ratio" | "zIndex";
27
- export declare type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus">;
28
- export declare type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, "title" | "visible" | "resizable" | "draggable" | "ratio" | "zIndex" | "id" | "focus">;
29
- export declare type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer">;
36
+ declare type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "boxRatio" | "zIndex" | "stageRatio";
37
+ export declare type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "stage" | "footer" | "styles" | "bodyStyle" | "stageStyle" | "id" | "focus" | "enableShadowDOM">;
38
+ export declare type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, "title" | "visible" | "resizable" | "draggable" | "boxRatio" | "stageRatio" | "zIndex" | "id" | "focus">;
39
+ export declare type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "stage" | "footer">;
30
40
  declare type CheckTeleBoxManagerConfig<T extends Record<`${TELE_BOX_MANAGER_EVENT}`, any>> = T;
31
41
  export declare type TeleBoxManagerEventConfig = CheckTeleBoxManagerConfig<{
32
42
  focused: ReadonlyTeleBox | undefined;
@@ -46,4 +56,38 @@ export declare type TeleBoxManagerEventConfig = CheckTeleBoxManagerConfig<{
46
56
  dark_mode: boolean;
47
57
  }>;
48
58
  export declare type TeleBoxManagerEvent = keyof TeleBoxManagerEventConfig;
59
+ /**
60
+ * Fullscreen mode.
61
+ * - `true`: fullscreen mode. hide titlebar for single tab.
62
+ * - `false`: normal mode.
63
+ * - `"no-titlebar"`: always hide titlebar
64
+ * - `"always-titlebar"`: always show titlebar
65
+ */
66
+ export declare type TeleBoxFullscreen = boolean | "no-titlebar" | "always-titlebar";
67
+ export declare type TeleBoxManagerThemeConfig = {
68
+ managerContainerBackground?: string | null;
69
+ managerStageBackground?: string | null;
70
+ managerStageShadow?: string | null;
71
+ boxContainerBackground?: string | null;
72
+ boxStageBackground?: string | null;
73
+ boxStageShadow?: string | null;
74
+ boxColor?: string | null;
75
+ boxBorder?: string | null;
76
+ boxShadow?: string | null;
77
+ boxFooterColor?: string | null;
78
+ boxFooterBackground?: string | null;
79
+ titlebarColor?: string | null;
80
+ titlebarBackground?: string | null;
81
+ titlebarBorderBottom?: string | null;
82
+ titlebarTabColor?: string | null;
83
+ titlebarTabFocusColor?: string | null;
84
+ titlebarTabBackground?: string | null;
85
+ titlebarTabDividerColor?: string | null;
86
+ collectorBackground?: string | null;
87
+ collectorShadow?: string | null;
88
+ titlebarIconMinimize?: string | null;
89
+ titlebarIconMaximize?: string | null;
90
+ titlebarIconMaximizeActive?: string | null;
91
+ titlebarIconClose?: string | null;
92
+ };
49
93
  export {};
@@ -2,7 +2,7 @@ import "./style.scss";
2
2
  import { SideEffectManager } from "side-effect-manager";
3
3
  import type { TeleBoxState } from "../../TeleBox/typings";
4
4
  import type { TeleTitleBar, TeleTitleBarConfig, TeleTitleBarEvent } from "../typings";
5
- import { Val } from "value-enhancer";
5
+ import type { ReadonlyVal } from "value-enhancer";
6
6
  export declare type DefaultTitleBarButton = TeleTitleBarEvent & {
7
7
  readonly iconClassName: string;
8
8
  readonly isActive?: (state: TeleBoxState) => boolean;
@@ -11,12 +11,10 @@ export interface DefaultTitleBarConfig extends TeleTitleBarConfig {
11
11
  buttons?: ReadonlyArray<DefaultTitleBarButton>;
12
12
  }
13
13
  export declare class DefaultTitleBar implements TeleTitleBar {
14
- constructor({ readonly$, state$, title, buttons, onEvent, onDragStart, namespace, }: DefaultTitleBarConfig);
14
+ constructor({ readonly$, state$, title$, buttons, onEvent, onDragStart, namespace, }: DefaultTitleBarConfig);
15
15
  readonly namespace: string;
16
16
  $titleBar: HTMLElement | undefined;
17
17
  $dragArea: HTMLElement;
18
- get title(): string;
19
- setTitle(title: string): void;
20
18
  render(): HTMLElement;
21
19
  renderDragArea(): HTMLElement;
22
20
  dragHandle(): HTMLElement | undefined;
@@ -25,7 +23,7 @@ export declare class DefaultTitleBar implements TeleTitleBar {
25
23
  onEvent?: TeleTitleBarConfig["onEvent"];
26
24
  onDragStart?: TeleTitleBarConfig["onDragStart"];
27
25
  protected readonly$: TeleTitleBarConfig["readonly$"];
28
- protected title$: Val<string>;
26
+ protected title$: ReadonlyVal<string>;
29
27
  protected buttons: ReadonlyArray<DefaultTitleBarButton>;
30
28
  protected state$: TeleTitleBarConfig["state$"];
31
29
  protected sideEffect: SideEffectManager;
@@ -34,11 +32,5 @@ export declare class DefaultTitleBar implements TeleTitleBar {
34
32
  clientX: number;
35
33
  clientY: number;
36
34
  };
37
- protected handleTitleBarClick: (ev: MouseEvent) => void;
38
- protected lastTitleBarTouch: {
39
- timestamp: number;
40
- clientX: number;
41
- clientY: number;
42
- };
43
- protected handleTitleBarTouch: (ev: TouchEvent) => void;
35
+ protected handleTitleBarClick: (ev: PointerEvent) => void;
44
36
  }
@@ -9,11 +9,11 @@ export declare type TeleTitleBarEvent<U = keyof TeleBoxDelegateEventConfig> = U
9
9
  } : never;
10
10
  export interface TeleTitleBarConfig {
11
11
  readonly$: ReadonlyVal<boolean, boolean>;
12
- title?: string;
12
+ title$: ReadonlyVal<string, boolean>;
13
13
  state$: ReadonlyVal<TeleBoxState, boolean>;
14
14
  namespace?: string;
15
15
  onEvent?: (event: TeleTitleBarEvent) => void;
16
- onDragStart?: (event: MouseEvent | TouchEvent) => void;
16
+ onDragStart?: (event: PointerEvent) => void;
17
17
  }
18
18
  export interface TeleTitleBar {
19
19
  render(): HTMLElement;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "./scss/fancy-scrollbar.scss";
2
1
  export * from "./TeleBox";
3
2
  export * from "./TeleTitleBar";
4
3
  export * from "./TeleBoxManager";