@netless/window-manager 1.0.0-canary.26 → 1.0.0-canary.27
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/App/WhiteboardView.d.ts +3 -1
- package/dist/BoxManager.d.ts +2 -4
- package/dist/BuiltinApps.d.ts +3 -0
- package/dist/Helper.d.ts +1 -1
- package/dist/callback.d.ts +5 -0
- package/dist/index.cjs.js +82 -12
- package/dist/index.d.ts +5 -1
- package/dist/index.es.js +1531 -657
- package/dist/index.umd.js +82 -12
- package/dist/src/App/AppContext.d.ts +78 -0
- package/dist/src/App/AppPageStateImpl.d.ts +21 -0
- package/dist/src/App/AppProxy.d.ts +98 -0
- package/dist/src/App/MagixEvent/index.d.ts +29 -0
- package/dist/src/App/Storage/StorageEvent.d.ts +8 -0
- package/dist/src/App/Storage/index.d.ts +39 -0
- package/dist/src/App/Storage/typings.d.ts +22 -0
- package/dist/src/App/Storage/utils.d.ts +5 -0
- package/dist/src/App/WhiteboardView.d.ts +27 -0
- package/dist/src/App/index.d.ts +4 -0
- package/dist/src/App/type.d.ts +21 -0
- package/dist/src/AppListener.d.ts +19 -0
- package/dist/src/AppManager.d.ts +107 -0
- package/dist/src/AttributesDelegate.d.ts +83 -0
- package/dist/src/BoxEmitter.d.ts +34 -0
- package/dist/src/BoxManager.d.ts +102 -0
- package/dist/src/BuiltinApps.d.ts +8 -0
- package/dist/src/Cursor/Cursor.d.ts +39 -0
- package/dist/src/Cursor/icons.d.ts +3 -0
- package/dist/src/Cursor/index.d.ts +46 -0
- package/dist/src/Helper.d.ts +19 -0
- package/dist/src/InternalEmitter.d.ts +38 -0
- package/dist/src/Page/PageController.d.ts +21 -0
- package/dist/src/Page/index.d.ts +3 -0
- package/dist/src/PageState.d.ts +9 -0
- package/dist/src/ReconnectRefresher.d.ts +24 -0
- package/dist/src/RedoUndo.d.ts +18 -0
- package/dist/src/Register/index.d.ts +28 -0
- package/dist/src/Register/loader.d.ts +4 -0
- package/dist/src/Register/storage.d.ts +8 -0
- package/dist/src/Utils/AppCreateQueue.d.ts +15 -0
- package/dist/src/Utils/Common.d.ts +23 -0
- package/dist/src/Utils/Reactive.d.ts +6 -0
- package/dist/src/Utils/RoomHacker.d.ts +3 -0
- package/dist/src/Utils/error.d.ts +27 -0
- package/dist/src/Utils/log.d.ts +1 -0
- package/dist/src/View/CameraSynchronizer.d.ts +17 -0
- package/dist/src/View/MainView.d.ts +59 -0
- package/dist/src/View/ViewManager.d.ts +13 -0
- package/dist/src/View/ViewSync.d.ts +24 -0
- package/dist/src/callback.d.ts +29 -0
- package/dist/src/constants.d.ts +51 -0
- package/dist/src/image.d.ts +19 -0
- package/dist/src/index.d.ts +267 -0
- package/dist/src/shim.d.ts +11 -0
- package/dist/src/typings.d.ts +88 -0
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +6 -0
- package/docs/app-context.md +2 -2
- package/package.json +9 -4
- package/playwright.config.ts +28 -0
- package/pnpm-lock.yaml +514 -21
- package/src/App/AppContext.ts +2 -2
- package/src/App/AppProxy.ts +13 -7
- package/src/App/WhiteboardView.ts +19 -14
- package/src/BoxManager.ts +32 -36
- package/src/BuiltinApps.ts +5 -0
- package/src/Helper.ts +3 -2
- package/src/View/CameraSynchronizer.ts +3 -7
- package/src/callback.ts +1 -0
- package/src/index.ts +18 -5
- package/src/style.css +3 -41
- package/src/typings.ts +6 -0
- package/vite.config.js +5 -3
package/src/App/AppContext.ts
CHANGED
@@ -107,7 +107,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
107
107
|
const viewWrapper = document.createElement("div");
|
108
108
|
this._viewWrapper = viewWrapper;
|
109
109
|
viewWrapper.className = "window-manager-view-wrapper";
|
110
|
-
this.box.$
|
110
|
+
this.box.$main.appendChild(viewWrapper);
|
111
111
|
view.divElement = viewWrapper;
|
112
112
|
this.appProxy.fireMemberStateChange();
|
113
113
|
if (this.isAddApp) {
|
@@ -115,7 +115,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
|
|
115
115
|
}
|
116
116
|
this.whiteBoardView = new WhiteBoardView(view, this, this.appProxy, this.ensurePageSize);
|
117
117
|
this.appProxy.sideEffectManager.add(() => [
|
118
|
-
this.box.
|
118
|
+
this.box._stageRect$.subscribe(rect => {
|
119
119
|
viewWrapper.style.left = `${rect.x}px`;
|
120
120
|
viewWrapper.style.top = `${rect.y}px`;
|
121
121
|
viewWrapper.style.width = `${rect.width}px`;
|
package/src/App/AppProxy.ts
CHANGED
@@ -32,9 +32,10 @@ import type {
|
|
32
32
|
import type { SceneState, View, SceneDefinition, MemberState} from "white-web-sdk";
|
33
33
|
import type { AppManager } from "../AppManager";
|
34
34
|
import type { NetlessApp } from "../typings";
|
35
|
-
import type { ReadonlyTeleBox, TeleBoxRect } from "@netless/telebox-insider";
|
35
|
+
import type { ReadonlyTeleBox, TeleBox, TeleBoxRect } from "@netless/telebox-insider";
|
36
36
|
import type { PageRemoveService, PageState } from "../Page";
|
37
37
|
import type { AppState } from "./type";
|
38
|
+
import { callbacks } from "../callback";
|
38
39
|
|
39
40
|
export type AppEmitter = Emittery<AppEmitterEvent>;
|
40
41
|
|
@@ -142,10 +143,10 @@ export class AppProxy implements PageRemoveService {
|
|
142
143
|
});
|
143
144
|
this.camera$.setValue(toJS(this.appAttributes.camera));
|
144
145
|
}
|
145
|
-
if (!this.size$.value && box.
|
146
|
-
const initialRect = this.computedInitialRect(box.
|
147
|
-
const width = initialRect?.width || box.
|
148
|
-
const height = initialRect?.height || box.
|
146
|
+
if (!this.size$.value && box.stageRect) {
|
147
|
+
const initialRect = this.computedInitialRect(box.stageRect);
|
148
|
+
const width = initialRect?.width || box.stageRect.width;
|
149
|
+
const height = initialRect?.height || box.stageRect.height;
|
149
150
|
this.storeSize({
|
150
151
|
id: this.uid,
|
151
152
|
width,
|
@@ -158,7 +159,7 @@ export class AppProxy implements PageRemoveService {
|
|
158
159
|
view$: this.view$,
|
159
160
|
camera$: this.camera$,
|
160
161
|
size$: this.size$,
|
161
|
-
stageRect$: box.
|
162
|
+
stageRect$: box._stageRect$,
|
162
163
|
storeCamera: this.storeCamera,
|
163
164
|
storeSize: this.storeSize
|
164
165
|
});
|
@@ -341,7 +342,11 @@ export class AppProxy implements PageRemoveService {
|
|
341
342
|
options,
|
342
343
|
canOperate: this.manager.canOperate,
|
343
344
|
smartPosition: this.isAddApp,
|
344
|
-
});
|
345
|
+
}) as TeleBox;
|
346
|
+
const registerParams = appRegister.registered.get(this.kind);
|
347
|
+
if (registerParams?.contentStyles) {
|
348
|
+
box?.mountUserStyles(registerParams.contentStyles);
|
349
|
+
}
|
345
350
|
this.box$.setValue(box);
|
346
351
|
if (this.isAddApp && this.box) {
|
347
352
|
this.store.updateAppState(appId, AppAttributes.ZIndex, this.box.zIndex);
|
@@ -626,6 +631,7 @@ export class AppProxy implements PageRemoveService {
|
|
626
631
|
this.status = "destroyed";
|
627
632
|
try {
|
628
633
|
await appRegister.notifyApp(this.kind, "destroy", { appId: this.id });
|
634
|
+
callbacks.emit("appClose", { appId: this.id, kind: this.kind, error });
|
629
635
|
await this.appEmitter.emit("destroy", { error });
|
630
636
|
} catch (error) {
|
631
637
|
console.error("[WindowManager]: notifyApp error", error.message, error.stack);
|
@@ -6,15 +6,17 @@ import type { ReadonlyVal } from "value-enhancer";
|
|
6
6
|
import type { AddPageParams, PageController, PageState } from "../Page";
|
7
7
|
import type { AppProxy } from "./AppProxy";
|
8
8
|
import type { AppContext } from "./AppContext";
|
9
|
-
import type { View } from "white-web-sdk";
|
9
|
+
import type { Camera, View } from "white-web-sdk";
|
10
10
|
import type { TeleBoxRect } from "@netless/telebox-insider";
|
11
|
-
import type { ICamera } from "../AttributesDelegate";
|
11
|
+
import type { ICamera, ISize } from "../AttributesDelegate";
|
12
12
|
|
13
13
|
export type WhiteBoardViewCamera = Omit<ICamera, "id">;
|
14
|
+
export type WhiteBoardViewRect = Omit<ISize, "id">;
|
14
15
|
|
15
16
|
export class WhiteBoardView implements PageController {
|
16
17
|
public readonly pageState$: ReadonlyVal<PageState>;
|
17
18
|
public readonly baseCamera$: ReadonlyVal<WhiteBoardViewCamera>;
|
19
|
+
public readonly baseRect$: ReadonlyVal<WhiteBoardViewRect | undefined>;
|
18
20
|
|
19
21
|
constructor(
|
20
22
|
public view: View,
|
@@ -23,23 +25,26 @@ export class WhiteBoardView implements PageController {
|
|
23
25
|
public ensureSize: (size: number) => void
|
24
26
|
) {
|
25
27
|
const pageState$ = new Val<PageState>(appProxy.pageState);
|
28
|
+
const baseRect$ = new Val<WhiteBoardViewRect | undefined>(appProxy.size$.value);
|
29
|
+
const pickCamera = (camera: Camera | ICamera) =>
|
30
|
+
pick(camera, ["centerX", "centerY", "scale"]);
|
31
|
+
const camera$ = new Val<WhiteBoardViewCamera>(pickCamera(this.view.camera));
|
32
|
+
this.baseRect$ = baseRect$;
|
26
33
|
this.pageState$ = pageState$;
|
27
|
-
this.appProxy.sideEffectManager.add(() =>
|
28
|
-
appProxy.appEmitter.on("pageStateChange", pageState => {
|
29
|
-
pageState$.setValue(pageState);
|
30
|
-
})
|
31
|
-
);
|
32
|
-
const camera$ = new Val<WhiteBoardViewCamera>(
|
33
|
-
pick(this.view.camera, ["centerX", "centerY", "scale"])
|
34
|
-
);
|
35
34
|
this.baseCamera$ = camera$;
|
36
|
-
this.appProxy.sideEffectManager.add(() =>
|
35
|
+
this.appProxy.sideEffectManager.add(() => [
|
36
|
+
appProxy.appEmitter.on("pageStateChange", pageState => pageState$.setValue(pageState)),
|
37
37
|
appProxy.camera$.subscribe(camera => {
|
38
38
|
if (camera) {
|
39
|
-
camera$.setValue(
|
39
|
+
camera$.setValue(pickCamera(camera));
|
40
40
|
}
|
41
|
-
})
|
42
|
-
|
41
|
+
}),
|
42
|
+
appProxy.size$.subscribe(size => {
|
43
|
+
if (size) {
|
44
|
+
baseRect$.setValue(pick(size, ["width", "height"]));
|
45
|
+
}
|
46
|
+
}),
|
47
|
+
]);
|
43
48
|
view.disableCameraTransform = true;
|
44
49
|
}
|
45
50
|
|
package/src/BoxManager.ts
CHANGED
@@ -3,6 +3,7 @@ import { debounce } from "lodash";
|
|
3
3
|
import { SideEffectManager } from "side-effect-manager";
|
4
4
|
import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
|
5
5
|
import { WindowManager } from "./index";
|
6
|
+
import type { Writeable } from "./typings";
|
6
7
|
import type { BoxEmitterType } from "./BoxEmitter";
|
7
8
|
import type { AddAppOptions } from "./index";
|
8
9
|
import type {
|
@@ -20,7 +21,6 @@ import type { View } from "white-web-sdk";
|
|
20
21
|
import type { CallbacksType } from "./callback";
|
21
22
|
import type { EmitterType } from "./InternalEmitter";
|
22
23
|
import type { AppState } from "./App/type";
|
23
|
-
import { Val } from "value-enhancer";
|
24
24
|
|
25
25
|
export { TELE_BOX_STATE };
|
26
26
|
|
@@ -49,7 +49,8 @@ export type CreateTeleBoxManagerConfig = {
|
|
49
49
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
50
50
|
prefersColorScheme?: TeleBoxColorScheme;
|
51
51
|
stageRatio?: number;
|
52
|
-
|
52
|
+
containerStyle?: string;
|
53
|
+
stageStyle?: string;
|
53
54
|
};
|
54
55
|
|
55
56
|
export type BoxManagerContext = {
|
@@ -92,8 +93,6 @@ export class BoxManager {
|
|
92
93
|
public teleBoxManager: TeleBoxManager;
|
93
94
|
protected sideEffectManager: SideEffectManager;
|
94
95
|
|
95
|
-
public mainViewElement$ = new Val<HTMLElement | undefined>(undefined);
|
96
|
-
|
97
96
|
constructor(
|
98
97
|
private context: BoxManagerContext,
|
99
98
|
createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig
|
@@ -172,28 +171,12 @@ export class BoxManager {
|
|
172
171
|
this.teleBoxManager.events.on("z_index", box => {
|
173
172
|
this.context.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
174
173
|
}),
|
175
|
-
this.teleBoxManager._stageRect$.subscribe(stage => {
|
176
|
-
this.updateStyle(this.mainViewElement$.value, stage);
|
177
|
-
emitter.emit("playgroundSizeChange", stage);
|
178
|
-
this.context.notifyContainerRectUpdate(stage);
|
179
|
-
}),
|
180
|
-
emitter.on("writableChange", isWritable => {
|
181
|
-
this.teleBoxManager.setHighlightStage(isWritable);
|
182
|
-
}),
|
183
174
|
emitter.on("containerSizeRatioUpdate", ratio => {
|
184
175
|
this.teleBoxManager._stageRatio$.setValue(ratio);
|
185
176
|
}),
|
186
177
|
]);
|
187
178
|
}
|
188
179
|
|
189
|
-
private updateStyle = (element: HTMLElement | undefined, rect: TeleBoxRect) => {
|
190
|
-
if (!element) return;
|
191
|
-
element.style.width = rect.width + "px";
|
192
|
-
element.style.height = rect.height + "px";
|
193
|
-
element.style.left = rect.x + "px";
|
194
|
-
element.style.top = rect.y + "px";
|
195
|
-
}
|
196
|
-
|
197
180
|
private get canOperate() {
|
198
181
|
return this.context.canOperate();
|
199
182
|
}
|
@@ -232,7 +215,8 @@ export class BoxManager {
|
|
232
215
|
|
233
216
|
public createBox(params: CreateBoxParams): ReadonlyTeleBox | undefined {
|
234
217
|
if (!this.teleBoxManager) return;
|
235
|
-
|
218
|
+
// eslint-disable-next-line prefer-const
|
219
|
+
let { minwidth = MIN_WIDTH, minheight = MIN_HEIGHT, enableShadowDOM = true } = params.app.config ?? {};
|
236
220
|
const { width, height } = params.app.config ?? {};
|
237
221
|
const title = params.options?.title || params.appId;
|
238
222
|
const rect = this.teleBoxManager.rootRect;
|
@@ -252,6 +236,7 @@ export class BoxManager {
|
|
252
236
|
width,
|
253
237
|
height,
|
254
238
|
id: params.appId,
|
239
|
+
enableShadowDOM,
|
255
240
|
};
|
256
241
|
const box = this.teleBoxManager.create(createBoxConfig, params.smartPosition);
|
257
242
|
this.context.emitter.emit(`${params.appId}${Events.WindowCreated}` as any);
|
@@ -262,14 +247,21 @@ export class BoxManager {
|
|
262
247
|
createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig
|
263
248
|
): TeleBoxManager {
|
264
249
|
const root = WindowManager.playground;
|
265
|
-
const initManagerState: TeleBoxManagerConfig = {
|
250
|
+
const initManagerState: Writeable<TeleBoxManagerConfig> = {
|
266
251
|
stageRatio: createTeleBoxManagerConfig?.stageRatio,
|
267
252
|
root: root,
|
268
253
|
fence: false,
|
269
254
|
prefersColorScheme: createTeleBoxManagerConfig?.prefersColorScheme,
|
270
|
-
highlightStage: createTeleBoxManagerConfig?.highlightStage,
|
271
255
|
};
|
272
256
|
|
257
|
+
if (createTeleBoxManagerConfig?.containerStyle) {
|
258
|
+
initManagerState.containerStyle = createTeleBoxManagerConfig.containerStyle;
|
259
|
+
}
|
260
|
+
|
261
|
+
if (createTeleBoxManagerConfig?.stageStyle) {
|
262
|
+
initManagerState.stageStyle = createTeleBoxManagerConfig.stageStyle;
|
263
|
+
}
|
264
|
+
|
273
265
|
const manager = new TeleBoxManager(initManagerState);
|
274
266
|
if (this.teleBoxManager) {
|
275
267
|
this.teleBoxManager.destroy();
|
@@ -311,17 +303,15 @@ export class BoxManager {
|
|
311
303
|
if (!state) return;
|
312
304
|
const box = this.getBox(state.id);
|
313
305
|
if (box) {
|
314
|
-
|
315
|
-
box.
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
true
|
324
|
-
);
|
306
|
+
if (state.size) {
|
307
|
+
box._intrinsicSize$.setValue(state.size, true);
|
308
|
+
}
|
309
|
+
if (state.position) {
|
310
|
+
box._intrinsicCoord$.setValue(state.position, true);
|
311
|
+
}
|
312
|
+
if (state.zIndex) {
|
313
|
+
box._zIndex$.setValue(state.zIndex, true);
|
314
|
+
}
|
325
315
|
setTimeout(() => {
|
326
316
|
if (state.focus) {
|
327
317
|
this.teleBoxManager.focusBox(box.id, true);
|
@@ -338,7 +328,10 @@ export class BoxManager {
|
|
338
328
|
}
|
339
329
|
|
340
330
|
public moveBox({ appId, x, y }: MoveBoxParams): void {
|
341
|
-
this.
|
331
|
+
const box = this.getBox(appId);
|
332
|
+
if (box) {
|
333
|
+
box._intrinsicCoord$.setValue({ x, y}, true);
|
334
|
+
}
|
342
335
|
}
|
343
336
|
|
344
337
|
public focusBox({ appId }: AppId, skipUpdate = true): void {
|
@@ -346,7 +339,10 @@ export class BoxManager {
|
|
346
339
|
}
|
347
340
|
|
348
341
|
public resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void {
|
349
|
-
this.
|
342
|
+
const box = this.getBox(appId);
|
343
|
+
if (box) {
|
344
|
+
box._intrinsicSize$.setValue({ width, height }, skipUpdate);
|
345
|
+
}
|
350
346
|
}
|
351
347
|
|
352
348
|
public setBoxMinSize(params: SetBoxMinSizeParams): void {
|
package/src/BuiltinApps.ts
CHANGED
package/src/Helper.ts
CHANGED
@@ -7,7 +7,8 @@ import { WindowManager } from "./index";
|
|
7
7
|
import type { Room, RoomMember } from "white-web-sdk";
|
8
8
|
|
9
9
|
export const setupWrapper = (
|
10
|
-
root: HTMLElement
|
10
|
+
root: HTMLElement,
|
11
|
+
target: HTMLElement
|
11
12
|
): {
|
12
13
|
playground: HTMLDivElement;
|
13
14
|
mainViewElement: HTMLDivElement;
|
@@ -17,7 +18,7 @@ export const setupWrapper = (
|
|
17
18
|
|
18
19
|
const mainViewElement = document.createElement("div");
|
19
20
|
mainViewElement.className = "netless-window-manager-main-view";
|
20
|
-
|
21
|
+
target.appendChild(mainViewElement);
|
21
22
|
root.appendChild(playground);
|
22
23
|
|
23
24
|
return { playground, mainViewElement };
|
@@ -30,13 +30,9 @@ export class CameraSynchronizer {
|
|
30
30
|
this.remoteCamera = camera;
|
31
31
|
this.remoteSize = size;
|
32
32
|
if (this.remoteSize && this.rect) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
} else {
|
37
|
-
scale = this.rect.height / size.height;
|
38
|
-
}
|
39
|
-
const nextScale = camera.scale * scale;
|
33
|
+
const wScale = this.rect.width / size.width;
|
34
|
+
const hScale = this.rect.height / size.height;
|
35
|
+
const nextScale = camera.scale * Math.min(wScale, hScale);
|
40
36
|
const config: Partial<Camera> & { animationMode: AnimationMode } = {
|
41
37
|
scale: nextScale,
|
42
38
|
animationMode: AnimationMode.Continuous,
|
package/src/callback.ts
CHANGED
package/src/index.ts
CHANGED
@@ -140,6 +140,8 @@ export type MountParams = {
|
|
140
140
|
collectorContainer?: HTMLElement;
|
141
141
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
142
142
|
overwriteStyles?: string;
|
143
|
+
containerStyle?: string;
|
144
|
+
stageStyle?: string;
|
143
145
|
cursor?: boolean;
|
144
146
|
debug?: boolean;
|
145
147
|
disableCameraTransform?: boolean;
|
@@ -247,7 +249,8 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
247
249
|
collectorStyles: params.collectorStyles,
|
248
250
|
prefersColorScheme: params.prefersColorScheme,
|
249
251
|
stageRatio: WindowManager.containerSizeRatio,
|
250
|
-
|
252
|
+
containerStyle: params.containerStyle,
|
253
|
+
stageStyle: params.stageStyle,
|
251
254
|
});
|
252
255
|
manager.appManager?.setBoxManager(manager.boxManager);
|
253
256
|
if (params.container) {
|
@@ -290,12 +293,13 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
290
293
|
|
291
294
|
private static initContainer(
|
292
295
|
container: HTMLElement,
|
296
|
+
target: HTMLElement,
|
293
297
|
overwriteStyles: string | undefined
|
294
298
|
) {
|
295
299
|
if (!WindowManager.container) {
|
296
300
|
WindowManager.container = container;
|
297
301
|
}
|
298
|
-
const { playground, mainViewElement } = setupWrapper(container);
|
302
|
+
const { playground, mainViewElement } = setupWrapper(container, target);
|
299
303
|
WindowManager.playground = playground;
|
300
304
|
if (overwriteStyles) {
|
301
305
|
const style = document.createElement("style");
|
@@ -318,15 +322,16 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
318
322
|
container.appendChild(WindowManager.container.firstChild);
|
319
323
|
}
|
320
324
|
} else {
|
321
|
-
|
325
|
+
const teleboxContainer = this.boxManager?.teleBoxManager.$stage;
|
326
|
+
if (WindowManager.params && teleboxContainer) {
|
322
327
|
const params = WindowManager.params;
|
323
328
|
const mainViewElement = WindowManager.initContainer(
|
324
329
|
container,
|
330
|
+
teleboxContainer,
|
325
331
|
params.overwriteStyles
|
326
332
|
);
|
327
333
|
if (this.boxManager && WindowManager.playground) {
|
328
334
|
this.boxManager.setRoot(WindowManager.playground);
|
329
|
-
this.boxManager.mainViewElement$.setValue(mainViewElement);
|
330
335
|
}
|
331
336
|
this.bindMainView(mainViewElement, params.disableCameraTransform);
|
332
337
|
if (WindowManager.playground) {
|
@@ -941,6 +946,14 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
941
946
|
emitter.emit("containerSizeRatioUpdate", ratio);
|
942
947
|
}
|
943
948
|
|
949
|
+
public setContainerStyle(style: string) {
|
950
|
+
this.boxManager?.teleBoxManager.setContainerStyle(style);
|
951
|
+
}
|
952
|
+
|
953
|
+
public setStageStyle(style: string) {
|
954
|
+
this.boxManager?.teleBoxManager.setStageStyle(style);
|
955
|
+
}
|
956
|
+
|
944
957
|
public createPPTHandler() {
|
945
958
|
return {
|
946
959
|
onPageJumpTo: (_pptUUID: string, index: number) => {
|
@@ -992,5 +1005,5 @@ setupBuiltin();
|
|
992
1005
|
|
993
1006
|
export * from "./typings";
|
994
1007
|
|
995
|
-
export { BuiltinApps } from "./BuiltinApps";
|
1008
|
+
export { BuiltinApps, BuiltinAppsMap } from "./BuiltinApps";
|
996
1009
|
export type { PublicEvent } from "./callback";
|
package/src/style.css
CHANGED
@@ -7,49 +7,11 @@
|
|
7
7
|
user-select: none;
|
8
8
|
}
|
9
9
|
|
10
|
-
.netless-window-manager-sizer {
|
11
|
-
position: absolute;
|
12
|
-
top: 0;
|
13
|
-
left: 0;
|
14
|
-
width: 100%;
|
15
|
-
height: 100%;
|
16
|
-
z-index: 1;
|
17
|
-
overflow: hidden;
|
18
|
-
display: flex;
|
19
|
-
}
|
20
|
-
|
21
|
-
.netless-window-manager-sizer-horizontal {
|
22
|
-
flex-direction: column;
|
23
|
-
}
|
24
|
-
|
25
|
-
.netless-window-manager-sizer::before,
|
26
|
-
.netless-window-manager-sizer::after {
|
27
|
-
flex: 1;
|
28
|
-
content: "";
|
29
|
-
display: block;
|
30
|
-
}
|
31
|
-
|
32
|
-
.netless-window-manager-chess-sizer::before,
|
33
|
-
.netless-window-manager-chess-sizer::after {
|
34
|
-
background-image: linear-gradient(45deg, #b0b0b0 25%, transparent 25%),
|
35
|
-
linear-gradient(-45deg, #b0b0b0 25%, transparent 25%),
|
36
|
-
linear-gradient(45deg, transparent 75%, #b0b0b0 75%),
|
37
|
-
linear-gradient(-45deg, transparent 75%, #b0b0b0 75%);
|
38
|
-
background-color: #fff;
|
39
|
-
background-size: 20px 20px;
|
40
|
-
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
|
41
|
-
}
|
42
|
-
|
43
|
-
.netless-window-manager-wrapper {
|
44
|
-
position: relative;
|
45
|
-
z-index: 1;
|
46
|
-
width: 100%;
|
47
|
-
height: 100%;
|
48
|
-
overflow: hidden;
|
49
|
-
}
|
50
10
|
|
51
11
|
.netless-window-manager-main-view {
|
52
12
|
position: absolute;
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
53
15
|
}
|
54
16
|
|
55
17
|
|
@@ -180,5 +142,5 @@
|
|
180
142
|
|
181
143
|
.window-manager-view-wrapper {
|
182
144
|
position: absolute;
|
183
|
-
z-index:
|
145
|
+
z-index: 10;
|
184
146
|
}
|
package/src/typings.ts
CHANGED
@@ -30,6 +30,9 @@ export interface NetlessApp<Attributes = any, MagixEventPayloads = any, AppOptio
|
|
30
30
|
|
31
31
|
/** App only single instance. */
|
32
32
|
singleton?: boolean;
|
33
|
+
|
34
|
+
/** App box enableShadowDom. Default true */
|
35
|
+
enableShadowDOM?: boolean;
|
33
36
|
};
|
34
37
|
setup: (context: AppContext<Attributes, MagixEventPayloads, AppOptions>) => SetupResult;
|
35
38
|
}
|
@@ -74,12 +77,15 @@ export type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any
|
|
74
77
|
addHooks?: (emitter: Emittery<RegisterEvents<SetupResult>>) => void;
|
75
78
|
/** dynamic load app package name */
|
76
79
|
name?: string;
|
80
|
+
contentStyles?: string;
|
77
81
|
};
|
78
82
|
|
79
83
|
export type AppListenerKeys = keyof AppEmitterEvent;
|
80
84
|
|
81
85
|
export type ApplianceIcons = Partial<Record<ApplianceNames, string>>;
|
82
86
|
|
87
|
+
export type Writeable<T> = { -readonly [P in keyof T]: T[P] };
|
88
|
+
|
83
89
|
export type { AppContext } from "./App/AppContext";
|
84
90
|
export type { WhiteBoardView } from "./App";
|
85
91
|
export type { ReadonlyTeleBox, TeleBoxRect };
|
package/vite.config.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import path from "path";
|
2
|
+
import dts from 'vite-plugin-dts'
|
2
3
|
import { defineConfig } from 'vitest/config'
|
3
4
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
4
5
|
import { dependencies, peerDependencies, version, devDependencies } from "./package.json"
|
@@ -28,7 +29,8 @@ export default defineConfig(({ mode }) => {
|
|
28
29
|
experimental: {
|
29
30
|
useVitePreprocess: true,
|
30
31
|
},
|
31
|
-
})
|
32
|
+
}),
|
33
|
+
dts()
|
32
34
|
],
|
33
35
|
build: {
|
34
36
|
lib: {
|
@@ -45,7 +47,7 @@ export default defineConfig(({ mode }) => {
|
|
45
47
|
...peerDependencies,
|
46
48
|
}),
|
47
49
|
},
|
48
|
-
minify: isProd
|
50
|
+
minify: isProd
|
49
51
|
},
|
50
52
|
};
|
51
|
-
})
|
53
|
+
})
|