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