@netless/window-manager 0.3.16-canary.3 → 0.3.17-canary.2
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/BoxManager.d.ts +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/src/AppManager.ts +3 -6
- package/src/AppProxy.ts +3 -1
- package/src/AttributesDelegate.ts +1 -1
- package/src/Base/Context.ts +1 -1
- package/src/BoxManager.ts +15 -16
- package/src/constants.ts +1 -1
- package/src/index.ts +2 -1
- package/yarn-error.log +4285 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.17-canary.2",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.es.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -22,9 +22,9 @@
|
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
24
|
"@juggle/resize-observer": "^3.3.1",
|
25
|
-
"@netless/app-docs-viewer": "0.1.
|
25
|
+
"@netless/app-docs-viewer": "0.1.26",
|
26
26
|
"@netless/app-media-player": "0.1.0-beta.5",
|
27
|
-
"@netless/telebox-insider": "0.2.
|
27
|
+
"@netless/telebox-insider": "^0.2.16",
|
28
28
|
"emittery": "^0.9.2",
|
29
29
|
"lodash": "^4.17.21",
|
30
30
|
"p-retry": "^4.6.1",
|
package/src/AppManager.ts
CHANGED
@@ -98,9 +98,8 @@ export class AppManager {
|
|
98
98
|
return autorun(() => {
|
99
99
|
const minimized = this.attributes.minimized;
|
100
100
|
if (this.boxManager.minimized !== minimized) {
|
101
|
-
if (minimized === true
|
102
|
-
this.
|
103
|
-
this.boxManager.blurFocusBox();
|
101
|
+
if (minimized === true) {
|
102
|
+
this.boxManager.blurAllBox();
|
104
103
|
}
|
105
104
|
this.boxManager.setMinimized(Boolean(minimized));
|
106
105
|
}
|
@@ -208,6 +207,7 @@ export class AppManager {
|
|
208
207
|
x: box?.intrinsicX,
|
209
208
|
y: box?.intrinsicY,
|
210
209
|
});
|
210
|
+
this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
|
211
211
|
}
|
212
212
|
if (this.boxManager.minimized) {
|
213
213
|
this.boxManager.setMinimized(false, false);
|
@@ -395,9 +395,6 @@ export class AppManager {
|
|
395
395
|
if (appProxy) {
|
396
396
|
appProxy.destroy(false, true, payload.error);
|
397
397
|
}
|
398
|
-
if (this.boxManager.maximized) {
|
399
|
-
this.boxManager.focusTopBox();
|
400
|
-
}
|
401
398
|
break;
|
402
399
|
}
|
403
400
|
case "boxStateChange": {
|
package/src/AppProxy.ts
CHANGED
@@ -172,6 +172,7 @@ export class AppProxy extends Base {
|
|
172
172
|
app,
|
173
173
|
options,
|
174
174
|
canOperate: this.manager.canOperate,
|
175
|
+
smartPosition: this.isAddApp,
|
175
176
|
});
|
176
177
|
} catch (error: any) {
|
177
178
|
console.error(error);
|
@@ -247,7 +248,8 @@ export class AppProxy extends Base {
|
|
247
248
|
const sceneIndex = attrs?.[AppAttributes.SceneIndex];
|
248
249
|
const maximized = this.attributes?.["maximized"];
|
249
250
|
const minimized = this.attributes?.["minimized"];
|
250
|
-
|
251
|
+
const zIndex = attrs?.zIndex;
|
252
|
+
let payload = { maximized, minimized, zIndex } as AppInitState;
|
251
253
|
if (position) {
|
252
254
|
payload = { ...payload, id: id, x: position.x, y: position.y };
|
253
255
|
}
|
@@ -74,8 +74,8 @@ export class AttributesDelegate {
|
|
74
74
|
this.manager.safeUpdateAttributes([Fields.Apps, id, Fields.State], {
|
75
75
|
[AppAttributes.Size]: {},
|
76
76
|
[AppAttributes.Position]: {},
|
77
|
-
[AppAttributes.SnapshotRect]: {},
|
78
77
|
[AppAttributes.SceneIndex]: 0,
|
78
|
+
[AppAttributes.ZIndex]: 100,
|
79
79
|
});
|
80
80
|
}
|
81
81
|
|
package/src/Base/Context.ts
CHANGED
package/src/BoxManager.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { callbacks, emitter, WindowManager } from "./index";
|
2
2
|
import { debounce, maxBy } from "lodash";
|
3
|
-
import { DEFAULT_COLLECTOR_STYLE, Events, MIN_HEIGHT, MIN_WIDTH } from "./constants";
|
3
|
+
import { AppAttributes, DEFAULT_COLLECTOR_STYLE, Events, MIN_HEIGHT, MIN_WIDTH } from "./constants";
|
4
4
|
import {
|
5
5
|
TELE_BOX_MANAGER_EVENT,
|
6
6
|
TELE_BOX_STATE,
|
@@ -29,6 +29,7 @@ export type CreateBoxParams = {
|
|
29
29
|
emitter?: Emittery;
|
30
30
|
options?: AddAppOptions;
|
31
31
|
canOperate?: boolean;
|
32
|
+
smartPosition?: boolean;
|
32
33
|
};
|
33
34
|
|
34
35
|
type AppId = { appId: string };
|
@@ -65,6 +66,10 @@ export class BoxManager {
|
|
65
66
|
});
|
66
67
|
this.teleBoxManager.events.on("minimized", minimized => {
|
67
68
|
this.manager.safeSetAttributes({ minimized });
|
69
|
+
if (minimized) {
|
70
|
+
this.manager.store.cleanFocus();
|
71
|
+
this.blurAllBox();
|
72
|
+
}
|
68
73
|
});
|
69
74
|
this.teleBoxManager.events.on("maximized", maximized => {
|
70
75
|
this.manager.safeSetAttributes({ maximized });
|
@@ -95,10 +100,8 @@ export class BoxManager {
|
|
95
100
|
if (this.manager.canOperate) {
|
96
101
|
emitter.emit("focus", { appId: box.id });
|
97
102
|
} else {
|
98
|
-
this.teleBoxManager.
|
103
|
+
this.teleBoxManager.blurBox(box.id);
|
99
104
|
}
|
100
|
-
} else {
|
101
|
-
this.blurFocusBox();
|
102
105
|
}
|
103
106
|
});
|
104
107
|
this.teleBoxManager.events.on("dark_mode", darkMode => {
|
@@ -107,6 +110,9 @@ export class BoxManager {
|
|
107
110
|
this.teleBoxManager.events.on("prefers_color_scheme", colorScheme => {
|
108
111
|
callbacks.emit("prefersColorSchemeChange", colorScheme);
|
109
112
|
});
|
113
|
+
this.teleBoxManager.events.on("z_index", box => {
|
114
|
+
this.manager.store.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
115
|
+
});
|
110
116
|
}
|
111
117
|
|
112
118
|
public get boxState() {
|
@@ -152,7 +158,7 @@ export class BoxManager {
|
|
152
158
|
height,
|
153
159
|
id: params.appId,
|
154
160
|
};
|
155
|
-
this.teleBoxManager.create(createBoxConfig);
|
161
|
+
this.teleBoxManager.create(createBoxConfig, params.smartPosition);
|
156
162
|
emitter.emit(`${params.appId}${Events.WindowCreated}` as any);
|
157
163
|
}
|
158
164
|
|
@@ -239,6 +245,7 @@ export class BoxManager {
|
|
239
245
|
y: state.y,
|
240
246
|
width: state.width || 0.5,
|
241
247
|
height: state.height || 0.5,
|
248
|
+
zIndex: state.zIndex,
|
242
249
|
},
|
243
250
|
true
|
244
251
|
);
|
@@ -248,7 +255,7 @@ export class BoxManager {
|
|
248
255
|
}
|
249
256
|
setTimeout(() => {
|
250
257
|
if (state.focus) {
|
251
|
-
this.teleBoxManager.
|
258
|
+
this.teleBoxManager.focusBox(box.id, true)
|
252
259
|
}
|
253
260
|
}, 50);
|
254
261
|
callbacks.emit("boxStateChange", this.teleBoxManager.state);
|
@@ -269,7 +276,7 @@ export class BoxManager {
|
|
269
276
|
}
|
270
277
|
|
271
278
|
public focusBox({ appId }: AppId, skipUpdate = true): void {
|
272
|
-
this.teleBoxManager.
|
279
|
+
this.teleBoxManager.focusBox(appId, skipUpdate);
|
273
280
|
}
|
274
281
|
|
275
282
|
public resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void {
|
@@ -292,15 +299,7 @@ export class BoxManager {
|
|
292
299
|
}
|
293
300
|
|
294
301
|
public blurAllBox(): void {
|
295
|
-
this.teleBoxManager.
|
296
|
-
}
|
297
|
-
|
298
|
-
public blurFocusBox(): void {
|
299
|
-
const focusBoxes = this.teleBoxManager.query({ focus: true });
|
300
|
-
if (focusBoxes.length) {
|
301
|
-
const box = focusBoxes[0];
|
302
|
-
this.teleBoxManager.update(box.id, { focus: false });
|
303
|
-
}
|
302
|
+
this.teleBoxManager.blurAll();
|
304
303
|
}
|
305
304
|
|
306
305
|
public updateAll(config: TeleBoxManagerUpdateConfig): void {
|
package/src/constants.ts
CHANGED
package/src/index.ts
CHANGED
@@ -121,6 +121,7 @@ export type AppInitState = {
|
|
121
121
|
minimized?: boolean;
|
122
122
|
sceneIndex?: number;
|
123
123
|
boxState?: TeleBoxState; // 兼容旧版 telebox
|
124
|
+
zIndex?: number;
|
124
125
|
};
|
125
126
|
|
126
127
|
export type EmitterEvent = {
|
@@ -176,7 +177,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
176
177
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
177
178
|
private static isCreated = false;
|
178
179
|
|
179
|
-
public version = "0.3.
|
180
|
+
public version = "0.3.17-canary.2";
|
180
181
|
|
181
182
|
public appListeners?: AppListeners;
|
182
183
|
|