@netless/window-manager 1.0.7-beta.6 → 1.0.7-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.7-beta.6",
3
+ "version": "1.0.7-beta.7",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@juggle/resize-observer": "^3.3.1",
35
- "@netless/telebox-insider": "0.3.0-beta.10",
35
+ "@netless/telebox-insider": "0.3.0-beta.13",
36
36
  "emittery": "^0.9.2",
37
37
  "lodash": "^4.17.21",
38
38
  "p-retry": "^4.6.1",
@@ -152,7 +152,10 @@ export class AppProxy implements PageRemoveService {
152
152
  appImpl,
153
153
  params.options,
154
154
  appParams?.appOptions,
155
- this.manager.useBoxesStatus ? TELE_BOX_STATE.Normal : undefined
155
+ this.manager.useBoxesStatus ? TELE_BOX_STATE.Normal : undefined,
156
+ params.forceTop,
157
+ params.forceNormal,
158
+ params.isDragContent
156
159
  );
157
160
  } else {
158
161
  throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
@@ -174,9 +177,12 @@ export class AppProxy implements PageRemoveService {
174
177
  app: NetlessApp,
175
178
  options?: setAppOptions,
176
179
  appOptions?: any,
177
- boxStatus?: TeleBoxState
180
+ boxStatus?: TeleBoxState,
181
+ forceTop?: boolean,
182
+ forceNormal?: boolean,
183
+ isDragContent?: boolean
178
184
  ) {
179
- log("setupApp", appId, app, options, boxStatus);
185
+ log("setupApp", appId, app, options, boxStatus, forceTop, forceNormal, isDragContent);
180
186
  if (!this.boxManager) {
181
187
  throw new BoxManagerNotFoundError();
182
188
  }
@@ -219,6 +225,9 @@ export class AppProxy implements PageRemoveService {
219
225
  canOperate: this.manager.canOperate,
220
226
  smartPosition: this.isAddApp,
221
227
  boxStatus,
228
+ forceTop,
229
+ forceNormal,
230
+ isDragContent,
222
231
  });
223
232
  if (this.isAddApp && this.box) {
224
233
  if (boxStatus) {
@@ -311,6 +320,7 @@ export class AppProxy implements PageRemoveService {
311
320
  const minimized = this.attributes?.["minimized"];
312
321
  const boxStatus = this.store.getBoxStatus(id) ?? undefined;
313
322
  const lastNotMinimizedBoxStatus = this.store.getLastNotMinimizedBoxStatus(id) ?? undefined;
323
+ const { forceTop, forceNormal, isDragContent } = this.store.getAppAttributes(id);
314
324
  const zIndex = attrs?.zIndex;
315
325
  let payload = { maximized, minimized, zIndex } as AppInitState;
316
326
  if (position) {
@@ -331,6 +341,15 @@ export class AppProxy implements PageRemoveService {
331
341
  if (lastNotMinimizedBoxStatus) {
332
342
  payload = { ...payload, lastNotMinimizedBoxStatus };
333
343
  }
344
+ if (forceTop) {
345
+ payload = { ...payload, forceTop };
346
+ }
347
+ if (forceNormal) {
348
+ payload = { ...payload, forceNormal };
349
+ }
350
+ if (isDragContent) {
351
+ payload = { ...payload, isDragContent };
352
+ }
334
353
  return payload;
335
354
  };
336
355
 
package/src/AppManager.ts CHANGED
@@ -602,6 +602,9 @@ export class AppManager {
602
602
  kind: app.kind,
603
603
  options: app.options,
604
604
  isDynamicPPT: app.isDynamicPPT,
605
+ forceNormal: app.forceNormal,
606
+ forceTop: app.forceTop,
607
+ isDragContent: app.isDragContent,
605
608
  },
606
609
  id,
607
610
  false
@@ -133,7 +133,14 @@ export class AttributesDelegate {
133
133
  attrNames.push("scenes");
134
134
  }
135
135
  const options = pick(params.options, attrNames);
136
- const attrs: AppSyncAttributes = { kind: params.kind, options, isDynamicPPT };
136
+ const attrs: AppSyncAttributes = {
137
+ kind: params.kind,
138
+ options,
139
+ isDynamicPPT,
140
+ forceTop: params.forceTop,
141
+ forceNormal: params.forceNormal,
142
+ isDragContent: params.isDragContent,
143
+ };
137
144
  if (typeof params.src === "string") {
138
145
  attrs.src = params.src;
139
146
  }
package/src/BoxManager.ts CHANGED
@@ -33,6 +33,9 @@ export type CreateBoxParams = {
33
33
  canOperate?: boolean;
34
34
  smartPosition?: boolean;
35
35
  boxStatus?: TeleBoxState;
36
+ forceTop?: boolean;
37
+ forceNormal?: boolean;
38
+ isDragContent?: boolean;
36
39
  };
37
40
 
38
41
  type AppId = { appId: string };
@@ -270,6 +273,9 @@ export class BoxManager {
270
273
  height,
271
274
  id: params.appId,
272
275
  boxStatus: params.boxStatus,
276
+ forceTop: params.forceTop,
277
+ forceNormal: params.forceNormal,
278
+ isDragContent: params.isDragContent,
273
279
  };
274
280
  this.teleBoxManager.create(createBoxConfig, params.smartPosition);
275
281
  this.context.emitter.emit(`${params.appId}${Events.WindowCreated}` as any);
@@ -386,6 +392,9 @@ export class BoxManager {
386
392
  zIndex: state.zIndex,
387
393
  boxStatus: state.boxStatus,
388
394
  lastNotMinimizedBoxStatus: state.lastNotMinimizedBoxStatus,
395
+ forceTop: state.forceTop,
396
+ forceNormal: state.forceNormal,
397
+ isDragContent: state.isDragContent,
389
398
  },
390
399
  true
391
400
  );
package/src/index.ts CHANGED
@@ -97,6 +97,12 @@ export type AddAppParams<TAttributes = any> = {
97
97
  options?: AddAppOptions;
98
98
  // 初始化 attributes
99
99
  attributes?: TAttributes;
100
+ // 强制置顶
101
+ forceTop?: boolean;
102
+ // 强制正常窗口
103
+ forceNormal?: boolean;
104
+ // 是否可以在内容区域拖动
105
+ isDragContent?: boolean;
100
106
  };
101
107
 
102
108
  export type BaseInsertParams = {
@@ -108,6 +114,12 @@ export type BaseInsertParams = {
108
114
  // 初始化 attributes
109
115
  attributes?: any;
110
116
  isDynamicPPT?: boolean;
117
+ // 强制置顶
118
+ forceTop?: boolean;
119
+ // 强制正常窗口
120
+ forceNormal?: boolean;
121
+ // 是否可以在内容区域拖动
122
+ isDragContent?: boolean;
111
123
  };
112
124
 
113
125
  export type AppSyncAttributes = {
@@ -118,6 +130,12 @@ export type AppSyncAttributes = {
118
130
  isDynamicPPT?: boolean;
119
131
  fullPath?: string;
120
132
  createdAt?: number;
133
+ // 强制置顶
134
+ forceTop?: boolean;
135
+ // 强制正常窗口
136
+ forceNormal?: boolean;
137
+ // 是否可以在内容区域拖动
138
+ isDragContent?: boolean;
121
139
  };
122
140
 
123
141
  export type AppInitState = {
@@ -137,6 +155,12 @@ export type AppInitState = {
137
155
  boxStatus?: TeleBoxState;
138
156
  /** 上次非最小化窗口状态 */
139
157
  lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
158
+ // 强制置顶
159
+ forceTop?: boolean;
160
+ // 强制正常窗口
161
+ forceNormal?: boolean;
162
+ // 是否可以在内容区域拖动
163
+ isDragContent?: boolean;
140
164
  };
141
165
 
142
166
  export type CursorMovePayload = { uid: string; state?: "leave"; position: Position };