@netless/telebox-insider 0.2.26 → 1.0.0-alpha.1
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/TeleBox/constants.d.ts +0 -3
- package/dist/TeleBox/index.d.ts +120 -91
- package/dist/TeleBox/typings.d.ts +40 -55
- package/dist/TeleBoxCollector/index.d.ts +25 -29
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +13 -18
- package/dist/TeleBoxManager/constants.d.ts +0 -3
- package/dist/TeleBoxManager/index.d.ts +55 -18
- package/dist/TeleBoxManager/typings.d.ts +35 -28
- package/dist/TeleStage/index.d.ts +25 -0
- package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +6 -8
- package/dist/TeleTitleBar/typings.d.ts +3 -5
- package/dist/index.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/telebox-insider.cjs.js +2 -2
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +2 -2
- package/dist/telebox-insider.es.js.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/package.json +6 -19
- package/src/TeleBox/constants.ts +0 -3
- package/src/TeleBox/index.ts +496 -678
- package/src/TeleBox/style.scss +1 -0
- package/src/TeleBox/typings.ts +40 -75
- package/src/TeleBoxCollector/index.ts +137 -159
- package/src/TeleBoxManager/MaxTitleBar/index.ts +82 -110
- package/src/TeleBoxManager/constants.ts +0 -3
- package/src/TeleBoxManager/index.ts +300 -326
- package/src/TeleBoxManager/typings.ts +42 -52
- package/src/TeleStage/index.ts +189 -0
- package/src/TeleStage/style.scss +49 -0
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +48 -61
- package/src/TeleTitleBar/typings.ts +3 -9
- package/src/index.ts +0 -1
- package/src/utils.ts +0 -6
- package/dist/TeleBoxCollector/TeleBoxCollector.stories.d.ts +0 -5
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBar.stories.d.ts +0 -7
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBarReact.d.ts +0 -4
- package/dist/TeleBoxReact/TeleBox.stories.d.ts +0 -9
- package/dist/TeleBoxReact/index.d.ts +0 -17
- package/dist/TeleBoxReact/utils.d.ts +0 -2
- package/dist/TeleTitleBar/DefaultTitleBar/DefaultTitleBar.stories.d.ts +0 -4
- package/src/TeleBoxCollector/TeleBoxCollector.stories.tsx +0 -23
- package/src/TeleBoxManager/MaxTitleBar/MaxTitleBar.stories.tsx +0 -66
- package/src/TeleBoxManager/MaxTitleBar/MaxTitleBarReact.tsx +0 -34
- package/src/TeleBoxReact/TeleBox.stories.tsx +0 -74
- package/src/TeleBoxReact/index.tsx +0 -175
- package/src/TeleBoxReact/utils.ts +0 -14
- package/src/TeleTitleBar/DefaultTitleBar/DefaultTitleBar.stories.tsx +0 -15
|
@@ -14,11 +14,8 @@ export declare enum TELE_BOX_EVENT {
|
|
|
14
14
|
Close = "close",
|
|
15
15
|
Focus = "focus",
|
|
16
16
|
Blur = "blur",
|
|
17
|
-
Move = "move",
|
|
18
|
-
Resize = "resize",
|
|
19
17
|
IntrinsicMove = "intrinsic_move",
|
|
20
18
|
IntrinsicResize = "intrinsic_resize",
|
|
21
|
-
VisualResize = "visual_resize",
|
|
22
19
|
ZIndex = "z_index",
|
|
23
20
|
State = "state",
|
|
24
21
|
Minimized = "minimized",
|
package/dist/TeleBox/index.d.ts
CHANGED
|
@@ -1,80 +1,120 @@
|
|
|
1
1
|
import "./style.scss";
|
|
2
|
+
import Emittery from "emittery";
|
|
2
3
|
import { SideEffectManager } from "side-effect-manager";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
4
|
+
import type { ReadonlyVal, ReadonlyValEnhancedResult, ValEnhancedResult } from "value-enhancer";
|
|
5
|
+
import { Val } from "value-enhancer";
|
|
6
|
+
import type { TeleTitleBar } from "../TeleTitleBar";
|
|
7
|
+
import type { TeleBoxConfig, TeleBoxState, TeleBoxCoord, TeleBoxSize, TeleBoxRect } from "./typings";
|
|
6
8
|
export * from "./constants";
|
|
7
9
|
export * from "./typings";
|
|
10
|
+
declare type RequiredTeleBoxConfig = Required<TeleBoxConfig>;
|
|
8
11
|
declare type ValConfig = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
title: Val<string, boolean>;
|
|
15
|
-
/** Is box visible */
|
|
16
|
-
visible: Val<boolean, boolean>;
|
|
17
|
-
/** Is box readonly */
|
|
18
|
-
readonly: Val<boolean, boolean>;
|
|
19
|
-
/** Able to resize box window */
|
|
20
|
-
resizable: Val<boolean, boolean>;
|
|
21
|
-
/** Able to drag box window */
|
|
22
|
-
draggable: Val<boolean, boolean>;
|
|
23
|
-
/** Restrict box to always be within the containing area. */
|
|
24
|
-
fence: Val<boolean, boolean>;
|
|
25
|
-
/** Fixed width/height ratio for box window. */
|
|
26
|
-
fixRatio: Val<boolean, boolean>;
|
|
27
|
-
focus: Val<boolean, boolean>;
|
|
28
|
-
zIndex: Val<number, boolean>;
|
|
29
|
-
/** Is box minimized. Default false. */
|
|
30
|
-
minimized: Val<boolean, boolean>;
|
|
31
|
-
/** Is box maximized. Default false. */
|
|
32
|
-
maximized: Val<boolean, boolean>;
|
|
33
|
-
$userContent: Val<HTMLElement | undefined>;
|
|
34
|
-
$userFooter: Val<HTMLElement | undefined>;
|
|
35
|
-
$userStyles: Val<HTMLStyleElement | undefined>;
|
|
12
|
+
title: Val<RequiredTeleBoxConfig["title"], boolean>;
|
|
13
|
+
visible: Val<RequiredTeleBoxConfig["visible"], boolean>;
|
|
14
|
+
resizable: Val<RequiredTeleBoxConfig["resizable"], boolean>;
|
|
15
|
+
draggable: Val<RequiredTeleBoxConfig["draggable"], boolean>;
|
|
16
|
+
ratio: Val<RequiredTeleBoxConfig["ratio"], boolean>;
|
|
36
17
|
};
|
|
37
|
-
|
|
18
|
+
declare type ReadonlyValConfig = {
|
|
19
|
+
darkMode: RequiredTeleBoxConfig["darkMode$"];
|
|
20
|
+
fence: RequiredTeleBoxConfig["fence$"];
|
|
21
|
+
minimized: RequiredTeleBoxConfig["minimized$"];
|
|
22
|
+
maximized: RequiredTeleBoxConfig["maximized$"];
|
|
23
|
+
readonly: RequiredTeleBoxConfig["readonly$"];
|
|
24
|
+
rootRect: RequiredTeleBoxConfig["rootRect$"];
|
|
25
|
+
managerStageRect: RequiredTeleBoxConfig["managerStageRect$"];
|
|
26
|
+
collectorRect: RequiredTeleBoxConfig["collectorRect$"];
|
|
27
|
+
zIndex: Val<RequiredTeleBoxConfig["zIndex"], boolean>;
|
|
28
|
+
focus: Val<RequiredTeleBoxConfig["focus"], boolean>;
|
|
29
|
+
$userContent: Val<TeleBoxConfig["content"], boolean>;
|
|
30
|
+
$userFooter: Val<TeleBoxConfig["footer"], boolean>;
|
|
31
|
+
$userStyles: Val<TeleBoxConfig["styles"], boolean>;
|
|
32
|
+
minSize: Val<TeleBoxSize, boolean>;
|
|
33
|
+
intrinsicSize: Val<TeleBoxSize, boolean>;
|
|
34
|
+
intrinsicCoord: Val<TeleBoxCoord, boolean>;
|
|
35
|
+
pxMinSize: ReadonlyVal<TeleBoxSize, boolean>;
|
|
36
|
+
pxIntrinsicSize: ReadonlyVal<TeleBoxSize, boolean>;
|
|
37
|
+
pxIntrinsicCoord: ReadonlyVal<TeleBoxCoord, boolean>;
|
|
38
|
+
state: ReadonlyVal<TeleBoxState, boolean>;
|
|
39
|
+
highlightStage: ReadonlyVal<boolean, boolean>;
|
|
40
|
+
boxHighlightStage: Val<boolean | null, boolean>;
|
|
41
|
+
contentRect: Val<TeleBoxRect>;
|
|
42
|
+
contentStageRect: ReadonlyVal<TeleBoxRect | null>;
|
|
43
|
+
};
|
|
44
|
+
declare type CombinedValEnhancedResult = ReadonlyValEnhancedResult<ReadonlyValConfig> & ValEnhancedResult<ValConfig>;
|
|
45
|
+
export interface TeleBox extends CombinedValEnhancedResult {
|
|
38
46
|
}
|
|
39
47
|
export declare class TeleBox {
|
|
40
|
-
constructor({ id, title,
|
|
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$, rootRect$, managerStageRect$, stageRatio$, collectorRect$, managerHighlightStage$, }: TeleBoxConfig);
|
|
41
49
|
readonly id: string;
|
|
42
50
|
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
43
51
|
readonly namespace: string;
|
|
44
|
-
readonly events:
|
|
45
|
-
|
|
52
|
+
readonly events: Emittery<{
|
|
53
|
+
dark_mode: boolean;
|
|
54
|
+
prefers_color_scheme: "light" | "dark" | "auto";
|
|
55
|
+
close: undefined;
|
|
56
|
+
focus: undefined;
|
|
57
|
+
blur: undefined;
|
|
58
|
+
intrinsic_move: {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
};
|
|
62
|
+
intrinsic_resize: {
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
};
|
|
66
|
+
z_index: number;
|
|
67
|
+
state: "normal" | "minimized" | "maximized";
|
|
68
|
+
minimized: boolean;
|
|
69
|
+
maximized: boolean;
|
|
70
|
+
readonly: boolean;
|
|
71
|
+
destroyed: undefined;
|
|
72
|
+
}, {
|
|
73
|
+
dark_mode: boolean;
|
|
74
|
+
prefers_color_scheme: "light" | "dark" | "auto";
|
|
75
|
+
close: undefined;
|
|
76
|
+
focus: undefined;
|
|
77
|
+
blur: undefined;
|
|
78
|
+
intrinsic_move: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
};
|
|
82
|
+
intrinsic_resize: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
};
|
|
86
|
+
z_index: number;
|
|
87
|
+
state: "normal" | "minimized" | "maximized";
|
|
88
|
+
minimized: boolean;
|
|
89
|
+
maximized: boolean;
|
|
90
|
+
readonly: boolean;
|
|
91
|
+
destroyed: undefined;
|
|
92
|
+
}, "close" | "focus" | "blur" | "destroyed">;
|
|
93
|
+
readonly _delegateEvents: Emittery<{
|
|
94
|
+
close: undefined;
|
|
95
|
+
maximize: undefined;
|
|
96
|
+
minimize: undefined;
|
|
97
|
+
}, {
|
|
98
|
+
close: undefined;
|
|
99
|
+
maximize: undefined;
|
|
100
|
+
minimize: undefined;
|
|
101
|
+
}, "close" | "maximize" | "minimize">;
|
|
46
102
|
protected _sideEffect: SideEffectManager;
|
|
47
|
-
protected _valSideEffectBinder: ValSideEffectBinder;
|
|
48
103
|
titleBar: TeleTitleBar;
|
|
49
|
-
|
|
50
|
-
_size$: Val<TeleBoxSize, boolean>;
|
|
51
|
-
_intrinsicSize$: Val<TeleBoxSize, boolean>;
|
|
52
|
-
_visualSize$: Val<TeleBoxSize, boolean>;
|
|
53
|
-
_coord$: Val<TeleBoxCoord, boolean>;
|
|
54
|
-
_intrinsicCoord$: Val<TeleBoxCoord, boolean>;
|
|
55
|
-
get darkMode(): boolean;
|
|
56
|
-
_state$: Val<TeleBoxState, boolean>;
|
|
57
|
-
get state(): TeleBoxState;
|
|
58
|
-
/** @deprecated use setMaximized and setMinimized instead */
|
|
59
|
-
setState(state: TeleBoxState, skipUpdate?: boolean): this;
|
|
60
|
-
/** Minimum box width relative to container element. 0~1. Default 0. */
|
|
104
|
+
/** Minimum box width relative to stage area. 0~1. Default 0. */
|
|
61
105
|
get minWidth(): number;
|
|
62
|
-
/** Minimum box height relative to
|
|
106
|
+
/** Minimum box height relative to stage area. 0~1. Default 0. */
|
|
63
107
|
get minHeight(): number;
|
|
64
108
|
/**
|
|
65
|
-
* @param minWidth Minimum box width relative to
|
|
109
|
+
* @param minWidth Minimum box width relative to stage area. 0~1.
|
|
66
110
|
* @returns this
|
|
67
111
|
*/
|
|
68
|
-
setMinWidth(minWidth: number, skipUpdate?: boolean):
|
|
112
|
+
setMinWidth(minWidth: number, skipUpdate?: boolean): void;
|
|
69
113
|
/**
|
|
70
114
|
* @param minHeight Minimum box height relative to container element. 0~1.
|
|
71
115
|
* @returns this
|
|
72
116
|
*/
|
|
73
|
-
setMinHeight(minHeight: number, skipUpdate?: boolean):
|
|
74
|
-
/** Intrinsic box width relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.5. */
|
|
75
|
-
get intrinsicWidth(): number;
|
|
76
|
-
/** Intrinsic box height relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.5. */
|
|
77
|
-
get intrinsicHeight(): number;
|
|
117
|
+
setMinHeight(minHeight: number, skipUpdate?: boolean): void;
|
|
78
118
|
/**
|
|
79
119
|
* Resize box.
|
|
80
120
|
* @param width Box width relative to container element. 0~1.
|
|
@@ -82,72 +122,62 @@ export declare class TeleBox {
|
|
|
82
122
|
* @param skipUpdate Skip emitting event.
|
|
83
123
|
* @returns this
|
|
84
124
|
*/
|
|
85
|
-
resize(width: number, height: number, skipUpdate?: boolean):
|
|
86
|
-
/** Box width relative to container element. 0~1. Default 0.5. */
|
|
87
|
-
get width(): number;
|
|
88
|
-
/** Box height relative to container element. 0~1. Default 0.5. */
|
|
89
|
-
get height(): number;
|
|
90
|
-
/** Box width in pixels. */
|
|
91
|
-
get absoluteWidth(): number;
|
|
92
|
-
/** Box height in pixels. */
|
|
93
|
-
get absoluteHeight(): number;
|
|
94
|
-
/** Actual rendered box width relative to container element. 0~1. Default 0.5. */
|
|
95
|
-
get visualWidth(): number;
|
|
96
|
-
/** Actual rendered box height relative to container element. 0~1. Default 0.5. */
|
|
97
|
-
get visualHeight(): number;
|
|
125
|
+
resize(width: number, height: number, skipUpdate?: boolean): void;
|
|
98
126
|
/** Intrinsic box x position relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
99
127
|
get intrinsicX(): number;
|
|
100
128
|
/** Intrinsic box y position relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
101
129
|
get intrinsicY(): number;
|
|
130
|
+
/** Intrinsic box width relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
131
|
+
get intrinsicWidth(): number;
|
|
132
|
+
/** Intrinsic box height relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
133
|
+
get intrinsicHeight(): number;
|
|
102
134
|
/**
|
|
103
135
|
* Move box position.
|
|
104
|
-
* @param x x position
|
|
105
|
-
* @param y y position
|
|
136
|
+
* @param x x position in px.
|
|
137
|
+
* @param y y position in px.
|
|
106
138
|
* @param skipUpdate Skip emitting event.
|
|
107
139
|
* @returns this
|
|
108
140
|
*/
|
|
109
|
-
move(x: number, y: number, skipUpdate?: boolean):
|
|
110
|
-
/** Box x position relative to container element. 0~1. Default 0.1. */
|
|
111
|
-
get x(): number;
|
|
112
|
-
/** Box y position relative to container element. 0~1. Default 0.1. */
|
|
113
|
-
get y(): number;
|
|
141
|
+
protected move(x: number, y: number, skipUpdate?: boolean): void;
|
|
114
142
|
/**
|
|
115
143
|
* Resize + Move, with respect to fixed ratio.
|
|
116
|
-
* @param x x position
|
|
117
|
-
* @param y y position
|
|
118
|
-
* @param width Box width
|
|
119
|
-
* @param height Box height
|
|
144
|
+
* @param x x position in px.
|
|
145
|
+
* @param y y position in px.
|
|
146
|
+
* @param width Box width in px.
|
|
147
|
+
* @param height Box height in px.
|
|
120
148
|
* @param skipUpdate Skip emitting event.
|
|
121
149
|
* @returns this
|
|
122
150
|
*/
|
|
123
|
-
transform(x: number, y: number, width: number, height: number, skipUpdate?: boolean):
|
|
151
|
+
protected transform(x: number, y: number, width: number, height: number, skipUpdate?: boolean): void;
|
|
124
152
|
/**
|
|
125
153
|
* Mount box to a container element.
|
|
126
154
|
*/
|
|
127
|
-
mount(container: HTMLElement):
|
|
155
|
+
mount(container: HTMLElement): void;
|
|
128
156
|
/**
|
|
129
157
|
* Unmount box from the container element.
|
|
130
158
|
*/
|
|
131
|
-
unmount():
|
|
159
|
+
unmount(): void;
|
|
132
160
|
/**
|
|
133
161
|
* Mount dom to box content.
|
|
134
162
|
*/
|
|
135
|
-
mountContent(content: HTMLElement):
|
|
163
|
+
mountContent(content: HTMLElement): void;
|
|
136
164
|
/**
|
|
137
165
|
* Unmount content from the box.
|
|
138
166
|
*/
|
|
139
|
-
unmountContent():
|
|
167
|
+
unmountContent(): void;
|
|
140
168
|
/**
|
|
141
169
|
* Mount dom to box Footer.
|
|
142
170
|
*/
|
|
143
|
-
mountFooter(footer: HTMLElement):
|
|
171
|
+
mountFooter(footer: HTMLElement): void;
|
|
144
172
|
/**
|
|
145
173
|
* Unmount Footer from the box.
|
|
146
174
|
*/
|
|
147
|
-
unmountFooter():
|
|
175
|
+
unmountFooter(): void;
|
|
148
176
|
getUserStyles(): HTMLStyleElement | undefined;
|
|
149
|
-
mountStyles(styles: string | HTMLStyleElement):
|
|
150
|
-
unmountStyles():
|
|
177
|
+
mountStyles(styles: string | HTMLStyleElement): void;
|
|
178
|
+
unmountStyles(): void;
|
|
179
|
+
/** Show stage frame and grey-out the non-stage area. Inherit setting from manager if null. */
|
|
180
|
+
setHighlightStage(highlightStage: boolean | null): void;
|
|
151
181
|
/** DOM of the box */
|
|
152
182
|
$box: HTMLElement;
|
|
153
183
|
/** DOM of the box content */
|
|
@@ -156,12 +186,11 @@ export declare class TeleBox {
|
|
|
156
186
|
$titleBar: HTMLElement;
|
|
157
187
|
/** DOM of the box footer */
|
|
158
188
|
$footer: HTMLElement;
|
|
159
|
-
protected
|
|
160
|
-
render(root?: HTMLElement): HTMLElement;
|
|
189
|
+
protected render(): HTMLElement;
|
|
161
190
|
protected _handleTrackStart?: (ev: MouseEvent | TouchEvent) => void;
|
|
162
191
|
handleTrackStart: (ev: MouseEvent | TouchEvent) => void;
|
|
163
192
|
protected _renderResizeHandlers(): void;
|
|
164
|
-
destroy(): void
|
|
193
|
+
destroy(): Promise<void>;
|
|
165
194
|
/**
|
|
166
195
|
* Wrap a className with namespace
|
|
167
196
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type Emittery from "emittery";
|
|
2
|
+
import type { ReadonlyVal } from "value-enhancer";
|
|
2
3
|
import type { TeleTitleBar } from "../TeleTitleBar";
|
|
3
4
|
import type { TeleBoxDragHandleType, TELE_BOX_EVENT, TELE_BOX_DELEGATE_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TELE_BOX_COLOR_SCHEME } from "./constants";
|
|
4
5
|
export declare type TeleBoxColorScheme = `${TELE_BOX_COLOR_SCHEME}`;
|
|
@@ -22,40 +23,28 @@ export interface TeleBoxConfig {
|
|
|
22
23
|
readonly id?: string;
|
|
23
24
|
/** Box title. Default empty. */
|
|
24
25
|
readonly title?: string;
|
|
25
|
-
/** Prefers Box color scheme. Default light. */
|
|
26
|
-
readonly prefersColorScheme?: TeleBoxColorScheme;
|
|
27
|
-
/** Actual Box Dark Mode */
|
|
28
|
-
readonly darkMode?: boolean;
|
|
29
26
|
/** Box visible. Default true. */
|
|
30
27
|
readonly visible?: boolean;
|
|
31
|
-
/** Box width relative to
|
|
28
|
+
/** Box width relative to stage area. 0~1. Default 0.5. */
|
|
32
29
|
readonly width?: number;
|
|
33
|
-
/** Box height relative to
|
|
30
|
+
/** Box height relative to stage area. 0~1. Default 0.5. */
|
|
34
31
|
readonly height?: number;
|
|
35
|
-
/** Minimum box width relative to
|
|
32
|
+
/** Minimum box width relative to stage area. 0~1. Default 0. */
|
|
36
33
|
readonly minWidth?: number;
|
|
37
|
-
/** Minimum box height relative to
|
|
34
|
+
/** Minimum box height relative to stage area. 0~1. Default 0. */
|
|
38
35
|
readonly minHeight?: number;
|
|
39
|
-
/** x position relative to
|
|
36
|
+
/** x position relative to stage area. 0~1. Default 0.1. */
|
|
40
37
|
readonly x?: number;
|
|
41
|
-
/** y position relative to
|
|
38
|
+
/** y position relative to stage area. 0~1. Default 0.1. */
|
|
42
39
|
readonly y?: number;
|
|
43
|
-
/** Maximize box. Default false. */
|
|
44
|
-
readonly maximized?: boolean;
|
|
45
|
-
/** Minimize box. Overwrites maximized state. Default false. */
|
|
46
|
-
readonly minimized?: boolean;
|
|
47
40
|
/** The initial state of the box. Default normal. */
|
|
48
41
|
readonly state?: TeleBoxState;
|
|
49
|
-
/** Is box readonly */
|
|
50
|
-
readonly readonly?: boolean;
|
|
51
42
|
/** Able to resize box window. Default true. */
|
|
52
43
|
readonly resizable?: boolean;
|
|
53
44
|
/** Able to drag box window Default true. */
|
|
54
45
|
readonly draggable?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
readonly
|
|
57
|
-
/** Fixed width/height ratio for box window. Default false. */
|
|
58
|
-
readonly fixRatio?: boolean;
|
|
46
|
+
/** Fixed height/width ratio for box window. No ratio limit if <= 0. Default -1. */
|
|
47
|
+
readonly ratio?: number;
|
|
59
48
|
/** Box focused. */
|
|
60
49
|
readonly focus?: boolean;
|
|
61
50
|
/** Base z-index for box. */
|
|
@@ -70,26 +59,36 @@ export interface TeleBoxConfig {
|
|
|
70
59
|
readonly footer?: HTMLElement;
|
|
71
60
|
/** Box content styles. */
|
|
72
61
|
readonly styles?: HTMLStyleElement;
|
|
73
|
-
/**
|
|
74
|
-
readonly
|
|
62
|
+
/** Show stage frame and grey-out the non-stage area. Inherit setting from manager if null. Default null. */
|
|
63
|
+
readonly highlightStage?: boolean | null;
|
|
64
|
+
/** Actual Box Dark Mode */
|
|
65
|
+
readonly darkMode$: ReadonlyVal<boolean, boolean>;
|
|
66
|
+
/** Restrict box to always be within the stage area. Default false. */
|
|
67
|
+
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
|
+
/** Position and dimension of root element */
|
|
75
|
+
readonly rootRect$: ReadonlyVal<TeleBoxRect>;
|
|
76
|
+
/** Position and dimension of stage area */
|
|
77
|
+
readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
|
|
78
|
+
/** Stage area height/with ratio. No ratio if <= 0. */
|
|
79
|
+
readonly stageRatio$: ReadonlyVal<number, boolean>;
|
|
75
80
|
/** Position and dimension of collector */
|
|
76
|
-
readonly collectorRect
|
|
81
|
+
readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
|
|
82
|
+
/** highlight stage settings from manager */
|
|
83
|
+
readonly managerHighlightStage$: ReadonlyVal<boolean>;
|
|
77
84
|
}
|
|
78
85
|
declare type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
79
86
|
export declare type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
80
87
|
dark_mode: boolean;
|
|
81
88
|
prefers_color_scheme: TeleBoxColorScheme;
|
|
82
|
-
close:
|
|
83
|
-
focus:
|
|
84
|
-
blur:
|
|
85
|
-
move: {
|
|
86
|
-
x: number;
|
|
87
|
-
y: number;
|
|
88
|
-
};
|
|
89
|
-
resize: {
|
|
90
|
-
width: number;
|
|
91
|
-
height: number;
|
|
92
|
-
};
|
|
89
|
+
close: undefined;
|
|
90
|
+
focus: undefined;
|
|
91
|
+
blur: undefined;
|
|
93
92
|
intrinsic_move: {
|
|
94
93
|
x: number;
|
|
95
94
|
y: number;
|
|
@@ -98,36 +97,22 @@ export declare type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
|
98
97
|
width: number;
|
|
99
98
|
height: number;
|
|
100
99
|
};
|
|
101
|
-
visual_resize: {
|
|
102
|
-
width: number;
|
|
103
|
-
height: number;
|
|
104
|
-
};
|
|
105
100
|
z_index: number;
|
|
106
101
|
state: TeleBoxState;
|
|
107
102
|
minimized: boolean;
|
|
108
103
|
maximized: boolean;
|
|
109
104
|
readonly: boolean;
|
|
110
|
-
destroyed:
|
|
105
|
+
destroyed: undefined;
|
|
111
106
|
}>;
|
|
112
107
|
export declare type TeleBoxEvent = keyof TeleBoxEventConfig;
|
|
113
|
-
export
|
|
114
|
-
on<U extends TeleBoxEvent>(event: U, listener: (value: TeleBoxEventConfig[U]) => void): this;
|
|
115
|
-
once<U extends TeleBoxEvent>(event: U, listener: (value: TeleBoxEventConfig[U]) => void): this;
|
|
116
|
-
addListener<U extends TeleBoxEvent>(event: U, listener: (value: TeleBoxEventConfig[U]) => void): this;
|
|
117
|
-
emit<U extends TeleBoxEvent>(event: U, ...value: TeleBoxEventConfig[U] extends void ? [] : [TeleBoxEventConfig[U]]): boolean;
|
|
118
|
-
}
|
|
108
|
+
export declare type TeleBoxEvents = Emittery<TeleBoxEventConfig>;
|
|
119
109
|
export declare type TeleBoxHandleType = TELE_BOX_RESIZE_HANDLE | typeof TeleBoxDragHandleType;
|
|
120
110
|
declare type CheckTeleBoxDelegateConfig<T extends Record<`${TELE_BOX_DELEGATE_EVENT}`, any>> = T;
|
|
121
111
|
export declare type TeleBoxDelegateEventConfig = CheckTeleBoxDelegateConfig<{
|
|
122
|
-
close:
|
|
123
|
-
maximize:
|
|
124
|
-
minimize:
|
|
112
|
+
close: undefined;
|
|
113
|
+
maximize: undefined;
|
|
114
|
+
minimize: undefined;
|
|
125
115
|
}>;
|
|
126
116
|
export declare type TeleBoxDelegateEvent = keyof TeleBoxDelegateEventConfig;
|
|
127
|
-
export
|
|
128
|
-
on<U extends TeleBoxDelegateEvent>(event: U, listener: (value: TeleBoxDelegateEventConfig[U]) => void): this;
|
|
129
|
-
once<U extends TeleBoxDelegateEvent>(event: U, listener: (value: TeleBoxDelegateEventConfig[U]) => void): this;
|
|
130
|
-
addListener<U extends TeleBoxDelegateEvent>(event: U, listener: (value: TeleBoxDelegateEventConfig[U]) => void): this;
|
|
131
|
-
emit<U extends TeleBoxDelegateEvent>(event: U, ...value: TeleBoxDelegateEventConfig[U] extends void ? [] : [TeleBoxDelegateEventConfig[U]]): boolean;
|
|
132
|
-
}
|
|
117
|
+
export declare type TeleBoxDelegateEvents = Emittery<TeleBoxDelegateEventConfig>;
|
|
133
118
|
export {};
|
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
import "./style.scss";
|
|
2
|
-
import { TeleStyles } from "../typings";
|
|
2
|
+
import type { TeleStyles } from "../typings";
|
|
3
|
+
import type { ReadonlyVal, ReadonlyValEnhancedResult, ValEnhancedResult } from "value-enhancer";
|
|
4
|
+
import { Val } from "value-enhancer";
|
|
5
|
+
import { SideEffectManager } from "side-effect-manager";
|
|
6
|
+
import type { TeleBoxRect } from "../TeleBox/typings";
|
|
3
7
|
export interface TeleBoxCollectorConfig {
|
|
4
|
-
visible?: boolean;
|
|
5
|
-
readonly?: boolean;
|
|
6
|
-
darkMode?: boolean;
|
|
7
8
|
namespace?: string;
|
|
8
9
|
styles?: TeleStyles;
|
|
9
|
-
|
|
10
|
+
root?: HTMLElement;
|
|
11
|
+
minimized$: Val<boolean>;
|
|
12
|
+
readonly$: ReadonlyVal<boolean>;
|
|
13
|
+
darkMode$: ReadonlyVal<boolean>;
|
|
14
|
+
rootRect$: ReadonlyVal<TeleBoxRect>;
|
|
15
|
+
}
|
|
16
|
+
declare type ValConfig = {
|
|
17
|
+
styles: Val<TeleStyles>;
|
|
18
|
+
root: Val<HTMLElement | undefined>;
|
|
19
|
+
el: Val<HTMLElement>;
|
|
20
|
+
};
|
|
21
|
+
declare type ReadonlyValConfig = {
|
|
22
|
+
rect: ReadonlyVal<TeleBoxRect | undefined>;
|
|
23
|
+
visible: ReadonlyVal<boolean>;
|
|
24
|
+
};
|
|
25
|
+
declare type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> & ReadonlyValEnhancedResult<ReadonlyValConfig>;
|
|
26
|
+
export interface TeleBoxCollector extends CombinedValEnhancedResult {
|
|
10
27
|
}
|
|
11
28
|
export declare class TeleBoxCollector {
|
|
12
|
-
constructor({
|
|
13
|
-
readonly styles: TeleStyles;
|
|
29
|
+
constructor({ minimized$, readonly$, darkMode$, rootRect$, namespace, styles, root, }: TeleBoxCollectorConfig);
|
|
14
30
|
readonly namespace: string;
|
|
15
|
-
|
|
16
|
-
get readonly(): boolean;
|
|
17
|
-
get darkMode(): boolean;
|
|
18
|
-
onClick: (() => void) | undefined;
|
|
19
|
-
$collector: HTMLElement | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Mount collector to a root element.
|
|
22
|
-
*/
|
|
23
|
-
mount(root: HTMLElement): this;
|
|
24
|
-
/**
|
|
25
|
-
* Unmount collector from the root element.
|
|
26
|
-
*/
|
|
27
|
-
unmount(): this;
|
|
28
|
-
setVisible(visible: boolean): this;
|
|
29
|
-
setReadonly(readonly: boolean): this;
|
|
30
|
-
setDarkMode(darkMode: boolean): this;
|
|
31
|
-
setStyles(styles: TeleStyles): this;
|
|
32
|
-
render(): HTMLElement;
|
|
31
|
+
protected readonly _sideEffect: SideEffectManager;
|
|
33
32
|
destroy(): void;
|
|
34
33
|
wrapClassName(className: string): string;
|
|
35
|
-
protected _visible: boolean;
|
|
36
|
-
protected _readonly: boolean;
|
|
37
|
-
protected _darkMode: boolean;
|
|
38
|
-
protected handleCollectorClick: () => void;
|
|
39
34
|
}
|
|
35
|
+
export {};
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import "./style.scss";
|
|
2
2
|
import type { TeleBox } from "../../TeleBox";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import type { DefaultTitleBarConfig } from "../../TeleTitleBar";
|
|
4
|
+
import { DefaultTitleBar } from "../../TeleTitleBar";
|
|
5
|
+
import type { TeleBoxRect } from "../../TeleBox/typings";
|
|
6
|
+
import type { ReadonlyVal } from "value-enhancer";
|
|
7
|
+
export declare type MaxTitleBarTitle = Pick<TeleBox, "id" | "title">;
|
|
6
8
|
export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
7
|
-
darkMode
|
|
8
|
-
boxes
|
|
9
|
-
|
|
10
|
-
focusedBox?: MaxTitleBarTeleBox;
|
|
9
|
+
darkMode$: ReadonlyVal<boolean>;
|
|
10
|
+
boxes$: ReadonlyVal<TeleBox[]>;
|
|
11
|
+
rootRect$: ReadonlyVal<TeleBoxRect>;
|
|
11
12
|
}
|
|
12
13
|
export declare class MaxTitleBar extends DefaultTitleBar {
|
|
13
14
|
constructor(config: MaxTitleBarConfig);
|
|
14
|
-
focusBox(box?:
|
|
15
|
-
setContainerRect(rect: TeleBoxRect): void;
|
|
16
|
-
setBoxes(boxes: MaxTitleBarTeleBox[]): void;
|
|
17
|
-
setState(state: TeleBoxState): void;
|
|
18
|
-
setReadonly(readonly: boolean): void;
|
|
19
|
-
setDarkMode(darkMode: boolean): void;
|
|
15
|
+
focusBox(box?: TeleBox): void;
|
|
20
16
|
render(): HTMLElement;
|
|
21
17
|
destroy(): void;
|
|
22
|
-
updateTitles(): void;
|
|
23
18
|
protected renderTitles(): HTMLElement;
|
|
24
|
-
|
|
19
|
+
focusedBox: TeleBox | undefined;
|
|
20
|
+
protected darkMode$: MaxTitleBarConfig["darkMode$"];
|
|
21
|
+
protected boxes$: MaxTitleBarConfig["boxes$"];
|
|
22
|
+
protected rootRect$: MaxTitleBarConfig["rootRect$"];
|
|
25
23
|
protected $titles: HTMLElement | undefined;
|
|
26
|
-
protected boxes: MaxTitleBarTeleBox[];
|
|
27
|
-
focusedBox: MaxTitleBarTeleBox | undefined;
|
|
28
|
-
protected containerRect: TeleBoxRect;
|
|
29
24
|
}
|
|
@@ -6,11 +6,8 @@ export declare enum TELE_BOX_MANAGER_EVENT {
|
|
|
6
6
|
State = "state",
|
|
7
7
|
Maximized = "maximized",
|
|
8
8
|
Minimized = "minimized",
|
|
9
|
-
Move = "move",
|
|
10
|
-
Resize = "resize",
|
|
11
9
|
IntrinsicMove = "intrinsic_move",
|
|
12
10
|
IntrinsicResize = "intrinsic_resize",
|
|
13
|
-
VisualResize = "visual_resize",
|
|
14
11
|
ZIndex = "z_index",
|
|
15
12
|
PrefersColorScheme = "prefers_color_scheme",
|
|
16
13
|
DarkMode = "dark_mode"
|