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