@netless/telebox-insider 0.2.29 → 0.2.30
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/index.d.ts +837 -6
- package/dist/telebox-insider.cjs.js +0 -150
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1 -146
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +8 -9
- package/src/index.ts +1 -1
- package/dist/TeleBox/constants.d.ts +0 -44
- package/dist/TeleBox/index.d.ts +0 -171
- package/dist/TeleBox/typings.d.ts +0 -133
- package/dist/TeleBoxCollector/TeleBoxCollector.stories.d.ts +0 -5
- package/dist/TeleBoxCollector/index.d.ts +0 -39
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBar.stories.d.ts +0 -7
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBarReact.d.ts +0 -4
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +0 -29
- package/dist/TeleBoxManager/constants.d.ts +0 -17
- package/dist/TeleBoxManager/index.d.ts +0 -60
- package/dist/TeleBoxManager/typings.d.ts +0 -42
- 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/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +0 -46
- package/dist/TeleTitleBar/index.d.ts +0 -2
- package/dist/TeleTitleBar/typings.d.ts +0 -23
- package/dist/typings.d.ts +0 -3
- package/dist/utils.d.ts +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/telebox-insider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Window widget for Whiteboard",
|
|
6
6
|
"author": "CRIMX <straybugs@gmail.com> (https://github.com/crimx/)",
|
|
@@ -24,16 +24,11 @@
|
|
|
24
24
|
"lint": "lint-staged",
|
|
25
25
|
"start": "vite ./playground --open --host",
|
|
26
26
|
"storybook": "start-storybook -p 6006 --no-version-updates",
|
|
27
|
-
"types": "
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@types/shallowequal": "^1.1.1",
|
|
31
|
-
"eventemitter3": "^4.0.7",
|
|
32
|
-
"shallowequal": "^1.1.0",
|
|
33
|
-
"stylefire": "^7.0.3"
|
|
27
|
+
"types": "dts -o dist/index.d.ts"
|
|
34
28
|
},
|
|
35
29
|
"devDependencies": {
|
|
36
30
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
31
|
+
"@hyrious/dts": "^0.2.2",
|
|
37
32
|
"@netless/eslint-plugin": "^1.1.2",
|
|
38
33
|
"@rollup/plugin-commonjs": "^17.1.0",
|
|
39
34
|
"@rollup/plugin-node-resolve": "^11.2.0",
|
|
@@ -49,6 +44,7 @@
|
|
|
49
44
|
"@types/node": "^14.14.16",
|
|
50
45
|
"@types/react": "^17.0.0",
|
|
51
46
|
"@types/react-dom": "^17.0.0",
|
|
47
|
+
"@types/shallowequal": "^1.1.1",
|
|
52
48
|
"@typescript-eslint/eslint-plugin": "^4.11.0",
|
|
53
49
|
"@typescript-eslint/parser": "^4.11.0",
|
|
54
50
|
"chance": "^1.1.7",
|
|
@@ -61,6 +57,9 @@
|
|
|
61
57
|
"eslint-plugin-prettier": "^3.1.4",
|
|
62
58
|
"eslint-plugin-react": "^7.20.6",
|
|
63
59
|
"eslint-plugin-react-app": "^6.2.2",
|
|
60
|
+
"eventemitter3": "^4.0.7",
|
|
61
|
+
"shallowequal": "^1.1.0",
|
|
62
|
+
"stylefire": "^7.0.3",
|
|
64
63
|
"faker": "^5.4.0",
|
|
65
64
|
"fork-ts-checker-webpack-plugin": "^6.0.4",
|
|
66
65
|
"lint-staged": "^10.5.4",
|
|
@@ -73,7 +72,7 @@
|
|
|
73
72
|
"sass": "^1.36.0",
|
|
74
73
|
"sass-loader": "^10.1.1",
|
|
75
74
|
"side-effect-manager": "0.1.5",
|
|
76
|
-
"typescript": "^4.
|
|
75
|
+
"typescript": "^5.4.5",
|
|
77
76
|
"value-enhancer": "^0.0.8",
|
|
78
77
|
"vite": "^2.4.4"
|
|
79
78
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare enum TELE_BOX_COLOR_SCHEME {
|
|
2
|
-
Light = "light",
|
|
3
|
-
Dark = "dark",
|
|
4
|
-
Auto = "auto"
|
|
5
|
-
}
|
|
6
|
-
export declare enum TELE_BOX_STATE {
|
|
7
|
-
Normal = "normal",
|
|
8
|
-
Minimized = "minimized",
|
|
9
|
-
Maximized = "maximized"
|
|
10
|
-
}
|
|
11
|
-
export declare enum TELE_BOX_EVENT {
|
|
12
|
-
DarkMode = "dark_mode",
|
|
13
|
-
PrefersColorScheme = "prefers_color_scheme",
|
|
14
|
-
Close = "close",
|
|
15
|
-
Focus = "focus",
|
|
16
|
-
Blur = "blur",
|
|
17
|
-
Move = "move",
|
|
18
|
-
Resize = "resize",
|
|
19
|
-
IntrinsicMove = "intrinsic_move",
|
|
20
|
-
IntrinsicResize = "intrinsic_resize",
|
|
21
|
-
VisualResize = "visual_resize",
|
|
22
|
-
ZIndex = "z_index",
|
|
23
|
-
State = "state",
|
|
24
|
-
Minimized = "minimized",
|
|
25
|
-
Maximized = "maximized",
|
|
26
|
-
Readonly = "readonly",
|
|
27
|
-
Destroyed = "destroyed"
|
|
28
|
-
}
|
|
29
|
-
export declare enum TELE_BOX_DELEGATE_EVENT {
|
|
30
|
-
Close = "close",
|
|
31
|
-
Maximize = "maximize",
|
|
32
|
-
Minimize = "minimize"
|
|
33
|
-
}
|
|
34
|
-
export declare enum TELE_BOX_RESIZE_HANDLE {
|
|
35
|
-
North = "n",
|
|
36
|
-
South = "s",
|
|
37
|
-
West = "w",
|
|
38
|
-
East = "e",
|
|
39
|
-
NorthWest = "nw",
|
|
40
|
-
NorthEast = "ne",
|
|
41
|
-
SouthEast = "se",
|
|
42
|
-
SouthWest = "sw"
|
|
43
|
-
}
|
|
44
|
-
export declare const TeleBoxDragHandleType = "dh";
|
package/dist/TeleBox/index.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import "./style.scss";
|
|
2
|
-
import { SideEffectManager } from "side-effect-manager";
|
|
3
|
-
import { Val, ValEnhancedResult, ValSideEffectBinder } from "value-enhancer";
|
|
4
|
-
import { TeleTitleBar } from "../TeleTitleBar";
|
|
5
|
-
import type { TeleBoxConfig, TeleBoxRect, TeleBoxEvents, TeleBoxState, TeleBoxDelegateEvents, TeleBoxCoord, TeleBoxSize, TeleBoxColorScheme } from "./typings";
|
|
6
|
-
export * from "./constants";
|
|
7
|
-
export * from "./typings";
|
|
8
|
-
declare type ValConfig = {
|
|
9
|
-
prefersColorScheme: Val<TeleBoxColorScheme, boolean>;
|
|
10
|
-
darkMode: Val<boolean, boolean>;
|
|
11
|
-
containerRect: Val<TeleBoxRect, boolean>;
|
|
12
|
-
collectorRect: Val<TeleBoxRect | undefined, boolean>;
|
|
13
|
-
/** Box title. Default empty. */
|
|
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>;
|
|
36
|
-
};
|
|
37
|
-
export interface TeleBox extends ValEnhancedResult<ValConfig> {
|
|
38
|
-
}
|
|
39
|
-
export declare class TeleBox {
|
|
40
|
-
constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, }?: TeleBoxConfig);
|
|
41
|
-
readonly id: string;
|
|
42
|
-
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
43
|
-
readonly namespace: string;
|
|
44
|
-
readonly events: TeleBoxEvents;
|
|
45
|
-
readonly _delegateEvents: TeleBoxDelegateEvents;
|
|
46
|
-
protected _sideEffect: SideEffectManager;
|
|
47
|
-
protected _valSideEffectBinder: ValSideEffectBinder;
|
|
48
|
-
titleBar: TeleTitleBar;
|
|
49
|
-
_minSize$: Val<TeleBoxSize, boolean>;
|
|
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. */
|
|
61
|
-
get minWidth(): number;
|
|
62
|
-
/** Minimum box height relative to container element. 0~1. Default 0. */
|
|
63
|
-
get minHeight(): number;
|
|
64
|
-
/**
|
|
65
|
-
* @param minWidth Minimum box width relative to container element. 0~1.
|
|
66
|
-
* @returns this
|
|
67
|
-
*/
|
|
68
|
-
setMinWidth(minWidth: number, skipUpdate?: boolean): this;
|
|
69
|
-
/**
|
|
70
|
-
* @param minHeight Minimum box height relative to container element. 0~1.
|
|
71
|
-
* @returns this
|
|
72
|
-
*/
|
|
73
|
-
setMinHeight(minHeight: number, skipUpdate?: boolean): this;
|
|
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;
|
|
78
|
-
/**
|
|
79
|
-
* Resize box.
|
|
80
|
-
* @param width Box width relative to container element. 0~1.
|
|
81
|
-
* @param height Box height relative to container element. 0~1.
|
|
82
|
-
* @param skipUpdate Skip emitting event.
|
|
83
|
-
* @returns this
|
|
84
|
-
*/
|
|
85
|
-
resize(width: number, height: number, skipUpdate?: boolean): this;
|
|
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;
|
|
98
|
-
/** Intrinsic box x position relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
99
|
-
get intrinsicX(): number;
|
|
100
|
-
/** Intrinsic box y position relative to container element(without counting the effect of maximization or minimization). 0~1. Default 0.1. */
|
|
101
|
-
get intrinsicY(): number;
|
|
102
|
-
/**
|
|
103
|
-
* Move box position.
|
|
104
|
-
* @param x x position relative to container element. 0~1.
|
|
105
|
-
* @param y y position relative to container element. 0~1.
|
|
106
|
-
* @param skipUpdate Skip emitting event.
|
|
107
|
-
* @returns this
|
|
108
|
-
*/
|
|
109
|
-
move(x: number, y: number, skipUpdate?: boolean): this;
|
|
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;
|
|
114
|
-
/**
|
|
115
|
-
* Resize + Move, with respect to fixed ratio.
|
|
116
|
-
* @param x x position relative to container element. 0~1.
|
|
117
|
-
* @param y y position relative to container element. 0~1.
|
|
118
|
-
* @param width Box width relative to container element. 0~1.
|
|
119
|
-
* @param height Box height relative to container element. 0~1.
|
|
120
|
-
* @param skipUpdate Skip emitting event.
|
|
121
|
-
* @returns this
|
|
122
|
-
*/
|
|
123
|
-
transform(x: number, y: number, width: number, height: number, skipUpdate?: boolean): this;
|
|
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;
|
|
132
|
-
/**
|
|
133
|
-
* Mount dom to box content.
|
|
134
|
-
*/
|
|
135
|
-
mountContent(content: HTMLElement): this;
|
|
136
|
-
/**
|
|
137
|
-
* Unmount content from the box.
|
|
138
|
-
*/
|
|
139
|
-
unmountContent(): this;
|
|
140
|
-
/**
|
|
141
|
-
* Mount dom to box Footer.
|
|
142
|
-
*/
|
|
143
|
-
mountFooter(footer: HTMLElement): this;
|
|
144
|
-
/**
|
|
145
|
-
* Unmount Footer from the box.
|
|
146
|
-
*/
|
|
147
|
-
unmountFooter(): this;
|
|
148
|
-
getUserStyles(): HTMLStyleElement | undefined;
|
|
149
|
-
mountStyles(styles: string | HTMLStyleElement): this;
|
|
150
|
-
unmountStyles(): this;
|
|
151
|
-
/** DOM of the box */
|
|
152
|
-
$box: HTMLElement;
|
|
153
|
-
/** DOM of the box content */
|
|
154
|
-
$content: HTMLElement;
|
|
155
|
-
/** DOM of the box title bar */
|
|
156
|
-
$titleBar: HTMLElement;
|
|
157
|
-
/** DOM of the box footer */
|
|
158
|
-
$footer: HTMLElement;
|
|
159
|
-
protected _renderSideEffect: SideEffectManager;
|
|
160
|
-
render(root?: HTMLElement): HTMLElement;
|
|
161
|
-
protected _handleTrackStart?: (ev: MouseEvent | TouchEvent) => void;
|
|
162
|
-
handleTrackStart: (ev: MouseEvent | TouchEvent) => void;
|
|
163
|
-
protected _renderResizeHandlers(): void;
|
|
164
|
-
destroy(): void;
|
|
165
|
-
/**
|
|
166
|
-
* Wrap a className with namespace
|
|
167
|
-
*/
|
|
168
|
-
wrapClassName(className: string): string;
|
|
169
|
-
}
|
|
170
|
-
declare type PropKeys<K = keyof TeleBox> = K extends keyof TeleBox ? TeleBox[K] extends Function ? never : K : never;
|
|
171
|
-
export declare type ReadonlyTeleBox = Pick<TeleBox, PropKeys | "wrapClassName" | "mountContent" | "mountFooter" | "mountStyles" | "handleTrackStart">;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type EventEmitter from "eventemitter3";
|
|
2
|
-
import type { TeleTitleBar } from "../TeleTitleBar";
|
|
3
|
-
import type { TeleBoxDragHandleType, TELE_BOX_EVENT, TELE_BOX_DELEGATE_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TELE_BOX_COLOR_SCHEME } from "./constants";
|
|
4
|
-
export declare type TeleBoxColorScheme = `${TELE_BOX_COLOR_SCHEME}`;
|
|
5
|
-
export declare type TeleBoxCoord = {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
};
|
|
9
|
-
export declare type TeleBoxSize = {
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
};
|
|
13
|
-
export declare type TeleBoxState = `${TELE_BOX_STATE}`;
|
|
14
|
-
export interface TeleBoxRect {
|
|
15
|
-
readonly x: number;
|
|
16
|
-
readonly y: number;
|
|
17
|
-
readonly width: number;
|
|
18
|
-
readonly height: number;
|
|
19
|
-
}
|
|
20
|
-
export interface TeleBoxConfig {
|
|
21
|
-
/** Box ID. */
|
|
22
|
-
readonly id?: string;
|
|
23
|
-
/** Box title. Default empty. */
|
|
24
|
-
readonly title?: string;
|
|
25
|
-
/** Prefers Box color scheme. Default light. */
|
|
26
|
-
readonly prefersColorScheme?: TeleBoxColorScheme;
|
|
27
|
-
/** Actual Box Dark Mode */
|
|
28
|
-
readonly darkMode?: boolean;
|
|
29
|
-
/** Box visible. Default true. */
|
|
30
|
-
readonly visible?: boolean;
|
|
31
|
-
/** Box width relative to root element. 0~1. Default 0.5. */
|
|
32
|
-
readonly width?: number;
|
|
33
|
-
/** Box height relative to root element. 0~1. Default 0.5. */
|
|
34
|
-
readonly height?: number;
|
|
35
|
-
/** Minimum box width relative to root element. 0~1. Default 0. */
|
|
36
|
-
readonly minWidth?: number;
|
|
37
|
-
/** Minimum box height relative to root element. 0~1. Default 0. */
|
|
38
|
-
readonly minHeight?: number;
|
|
39
|
-
/** x position relative to root element. 0~1. Default 0.1. */
|
|
40
|
-
readonly x?: number;
|
|
41
|
-
/** y position relative to root element. 0~1. Default 0.1. */
|
|
42
|
-
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
|
-
/** The initial state of the box. Default normal. */
|
|
48
|
-
readonly state?: TeleBoxState;
|
|
49
|
-
/** Is box readonly */
|
|
50
|
-
readonly readonly?: boolean;
|
|
51
|
-
/** Able to resize box window. Default true. */
|
|
52
|
-
readonly resizable?: boolean;
|
|
53
|
-
/** Able to drag box window Default true. */
|
|
54
|
-
readonly draggable?: boolean;
|
|
55
|
-
/** Restrict box to always be within the containing area. Default true. */
|
|
56
|
-
readonly fence?: boolean;
|
|
57
|
-
/** Fixed width/height ratio for box window. Default false. */
|
|
58
|
-
readonly fixRatio?: boolean;
|
|
59
|
-
/** Box focused. */
|
|
60
|
-
readonly focus?: boolean;
|
|
61
|
-
/** Base z-index for box. */
|
|
62
|
-
readonly zIndex?: number;
|
|
63
|
-
/** Classname Prefix. For CSS styling. Default "telebox". */
|
|
64
|
-
readonly namespace?: string;
|
|
65
|
-
/** TeleTitleBar Instance. */
|
|
66
|
-
readonly titleBar?: TeleTitleBar;
|
|
67
|
-
/** Box content. */
|
|
68
|
-
readonly content?: HTMLElement;
|
|
69
|
-
/** Box footer. */
|
|
70
|
-
readonly footer?: HTMLElement;
|
|
71
|
-
/** Box content styles. */
|
|
72
|
-
readonly styles?: HTMLStyleElement;
|
|
73
|
-
/** Position and dimension of container */
|
|
74
|
-
readonly containerRect?: TeleBoxRect;
|
|
75
|
-
/** Position and dimension of collector */
|
|
76
|
-
readonly collectorRect?: TeleBoxRect;
|
|
77
|
-
}
|
|
78
|
-
declare type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
79
|
-
export declare type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
80
|
-
dark_mode: boolean;
|
|
81
|
-
prefers_color_scheme: TeleBoxColorScheme;
|
|
82
|
-
close: void;
|
|
83
|
-
focus: void;
|
|
84
|
-
blur: void;
|
|
85
|
-
move: {
|
|
86
|
-
x: number;
|
|
87
|
-
y: number;
|
|
88
|
-
};
|
|
89
|
-
resize: {
|
|
90
|
-
width: number;
|
|
91
|
-
height: number;
|
|
92
|
-
};
|
|
93
|
-
intrinsic_move: {
|
|
94
|
-
x: number;
|
|
95
|
-
y: number;
|
|
96
|
-
};
|
|
97
|
-
intrinsic_resize: {
|
|
98
|
-
width: number;
|
|
99
|
-
height: number;
|
|
100
|
-
};
|
|
101
|
-
visual_resize: {
|
|
102
|
-
width: number;
|
|
103
|
-
height: number;
|
|
104
|
-
};
|
|
105
|
-
z_index: number;
|
|
106
|
-
state: TeleBoxState;
|
|
107
|
-
minimized: boolean;
|
|
108
|
-
maximized: boolean;
|
|
109
|
-
readonly: boolean;
|
|
110
|
-
destroyed: void;
|
|
111
|
-
}>;
|
|
112
|
-
export declare type TeleBoxEvent = keyof TeleBoxEventConfig;
|
|
113
|
-
export interface TeleBoxEvents extends EventEmitter<TeleBoxEvent> {
|
|
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
|
-
}
|
|
119
|
-
export declare type TeleBoxHandleType = TELE_BOX_RESIZE_HANDLE | typeof TeleBoxDragHandleType;
|
|
120
|
-
declare type CheckTeleBoxDelegateConfig<T extends Record<`${TELE_BOX_DELEGATE_EVENT}`, any>> = T;
|
|
121
|
-
export declare type TeleBoxDelegateEventConfig = CheckTeleBoxDelegateConfig<{
|
|
122
|
-
close: void;
|
|
123
|
-
maximize: void;
|
|
124
|
-
minimize: void;
|
|
125
|
-
}>;
|
|
126
|
-
export declare type TeleBoxDelegateEvent = keyof TeleBoxDelegateEventConfig;
|
|
127
|
-
export interface TeleBoxDelegateEvents extends EventEmitter<TeleBoxDelegateEvent> {
|
|
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
|
-
}
|
|
133
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import "./style.scss";
|
|
2
|
-
import { TeleStyles } from "../typings";
|
|
3
|
-
export interface TeleBoxCollectorConfig {
|
|
4
|
-
visible?: boolean;
|
|
5
|
-
readonly?: boolean;
|
|
6
|
-
darkMode?: boolean;
|
|
7
|
-
namespace?: string;
|
|
8
|
-
styles?: TeleStyles;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare class TeleBoxCollector {
|
|
12
|
-
constructor({ visible, readonly, darkMode, namespace, styles, onClick, }?: TeleBoxCollectorConfig);
|
|
13
|
-
readonly styles: TeleStyles;
|
|
14
|
-
readonly namespace: string;
|
|
15
|
-
get visible(): boolean;
|
|
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
|
-
destroy(): void;
|
|
34
|
-
wrapClassName(className: string): string;
|
|
35
|
-
protected _visible: boolean;
|
|
36
|
-
protected _readonly: boolean;
|
|
37
|
-
protected _darkMode: boolean;
|
|
38
|
-
protected handleCollectorClick: () => void;
|
|
39
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { MaxTitleBarReactProps } from "./MaxTitleBarReact";
|
|
3
|
-
declare const storyMeta: Meta;
|
|
4
|
-
export default storyMeta;
|
|
5
|
-
export declare const Overview: Story<MaxTitleBarReactProps>;
|
|
6
|
-
export declare const SingleBox: Story<MaxTitleBarReactProps>;
|
|
7
|
-
export declare const BoxOverflows: Story<MaxTitleBarReactProps>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import "./style.scss";
|
|
2
|
-
import type { TeleBox } from "../../TeleBox";
|
|
3
|
-
import { DefaultTitleBar, DefaultTitleBarConfig } from "../../TeleTitleBar";
|
|
4
|
-
import { TeleBoxRect, TeleBoxState } from "../../TeleBox/typings";
|
|
5
|
-
export declare type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly">;
|
|
6
|
-
export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
7
|
-
darkMode: boolean;
|
|
8
|
-
boxes: MaxTitleBarTeleBox[];
|
|
9
|
-
containerRect: TeleBoxRect;
|
|
10
|
-
focusedBox?: MaxTitleBarTeleBox;
|
|
11
|
-
}
|
|
12
|
-
export declare class MaxTitleBar extends DefaultTitleBar {
|
|
13
|
-
constructor(config: MaxTitleBarConfig);
|
|
14
|
-
focusBox(box?: MaxTitleBarTeleBox): void;
|
|
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;
|
|
20
|
-
render(): HTMLElement;
|
|
21
|
-
destroy(): void;
|
|
22
|
-
updateTitles(): void;
|
|
23
|
-
protected renderTitles(): HTMLElement;
|
|
24
|
-
protected darkMode: boolean;
|
|
25
|
-
protected $titles: HTMLElement | undefined;
|
|
26
|
-
protected boxes: MaxTitleBarTeleBox[];
|
|
27
|
-
focusedBox: MaxTitleBarTeleBox | undefined;
|
|
28
|
-
protected containerRect: TeleBoxRect;
|
|
29
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum TELE_BOX_MANAGER_EVENT {
|
|
2
|
-
Focused = "focused",
|
|
3
|
-
Blurred = "blurred",
|
|
4
|
-
Created = "created",
|
|
5
|
-
Removed = "removed",
|
|
6
|
-
State = "state",
|
|
7
|
-
Maximized = "maximized",
|
|
8
|
-
Minimized = "minimized",
|
|
9
|
-
Move = "move",
|
|
10
|
-
Resize = "resize",
|
|
11
|
-
IntrinsicMove = "intrinsic_move",
|
|
12
|
-
IntrinsicResize = "intrinsic_resize",
|
|
13
|
-
VisualResize = "visual_resize",
|
|
14
|
-
ZIndex = "z_index",
|
|
15
|
-
PrefersColorScheme = "prefers_color_scheme",
|
|
16
|
-
DarkMode = "dark_mode"
|
|
17
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { TeleBoxConfig, TeleBoxRect, TeleBoxState } from "../TeleBox/typings";
|
|
2
|
-
import { TeleBoxCollector } from "../TeleBoxCollector";
|
|
3
|
-
import { ReadonlyTeleBox, TeleBox } from "../TeleBox";
|
|
4
|
-
import type { TeleBoxManagerConfig, TeleBoxManagerCreateConfig, TeleBoxManagerEvents, TeleBoxManagerQueryConfig, TeleBoxManagerUpdateConfig } from "./typings";
|
|
5
|
-
import { MaxTitleBar } from "./MaxTitleBar";
|
|
6
|
-
import { TeleBoxColorScheme } from "..";
|
|
7
|
-
import { SideEffectManager } from "side-effect-manager";
|
|
8
|
-
import { Val, ValEnhancedResult } from "value-enhancer";
|
|
9
|
-
export * from "./typings";
|
|
10
|
-
export * from "./constants";
|
|
11
|
-
declare type ValConfig = {
|
|
12
|
-
prefersColorScheme: Val<TeleBoxColorScheme, boolean>;
|
|
13
|
-
containerRect: Val<TeleBoxRect, boolean>;
|
|
14
|
-
collector: Val<TeleBoxCollector | null>;
|
|
15
|
-
collectorRect: Val<TeleBoxRect | undefined>;
|
|
16
|
-
readonly: Val<boolean, boolean>;
|
|
17
|
-
minimized: Val<boolean, boolean>;
|
|
18
|
-
maximized: Val<boolean, boolean>;
|
|
19
|
-
fence: Val<boolean, boolean>;
|
|
20
|
-
};
|
|
21
|
-
export interface TeleBoxManager extends ValEnhancedResult<ValConfig> {
|
|
22
|
-
}
|
|
23
|
-
export declare class TeleBoxManager {
|
|
24
|
-
constructor({ root, prefersColorScheme, minimized, maximized, fence, containerRect, collector, namespace, readonly, }?: TeleBoxManagerConfig);
|
|
25
|
-
get boxes(): ReadonlyArray<TeleBox>;
|
|
26
|
-
get topBox(): TeleBox | undefined;
|
|
27
|
-
readonly events: TeleBoxManagerEvents;
|
|
28
|
-
protected _sideEffect: SideEffectManager;
|
|
29
|
-
protected root: HTMLElement;
|
|
30
|
-
readonly namespace: string;
|
|
31
|
-
_darkMode$: Val<boolean, boolean>;
|
|
32
|
-
get darkMode(): boolean;
|
|
33
|
-
_state$: Val<TeleBoxState, boolean>;
|
|
34
|
-
get state(): TeleBoxState;
|
|
35
|
-
/** @deprecated use setMaximized and setMinimized instead */
|
|
36
|
-
setState(state: TeleBoxState, skipUpdate?: boolean): this;
|
|
37
|
-
create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
|
|
38
|
-
query(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox[];
|
|
39
|
-
queryOne(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox | undefined;
|
|
40
|
-
update(boxID: string, config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
|
|
41
|
-
updateAll(config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
|
|
42
|
-
remove(boxOrID: string | TeleBox, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
|
|
43
|
-
removeTopBox(): ReadonlyTeleBox | undefined;
|
|
44
|
-
removeAll(skipUpdate?: boolean): ReadonlyTeleBox[];
|
|
45
|
-
destroy(skipUpdate?: boolean): void;
|
|
46
|
-
wrapClassName(className: string): string;
|
|
47
|
-
focusBox(boxOrID: string | TeleBox, skipUpdate?: boolean): void;
|
|
48
|
-
focusTopBox(): void;
|
|
49
|
-
blurBox(boxOrID: string | TeleBox, skipUpdate?: boolean): void;
|
|
50
|
-
blurAll(skipUpdate?: boolean): void;
|
|
51
|
-
protected maxTitleBar: MaxTitleBar;
|
|
52
|
-
protected boxes$: Val<TeleBox[]>;
|
|
53
|
-
protected topBox$: Val<TeleBox | undefined>;
|
|
54
|
-
protected teleBoxMatcher(config: TeleBoxManagerQueryConfig): (box: TeleBox) => boolean;
|
|
55
|
-
protected updateBox(box: TeleBox, config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
|
|
56
|
-
protected smartPosition(config?: TeleBoxConfig): TeleBoxConfig;
|
|
57
|
-
protected makeBoxTop(box: TeleBox, skipUpdate?: boolean): void;
|
|
58
|
-
protected getBoxIndex(boxOrID: TeleBox | string): number;
|
|
59
|
-
protected getBox(boxOrID: TeleBox | string): TeleBox | undefined;
|
|
60
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type EventEmitter from "eventemitter3";
|
|
2
|
-
import { TeleBoxColorScheme } from "..";
|
|
3
|
-
import type { ReadonlyTeleBox, TeleBoxState } from "../TeleBox";
|
|
4
|
-
import type { TeleBoxConfig } from "../TeleBox/typings";
|
|
5
|
-
import type { TeleBoxCollector } from "../TeleBoxCollector";
|
|
6
|
-
import type { TELE_BOX_MANAGER_EVENT } from "./constants";
|
|
7
|
-
export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme" | "fence" | "containerRect" | "maximized" | "minimized" | "namespace" | "readonly"> {
|
|
8
|
-
/** Element to mount boxes. */
|
|
9
|
-
root?: HTMLElement;
|
|
10
|
-
/** Where the minimized boxes go. */
|
|
11
|
-
collector?: TeleBoxCollector;
|
|
12
|
-
}
|
|
13
|
-
declare type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex";
|
|
14
|
-
export declare type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus">;
|
|
15
|
-
export declare type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "id" | "focus">;
|
|
16
|
-
export declare type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer">;
|
|
17
|
-
declare type CheckTeleBoxManagerConfig<T extends Record<`${TELE_BOX_MANAGER_EVENT}`, any>> = T;
|
|
18
|
-
export declare type TeleBoxManagerEventConfig = CheckTeleBoxManagerConfig<{
|
|
19
|
-
focused: [ReadonlyTeleBox | undefined];
|
|
20
|
-
blurred: [ReadonlyTeleBox | undefined];
|
|
21
|
-
created: [ReadonlyTeleBox];
|
|
22
|
-
removed: [ReadonlyTeleBox[]];
|
|
23
|
-
state: [TeleBoxState];
|
|
24
|
-
maximized: [boolean];
|
|
25
|
-
minimized: [boolean];
|
|
26
|
-
move: [ReadonlyTeleBox];
|
|
27
|
-
resize: [ReadonlyTeleBox];
|
|
28
|
-
intrinsic_move: [ReadonlyTeleBox];
|
|
29
|
-
intrinsic_resize: [ReadonlyTeleBox];
|
|
30
|
-
visual_resize: [ReadonlyTeleBox];
|
|
31
|
-
z_index: [ReadonlyTeleBox];
|
|
32
|
-
prefers_color_scheme: [TeleBoxColorScheme];
|
|
33
|
-
dark_mode: [boolean];
|
|
34
|
-
}>;
|
|
35
|
-
export declare type TeleBoxManagerEvent = keyof TeleBoxManagerEventConfig;
|
|
36
|
-
export interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
|
|
37
|
-
on<U extends TeleBoxManagerEvent>(event: U, listener: (...value: TeleBoxManagerEventConfig[U]) => void): this;
|
|
38
|
-
once<U extends TeleBoxManagerEvent>(event: U, listener: (...value: TeleBoxManagerEventConfig[U]) => void): this;
|
|
39
|
-
addListener<U extends TeleBoxManagerEvent>(event: U, listener: (...value: TeleBoxManagerEventConfig[U]) => void): this;
|
|
40
|
-
emit<U extends TeleBoxManagerEvent>(event: U, ...value: TeleBoxManagerEventConfig[U]): boolean;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { TeleBoxReactProps } from ".";
|
|
3
|
-
declare const storyMeta: Meta<TeleBoxReactProps>;
|
|
4
|
-
export default storyMeta;
|
|
5
|
-
export declare const Overview: Story<TeleBoxReactProps>;
|
|
6
|
-
export declare const Resizable: Story<TeleBoxReactProps>;
|
|
7
|
-
export declare const Draggable: Story<TeleBoxReactProps>;
|
|
8
|
-
export declare const FixRatio: Story<TeleBoxReactProps>;
|
|
9
|
-
export declare const Readonly: Story<TeleBoxReactProps>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
import { TeleBoxConfig, TeleBoxState } from "../TeleBox/typings";
|
|
3
|
-
export declare type TeleBoxReactProps = TeleBoxConfig & {
|
|
4
|
-
onResize?: (event: {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
}) => void;
|
|
8
|
-
onMove?: (event: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}) => void;
|
|
12
|
-
onClose?: () => void;
|
|
13
|
-
onFocus?: () => void;
|
|
14
|
-
onBlur?: () => void;
|
|
15
|
-
onStateChanged?: (state: TeleBoxState) => void;
|
|
16
|
-
};
|
|
17
|
-
export declare const TeleBoxReact: FC<TeleBoxReactProps>;
|