@netless/window-manager 0.3.16-canary.2 → 0.3.17-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BoxManager.d.ts +3 -2
- 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 +2 -1
- package/src/AppProxy.ts +3 -1
- package/src/AttributesDelegate.ts +1 -1
- package/src/Base/Context.ts +1 -1
- package/src/BoxManager.ts +22 -17
- 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.1",
|
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
@@ -100,7 +100,7 @@ export class AppManager {
|
|
100
100
|
if (this.boxManager.minimized !== minimized) {
|
101
101
|
if (minimized === true && this.store.focus !== undefined) {
|
102
102
|
this.store.cleanFocus();
|
103
|
-
this.boxManager.
|
103
|
+
this.boxManager.blurAllBox();
|
104
104
|
}
|
105
105
|
this.boxManager.setMinimized(Boolean(minimized));
|
106
106
|
}
|
@@ -208,6 +208,7 @@ export class AppManager {
|
|
208
208
|
x: box?.intrinsicX,
|
209
209
|
y: box?.intrinsicY,
|
210
210
|
});
|
211
|
+
this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
|
211
212
|
}
|
212
213
|
if (this.boxManager.minimized) {
|
213
214
|
this.boxManager.setMinimized(false, false);
|
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 };
|
@@ -95,10 +96,8 @@ export class BoxManager {
|
|
95
96
|
if (this.manager.canOperate) {
|
96
97
|
emitter.emit("focus", { appId: box.id });
|
97
98
|
} else {
|
98
|
-
this.teleBoxManager.
|
99
|
+
this.teleBoxManager.blurBox(box.id);
|
99
100
|
}
|
100
|
-
} else {
|
101
|
-
this.blurFocusBox();
|
102
101
|
}
|
103
102
|
});
|
104
103
|
this.teleBoxManager.events.on("dark_mode", darkMode => {
|
@@ -107,6 +106,9 @@ export class BoxManager {
|
|
107
106
|
this.teleBoxManager.events.on("prefers_color_scheme", colorScheme => {
|
108
107
|
callbacks.emit("prefersColorSchemeChange", colorScheme);
|
109
108
|
});
|
109
|
+
this.teleBoxManager.events.on("z_index", box => {
|
110
|
+
this.manager.store.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
111
|
+
});
|
110
112
|
}
|
111
113
|
|
112
114
|
public get boxState() {
|
@@ -152,7 +154,7 @@ export class BoxManager {
|
|
152
154
|
height,
|
153
155
|
id: params.appId,
|
154
156
|
};
|
155
|
-
this.teleBoxManager.create(createBoxConfig);
|
157
|
+
this.teleBoxManager.create(createBoxConfig, params.smartPosition);
|
156
158
|
emitter.emit(`${params.appId}${Events.WindowCreated}` as any);
|
157
159
|
}
|
158
160
|
|
@@ -239,6 +241,7 @@ export class BoxManager {
|
|
239
241
|
y: state.y,
|
240
242
|
width: state.width || 0.5,
|
241
243
|
height: state.height || 0.5,
|
244
|
+
zIndex: state.zIndex,
|
242
245
|
},
|
243
246
|
true
|
244
247
|
);
|
@@ -248,7 +251,7 @@ export class BoxManager {
|
|
248
251
|
}
|
249
252
|
setTimeout(() => {
|
250
253
|
if (state.focus) {
|
251
|
-
this.teleBoxManager.
|
254
|
+
this.teleBoxManager.focusBox(box.id, true)
|
252
255
|
}
|
253
256
|
}, 50);
|
254
257
|
callbacks.emit("boxStateChange", this.teleBoxManager.state);
|
@@ -268,8 +271,8 @@ export class BoxManager {
|
|
268
271
|
this.teleBoxManager.update(appId, { x, y }, true);
|
269
272
|
}
|
270
273
|
|
271
|
-
public focusBox({ appId }: AppId): void {
|
272
|
-
this.teleBoxManager.
|
274
|
+
public focusBox({ appId }: AppId, skipUpdate = true): void {
|
275
|
+
this.teleBoxManager.focusBox(appId, skipUpdate);
|
273
276
|
}
|
274
277
|
|
275
278
|
public resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void {
|
@@ -292,15 +295,7 @@ export class BoxManager {
|
|
292
295
|
}
|
293
296
|
|
294
297
|
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
|
-
}
|
298
|
+
this.teleBoxManager.blurAll();
|
304
299
|
}
|
305
300
|
|
306
301
|
public updateAll(config: TeleBoxManagerUpdateConfig): void {
|
@@ -315,6 +310,16 @@ export class BoxManager {
|
|
315
310
|
this.teleBoxManager.setMinimized(minimized, skipUpdate);
|
316
311
|
}
|
317
312
|
|
313
|
+
public focusTopBox(): void {
|
314
|
+
const boxes = this.teleBoxManager.query();
|
315
|
+
if (boxes.length >= 1) {
|
316
|
+
const box = this.getTopBox();
|
317
|
+
if (box) {
|
318
|
+
this.focusBox({ appId: box.id }, false);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
318
323
|
public setReadonly(readonly: boolean) {
|
319
324
|
this.teleBoxManager.setReadonly(readonly);
|
320
325
|
}
|
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.1";
|
180
181
|
|
181
182
|
public appListeners?: AppListeners;
|
182
183
|
|