@netless/window-manager 0.4.62 → 0.4.64
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/AppManager.d.ts +2 -0
- package/dist/InternalEmitter.d.ts +1 -1
- package/dist/callback.d.ts +2 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +123 -92
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/App/AppProxy.ts +4 -4
- package/src/App/Storage/index.ts +5 -4
- package/src/AppListener.ts +3 -3
- package/src/AppManager.ts +32 -22
- package/src/Cursor/index.ts +3 -3
- package/src/InternalEmitter.ts +1 -1
- package/src/PageState.ts +6 -5
- package/src/RedoUndo.ts +3 -3
- package/src/Utils/Common.ts +4 -4
- package/src/Utils/RoomHacker.ts +4 -4
- package/src/View/MainView.ts +7 -6
- package/src/callback.ts +2 -0
- package/src/index.ts +42 -18
- package/src/style.css +8 -0
package/dist/index.mjs
CHANGED
@@ -142,7 +142,7 @@ class AppCreateQueue {
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
}
|
145
|
-
const
|
145
|
+
const internalEmitter = new Emittery();
|
146
146
|
const DatabaseName = "__WindowManagerAppCache";
|
147
147
|
let db$1;
|
148
148
|
let store$1;
|
@@ -324,9 +324,9 @@ class AppRegister {
|
|
324
324
|
return app;
|
325
325
|
});
|
326
326
|
if (params.addHooks) {
|
327
|
-
const
|
328
|
-
if (
|
329
|
-
params.addHooks(
|
327
|
+
const emitter = this.createKindEmitter(params.kind);
|
328
|
+
if (emitter) {
|
329
|
+
params.addHooks(emitter);
|
330
330
|
}
|
331
331
|
}
|
332
332
|
}
|
@@ -341,13 +341,13 @@ class AppRegister {
|
|
341
341
|
}
|
342
342
|
}
|
343
343
|
async notifyApp(kind2, event, payload) {
|
344
|
-
const
|
345
|
-
await (
|
344
|
+
const emitter = this.kindEmitters.get(kind2);
|
345
|
+
await (emitter == null ? void 0 : emitter.emit(event, payload));
|
346
346
|
}
|
347
347
|
createKindEmitter(kind2) {
|
348
348
|
if (!this.kindEmitters.has(kind2)) {
|
349
|
-
const
|
350
|
-
this.kindEmitters.set(kind2,
|
349
|
+
const emitter = new Emittery();
|
350
|
+
this.kindEmitters.set(kind2, emitter);
|
351
351
|
}
|
352
352
|
return this.kindEmitters.get(kind2);
|
353
353
|
}
|
@@ -394,7 +394,7 @@ const removeScenes = (room, scenePath, index2) => {
|
|
394
394
|
}
|
395
395
|
};
|
396
396
|
const addEmitterOnceListener = (event, listener) => {
|
397
|
-
|
397
|
+
internalEmitter.once(event).then(listener);
|
398
398
|
};
|
399
399
|
debounce((callbacks2, mode) => {
|
400
400
|
callbacks2.emit("mainViewModeChange", mode);
|
@@ -538,12 +538,12 @@ class AppListeners {
|
|
538
538
|
this.manager.mainView.moveCameraToContain(payload);
|
539
539
|
};
|
540
540
|
this.cursorMoveHandler = (payload) => {
|
541
|
-
|
541
|
+
internalEmitter.emit("cursorMove", payload);
|
542
542
|
};
|
543
543
|
this.rootDirRemovedHandler = () => {
|
544
544
|
this.manager.createRootDirScenesCallback();
|
545
545
|
this.manager.mainViewProxy.rebind();
|
546
|
-
|
546
|
+
internalEmitter.emit("rootDirRemoved");
|
547
547
|
};
|
548
548
|
this.refreshHandler = () => {
|
549
549
|
this.manager.windowManger._refresh();
|
@@ -669,13 +669,6 @@ const safeListenPropsUpdated = (getProps, callback, onDestroyed) => {
|
|
669
669
|
};
|
670
670
|
const onObjectRemoved = onObjectByEvent(UpdateEventKind.Removed);
|
671
671
|
onObjectByEvent(UpdateEventKind.Inserted);
|
672
|
-
const plainObjectKeys = Object.keys;
|
673
|
-
function isRef(e2) {
|
674
|
-
return Boolean(has(e2, "__isRef"));
|
675
|
-
}
|
676
|
-
function makeRef(v2) {
|
677
|
-
return { k: genUID(), v: v2, __isRef: true };
|
678
|
-
}
|
679
672
|
class StorageEvent {
|
680
673
|
constructor() {
|
681
674
|
this.listeners = /* @__PURE__ */ new Set();
|
@@ -693,6 +686,13 @@ class StorageEvent {
|
|
693
686
|
this.listeners.delete(listener);
|
694
687
|
}
|
695
688
|
}
|
689
|
+
const plainObjectKeys = Object.keys;
|
690
|
+
function isRef(e2) {
|
691
|
+
return Boolean(has(e2, "__isRef"));
|
692
|
+
}
|
693
|
+
function makeRef(v2) {
|
694
|
+
return { k: genUID(), v: v2, __isRef: true };
|
695
|
+
}
|
696
696
|
const STORAGE_NS = "_WM-STORAGE_";
|
697
697
|
class Storage {
|
698
698
|
constructor(context, id2, defaultState) {
|
@@ -1468,7 +1468,7 @@ class AppProxy {
|
|
1468
1468
|
} else {
|
1469
1469
|
throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
1470
1470
|
}
|
1471
|
-
|
1471
|
+
internalEmitter.emit("updateManagerRect");
|
1472
1472
|
return {
|
1473
1473
|
appId: this.id,
|
1474
1474
|
app: appImpl
|
@@ -1487,7 +1487,7 @@ class AppProxy {
|
|
1487
1487
|
const context = new AppContext(this.manager, this.boxManager, appId, this, appOptions);
|
1488
1488
|
this.appContext = context;
|
1489
1489
|
try {
|
1490
|
-
|
1490
|
+
internalEmitter.once(`${appId}${Events.WindowCreated}`).then(async () => {
|
1491
1491
|
var _a2;
|
1492
1492
|
let boxInitState;
|
1493
1493
|
if (!skipUpdate) {
|
@@ -1703,7 +1703,7 @@ class AppProxy {
|
|
1703
1703
|
console.error("[WindowManager]: notifyApp error", error2.message, error2.stack);
|
1704
1704
|
}
|
1705
1705
|
this.appEmitter.clearListeners();
|
1706
|
-
|
1706
|
+
internalEmitter.emit(`destroy-${this.id}`, { error });
|
1707
1707
|
if (needCloseBox) {
|
1708
1708
|
(_a = this.boxManager) == null ? void 0 : _a.closeBox(this.id, skipUpdate);
|
1709
1709
|
}
|
@@ -1786,7 +1786,7 @@ class MainViewProxy {
|
|
1786
1786
|
this.sideEffectManager = new SideEffectManager();
|
1787
1787
|
this.startListenWritableChange = () => {
|
1788
1788
|
this.sideEffectManager.add(() => {
|
1789
|
-
return
|
1789
|
+
return internalEmitter.on("writableChange", (isWritable) => {
|
1790
1790
|
if (isWritable) {
|
1791
1791
|
this.ensureCameraAndSize();
|
1792
1792
|
}
|
@@ -1847,7 +1847,7 @@ class MainViewProxy {
|
|
1847
1847
|
};
|
1848
1848
|
this.mainView = this.createMainView();
|
1849
1849
|
this.moveCameraSizeByAttributes();
|
1850
|
-
|
1850
|
+
internalEmitter.once("mainViewMounted").then(() => {
|
1851
1851
|
this.addMainViewListener();
|
1852
1852
|
this.start();
|
1853
1853
|
this.ensureCameraAndSize();
|
@@ -1857,13 +1857,13 @@ class MainViewProxy {
|
|
1857
1857
|
this.sizeChangeHandler(this.mainViewSize);
|
1858
1858
|
};
|
1859
1859
|
this.sideEffectManager.add(() => {
|
1860
|
-
return
|
1860
|
+
return internalEmitter.on("playgroundSizeChange", playgroundSizeChangeListener);
|
1861
1861
|
});
|
1862
1862
|
this.sideEffectManager.add(() => {
|
1863
|
-
return
|
1863
|
+
return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
1864
1864
|
});
|
1865
1865
|
this.sideEffectManager.add(() => {
|
1866
|
-
return
|
1866
|
+
return internalEmitter.on("startReconnect", () => {
|
1867
1867
|
if (!this.didRelease) {
|
1868
1868
|
this.mainView.release();
|
1869
1869
|
}
|
@@ -1897,6 +1897,8 @@ class MainViewProxy {
|
|
1897
1897
|
return;
|
1898
1898
|
this.addCameraListener();
|
1899
1899
|
this.addCameraReaction();
|
1900
|
+
if (this.manager.room)
|
1901
|
+
this.syncMainView(this.manager.room);
|
1900
1902
|
this.started = true;
|
1901
1903
|
}
|
1902
1904
|
setCameraAndSize() {
|
@@ -2060,13 +2062,13 @@ class RedoUndo {
|
|
2060
2062
|
this.disposeViewCallbacks(view);
|
2061
2063
|
}
|
2062
2064
|
};
|
2063
|
-
|
2065
|
+
internalEmitter.on("focusedChange", (changed) => {
|
2064
2066
|
this.disposePrevFocusViewRedoUndoListeners(changed.prev);
|
2065
2067
|
setTimeout(() => {
|
2066
2068
|
this.addRedoUndoListeners(changed.focused);
|
2067
2069
|
}, 0);
|
2068
2070
|
});
|
2069
|
-
|
2071
|
+
internalEmitter.on("rootDirRemoved", () => {
|
2070
2072
|
this.disposePrevFocusViewRedoUndoListeners(context.focus());
|
2071
2073
|
this.addRedoUndoListeners(context.focus());
|
2072
2074
|
});
|
@@ -2138,7 +2140,7 @@ class AppManager {
|
|
2138
2140
|
onAddScene: this.onSceneChange,
|
2139
2141
|
onRemoveScene: async (node, name) => {
|
2140
2142
|
await this.onSceneChange(node);
|
2141
|
-
|
2143
|
+
internalEmitter.emit("rootDirSceneRemoved", name);
|
2142
2144
|
}
|
2143
2145
|
});
|
2144
2146
|
if (this.callbacksNode) {
|
@@ -2161,7 +2163,7 @@ class AppManager {
|
|
2161
2163
|
}
|
2162
2164
|
}, 100);
|
2163
2165
|
return new Promise((resolve, reject) => {
|
2164
|
-
|
2166
|
+
internalEmitter.once("rootDirSceneRemoved").then((name) => {
|
2165
2167
|
if (name === scene) {
|
2166
2168
|
resolve(true);
|
2167
2169
|
}
|
@@ -2186,7 +2188,7 @@ class AppManager {
|
|
2186
2188
|
this.emitMainViewScenesChange = (length) => {
|
2187
2189
|
return Promise.all([
|
2188
2190
|
callbacks$1.emit("mainViewScenesLengthChange", length),
|
2189
|
-
|
2191
|
+
internalEmitter.emit("changePageState")
|
2190
2192
|
]);
|
2191
2193
|
};
|
2192
2194
|
this.updateSceneState = (node) => {
|
@@ -2255,7 +2257,7 @@ class AppManager {
|
|
2255
2257
|
this.onMainViewIndexChange = (index2) => {
|
2256
2258
|
if (index2 !== void 0 && this._prevSceneIndex !== index2) {
|
2257
2259
|
callbacks$1.emit("mainViewSceneIndexChange", index2);
|
2258
|
-
|
2260
|
+
internalEmitter.emit("changePageState");
|
2259
2261
|
if (this.callbacksNode) {
|
2260
2262
|
this.updateSceneState(this.callbacksNode);
|
2261
2263
|
}
|
@@ -2266,7 +2268,7 @@ class AppManager {
|
|
2266
2268
|
var _a;
|
2267
2269
|
if (this._prevFocused !== focused) {
|
2268
2270
|
callbacks$1.emit("focusedChange", focused);
|
2269
|
-
|
2271
|
+
internalEmitter.emit("focusedChange", { focused, prev: this._prevFocused });
|
2270
2272
|
this._prevFocused = focused;
|
2271
2273
|
if (focused !== void 0) {
|
2272
2274
|
(_a = this.boxManager) == null ? void 0 : _a.focusBox({ appId: focused });
|
@@ -2280,6 +2282,7 @@ class AppManager {
|
|
2280
2282
|
}
|
2281
2283
|
};
|
2282
2284
|
this.attributesUpdateCallback = debounce((apps) => this._attributesUpdateCallback(apps), 100);
|
2285
|
+
this._appIds = [];
|
2283
2286
|
this.onRegisteredChange = (registered) => {
|
2284
2287
|
if (!registered)
|
2285
2288
|
return;
|
@@ -2332,7 +2335,7 @@ class AppManager {
|
|
2332
2335
|
this.appProxies.forEach((appProxy) => {
|
2333
2336
|
appProxy.appEmitter.emit("roomStateChange", state);
|
2334
2337
|
});
|
2335
|
-
|
2338
|
+
internalEmitter.emit("observerIdChange", this.displayer.observerId);
|
2336
2339
|
};
|
2337
2340
|
this.displayerWritableListener = (isReadonly) => {
|
2338
2341
|
var _a, _b;
|
@@ -2346,7 +2349,7 @@ class AppManager {
|
|
2346
2349
|
this.appProxies.forEach((appProxy) => {
|
2347
2350
|
appProxy.emitAppIsWritableChange();
|
2348
2351
|
});
|
2349
|
-
|
2352
|
+
internalEmitter.emit("writableChange", isWritable);
|
2350
2353
|
};
|
2351
2354
|
this.updateSceneIndex = () => {
|
2352
2355
|
const scenePath = this.store.getMainViewScenePath();
|
@@ -2376,7 +2379,7 @@ class AppManager {
|
|
2376
2379
|
this.appListeners.addListeners();
|
2377
2380
|
this.refresher = reconnectRefresher;
|
2378
2381
|
this.refresher.setRoom(this.room);
|
2379
|
-
this.refresher.setContext({ emitter });
|
2382
|
+
this.refresher.setContext({ emitter: internalEmitter });
|
2380
2383
|
this.sideEffectManager.add(() => {
|
2381
2384
|
return () => {
|
2382
2385
|
var _a, _b, _c;
|
@@ -2388,14 +2391,14 @@ class AppManager {
|
|
2388
2391
|
(_c = this.callbacksNode) == null ? void 0 : _c.dispose();
|
2389
2392
|
};
|
2390
2393
|
});
|
2391
|
-
|
2392
|
-
|
2394
|
+
internalEmitter.once("onCreated").then(() => this.onCreated());
|
2395
|
+
internalEmitter.on("onReconnected", () => this.onReconnected());
|
2393
2396
|
if (isPlayer(this.displayer)) {
|
2394
|
-
|
2395
|
-
|
2397
|
+
internalEmitter.on("seekStart", this.onPlayerSeekStart);
|
2398
|
+
internalEmitter.on("seek", this.onPlayerSeekDone);
|
2396
2399
|
}
|
2397
|
-
|
2398
|
-
|
2400
|
+
internalEmitter.on("removeScenes", this.onRemoveScenes);
|
2401
|
+
internalEmitter.on("setReadonly", this.onReadonlyChanged);
|
2399
2402
|
this.createRootDirScenesCallback();
|
2400
2403
|
appRegister.setSyncRegisterApp((payload) => {
|
2401
2404
|
this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
|
@@ -2410,7 +2413,7 @@ class AppManager {
|
|
2410
2413
|
}
|
2411
2414
|
}
|
2412
2415
|
this.mainViewProxy.rebind();
|
2413
|
-
|
2416
|
+
internalEmitter.emit("rootDirRemoved");
|
2414
2417
|
this.updateRootDirRemoving(false);
|
2415
2418
|
}
|
2416
2419
|
get eventName() {
|
@@ -2448,7 +2451,7 @@ class AppManager {
|
|
2448
2451
|
async onCreated() {
|
2449
2452
|
var _a, _b, _c, _d, _e, _f;
|
2450
2453
|
await this.attributesUpdateCallback(this.attributes.apps);
|
2451
|
-
|
2454
|
+
internalEmitter.emit("updateManagerRect");
|
2452
2455
|
boxEmitter.on("move", this.onBoxMove);
|
2453
2456
|
boxEmitter.on("resize", this.onBoxResize);
|
2454
2457
|
boxEmitter.on("focus", this.onBoxFocus);
|
@@ -2505,19 +2508,27 @@ class AppManager {
|
|
2505
2508
|
return () => redoUndo.destroy();
|
2506
2509
|
});
|
2507
2510
|
}
|
2511
|
+
notifyAppsChange(appIds) {
|
2512
|
+
if (this._appIds.length !== appIds.length || !this._appIds.every((id2) => appIds.includes(id2))) {
|
2513
|
+
this._appIds = appIds;
|
2514
|
+
callbacks$1.emit("appsChange", appIds);
|
2515
|
+
}
|
2516
|
+
}
|
2508
2517
|
async _attributesUpdateCallback(apps) {
|
2509
2518
|
if (apps && WindowManager.container) {
|
2510
2519
|
const appIds = Object.keys(apps);
|
2511
2520
|
if (appIds.length === 0) {
|
2512
2521
|
this.appCreateQueue.emitReady();
|
2513
2522
|
}
|
2514
|
-
const appsWithCreatedAt = appIds.map((appId) => {
|
2523
|
+
const appsWithCreatedAt = orderBy(appIds.map((appId) => {
|
2515
2524
|
return {
|
2516
2525
|
id: appId,
|
2517
2526
|
createdAt: apps[appId].createdAt
|
2518
2527
|
};
|
2519
|
-
});
|
2520
|
-
|
2528
|
+
}), "createdAt", "asc");
|
2529
|
+
const orderedAppIds = appsWithCreatedAt.map(({ id: id2 }) => id2);
|
2530
|
+
this.notifyAppsChange(orderedAppIds);
|
2531
|
+
for (const id2 of orderedAppIds) {
|
2521
2532
|
if (!this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2522
2533
|
const app = apps[id2];
|
2523
2534
|
try {
|
@@ -2562,7 +2573,7 @@ class AppManager {
|
|
2562
2573
|
if (!mainView.focusScenePath) {
|
2563
2574
|
this.setMainViewFocusPath();
|
2564
2575
|
}
|
2565
|
-
|
2576
|
+
internalEmitter.emit("mainViewMounted");
|
2566
2577
|
}
|
2567
2578
|
setMainViewFocusPath(scenePath) {
|
2568
2579
|
var _a;
|
@@ -2741,7 +2752,7 @@ class AppManager {
|
|
2741
2752
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
2742
2753
|
this.appListeners.removeListeners();
|
2743
2754
|
boxEmitter.clearListeners();
|
2744
|
-
|
2755
|
+
internalEmitter.clearListeners();
|
2745
2756
|
if (this.appProxies.size) {
|
2746
2757
|
this.appProxies.forEach((appProxy) => {
|
2747
2758
|
appProxy.destroy(true, false, true);
|
@@ -2803,11 +2814,11 @@ const createInvisiblePlugin = async (room) => {
|
|
2803
2814
|
};
|
2804
2815
|
const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
2805
2816
|
class ContainerResizeObserver {
|
2806
|
-
constructor(
|
2807
|
-
this.emitter =
|
2817
|
+
constructor(emitter) {
|
2818
|
+
this.emitter = emitter;
|
2808
2819
|
}
|
2809
|
-
static create(container, sizer, wrapper,
|
2810
|
-
const containerResizeObserver = new ContainerResizeObserver(
|
2820
|
+
static create(container, sizer, wrapper, emitter) {
|
2821
|
+
const containerResizeObserver = new ContainerResizeObserver(emitter);
|
2811
2822
|
containerResizeObserver.observePlaygroundSize(container, sizer, wrapper);
|
2812
2823
|
return containerResizeObserver;
|
2813
2824
|
}
|
@@ -3245,24 +3256,24 @@ var eventemitter3 = { exports: {} };
|
|
3245
3256
|
this.context = context;
|
3246
3257
|
this.once = once || false;
|
3247
3258
|
}
|
3248
|
-
function addListener(
|
3259
|
+
function addListener(emitter, event, fn, context, once) {
|
3249
3260
|
if (typeof fn !== "function") {
|
3250
3261
|
throw new TypeError("The listener must be a function");
|
3251
3262
|
}
|
3252
|
-
var listener = new EE(fn, context ||
|
3253
|
-
if (!
|
3254
|
-
|
3255
|
-
else if (!
|
3256
|
-
|
3263
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
3264
|
+
if (!emitter._events[evt])
|
3265
|
+
emitter._events[evt] = listener, emitter._eventsCount++;
|
3266
|
+
else if (!emitter._events[evt].fn)
|
3267
|
+
emitter._events[evt].push(listener);
|
3257
3268
|
else
|
3258
|
-
|
3259
|
-
return
|
3269
|
+
emitter._events[evt] = [emitter._events[evt], listener];
|
3270
|
+
return emitter;
|
3260
3271
|
}
|
3261
|
-
function clearEvent(
|
3262
|
-
if (--
|
3263
|
-
|
3272
|
+
function clearEvent(emitter, evt) {
|
3273
|
+
if (--emitter._eventsCount === 0)
|
3274
|
+
emitter._events = new Events2();
|
3264
3275
|
else
|
3265
|
-
delete
|
3276
|
+
delete emitter._events[evt];
|
3266
3277
|
}
|
3267
3278
|
function EventEmitter2() {
|
3268
3279
|
this._events = new Events2();
|
@@ -6182,7 +6193,7 @@ class TeleBoxManager {
|
|
6182
6193
|
return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
|
6183
6194
|
}
|
6184
6195
|
}
|
6185
|
-
const createBoxManager = (manager, callbacks2,
|
6196
|
+
const createBoxManager = (manager, callbacks2, emitter, boxEmitter2, options) => {
|
6186
6197
|
return new BoxManager({
|
6187
6198
|
safeSetAttributes: (attributes) => manager.safeSetAttributes(attributes),
|
6188
6199
|
getMainView: () => manager.mainView,
|
@@ -6204,7 +6215,7 @@ const createBoxManager = (manager, callbacks2, emitter2, boxEmitter2, options) =
|
|
6204
6215
|
return (_a = manager.appManager) == null ? void 0 : _a.store.setAppFocus(appId, true);
|
6205
6216
|
},
|
6206
6217
|
callbacks: callbacks2,
|
6207
|
-
emitter
|
6218
|
+
emitter,
|
6208
6219
|
boxEmitter: boxEmitter2
|
6209
6220
|
}, options);
|
6210
6221
|
};
|
@@ -6212,11 +6223,11 @@ class BoxManager {
|
|
6212
6223
|
constructor(context, createTeleBoxManagerConfig) {
|
6213
6224
|
this.context = context;
|
6214
6225
|
this.createTeleBoxManagerConfig = createTeleBoxManagerConfig;
|
6215
|
-
const { emitter
|
6226
|
+
const { emitter, callbacks: callbacks2, boxEmitter: boxEmitter2 } = context;
|
6216
6227
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
6217
6228
|
this.teleBoxManager._state$.reaction((state) => {
|
6218
6229
|
callbacks2.emit("boxStateChange", state);
|
6219
|
-
|
6230
|
+
emitter.emit("boxStateChange", state);
|
6220
6231
|
});
|
6221
6232
|
this.teleBoxManager._darkMode$.reaction((darkMode) => {
|
6222
6233
|
callbacks2.emit("darkModeChange", darkMode);
|
@@ -6277,8 +6288,8 @@ class BoxManager {
|
|
6277
6288
|
this.teleBoxManager.events.on("z_index", (box) => {
|
6278
6289
|
this.context.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
6279
6290
|
});
|
6280
|
-
|
6281
|
-
|
6291
|
+
emitter.on("playgroundSizeChange", () => this.updateManagerRect());
|
6292
|
+
emitter.on("updateManagerRect", () => this.updateManagerRect());
|
6282
6293
|
}
|
6283
6294
|
get mainView() {
|
6284
6295
|
return this.context.getMainView();
|
@@ -7356,10 +7367,10 @@ class CursorManager {
|
|
7356
7367
|
this.setupWrapper(wrapper);
|
7357
7368
|
}
|
7358
7369
|
this.sideEffectManager.add(() => {
|
7359
|
-
return
|
7370
|
+
return internalEmitter.on("cursorMove", this.onCursorMove);
|
7360
7371
|
});
|
7361
7372
|
this.sideEffectManager.add(() => {
|
7362
|
-
return
|
7373
|
+
return internalEmitter.on("playgroundSizeChange", () => this.updateContainerRect());
|
7363
7374
|
});
|
7364
7375
|
if (applianceIcons) {
|
7365
7376
|
this.applianceIcons = __spreadValues(__spreadValues({}, ApplianceMap), applianceIcons);
|
@@ -7458,17 +7469,15 @@ class CursorManager {
|
|
7458
7469
|
class PageStateImpl {
|
7459
7470
|
constructor(manager) {
|
7460
7471
|
this.manager = manager;
|
7461
|
-
|
7472
|
+
internalEmitter.on("changePageState", () => {
|
7462
7473
|
callbacks$1.emit("pageStateChange", this.toObject());
|
7463
7474
|
});
|
7464
7475
|
}
|
7465
7476
|
get index() {
|
7466
|
-
|
7467
|
-
return ((_a = this.manager) == null ? void 0 : _a.store.getMainViewSceneIndex()) || 0;
|
7477
|
+
return this.manager.store.getMainViewSceneIndex() || 0;
|
7468
7478
|
}
|
7469
7479
|
get length() {
|
7470
|
-
|
7471
|
-
return ((_a = this.manager) == null ? void 0 : _a.mainViewScenesLength) || 0;
|
7480
|
+
return this.manager.mainViewScenesLength || 0;
|
7472
7481
|
}
|
7473
7482
|
toObject() {
|
7474
7483
|
const index2 = this.index >= this.length ? this.length - 1 : this.index;
|
@@ -7629,16 +7638,16 @@ const delegateRemoveScenes = (room, manager) => {
|
|
7629
7638
|
(_a = manager.appManager) == null ? void 0 : _a.updateRootDirRemoving(true);
|
7630
7639
|
}
|
7631
7640
|
const result = originRemoveScenes.call(room, scenePath);
|
7632
|
-
|
7641
|
+
internalEmitter.emit("removeScenes", { scenePath, index: index2 });
|
7633
7642
|
return result;
|
7634
7643
|
};
|
7635
7644
|
};
|
7636
7645
|
const delegateSeekToProgressTime = (player) => {
|
7637
7646
|
const originSeek = player.seekToProgressTime;
|
7638
7647
|
async function newSeek(time2) {
|
7639
|
-
await
|
7648
|
+
await internalEmitter.emit("seekStart");
|
7640
7649
|
const seekResult = await originSeek.call(player, time2);
|
7641
|
-
|
7650
|
+
internalEmitter.emit("seek", time2);
|
7642
7651
|
return seekResult;
|
7643
7652
|
}
|
7644
7653
|
player.seekToProgressTime = newSeek;
|
@@ -17453,11 +17462,11 @@ IframeBridge.hiddenClass = "netless-iframe-brdige-hidden";
|
|
17453
17462
|
IframeBridge.emitter = new Emittery();
|
17454
17463
|
IframeBridge.displayer = null;
|
17455
17464
|
IframeBridge.alreadyCreate = false;
|
17456
|
-
const reconnectRefresher = new ReconnectRefresher({ emitter });
|
17465
|
+
const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
17457
17466
|
const _WindowManager = class extends InvisiblePlugin {
|
17458
17467
|
constructor(context) {
|
17459
17468
|
super(context);
|
17460
|
-
this.version = "0.4.
|
17469
|
+
this.version = "0.4.64";
|
17461
17470
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.27", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.16", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.43" } };
|
17462
17471
|
this.emitter = callbacks$1;
|
17463
17472
|
this.viewMode = ViewMode.Broadcaster;
|
@@ -17510,6 +17519,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17510
17519
|
_WindowManager.containerSizeRatio = containerSizeRatio;
|
17511
17520
|
}
|
17512
17521
|
await manager.ensureAttributes();
|
17522
|
+
manager._fullscreen = params.fullscreen;
|
17513
17523
|
manager.appManager = new AppManager(manager);
|
17514
17524
|
manager._pageState = new PageStateImpl(manager.appManager);
|
17515
17525
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
|
@@ -17520,7 +17530,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17520
17530
|
manager.bindContainer(params.container);
|
17521
17531
|
}
|
17522
17532
|
replaceRoomFunction(room, manager);
|
17523
|
-
|
17533
|
+
internalEmitter.emit("onCreated");
|
17524
17534
|
_WindowManager.isCreated = true;
|
17525
17535
|
try {
|
17526
17536
|
await initDb();
|
@@ -17551,7 +17561,12 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17551
17561
|
}
|
17552
17562
|
return manager;
|
17553
17563
|
}
|
17554
|
-
static initContainer(manager, container,
|
17564
|
+
static initContainer(manager, container, params) {
|
17565
|
+
const {
|
17566
|
+
chessboard,
|
17567
|
+
overwriteStyles,
|
17568
|
+
fullscreen
|
17569
|
+
} = params;
|
17555
17570
|
if (!_WindowManager.container) {
|
17556
17571
|
_WindowManager.container = container;
|
17557
17572
|
}
|
@@ -17560,13 +17575,17 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17560
17575
|
if (chessboard) {
|
17561
17576
|
sizer.classList.add("netless-window-manager-chess-sizer");
|
17562
17577
|
}
|
17578
|
+
if (fullscreen) {
|
17579
|
+
sizer.classList.add("netless-window-manager-fullscreen");
|
17580
|
+
}
|
17563
17581
|
if (overwriteStyles) {
|
17564
17582
|
const style2 = document.createElement("style");
|
17565
17583
|
style2.textContent = overwriteStyles;
|
17566
17584
|
playground.appendChild(style2);
|
17567
17585
|
}
|
17568
|
-
manager.containerResizeObserver = ContainerResizeObserver.create(playground, sizer, wrapper,
|
17586
|
+
manager.containerResizeObserver = ContainerResizeObserver.create(playground, sizer, wrapper, internalEmitter);
|
17569
17587
|
_WindowManager.wrapper = wrapper;
|
17588
|
+
_WindowManager.sizer = sizer;
|
17570
17589
|
return mainViewElement;
|
17571
17590
|
}
|
17572
17591
|
static get registered() {
|
@@ -17584,11 +17603,11 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17584
17603
|
} else {
|
17585
17604
|
if (_WindowManager.params) {
|
17586
17605
|
const params = _WindowManager.params;
|
17587
|
-
const mainViewElement = _WindowManager.initContainer(this, container, params
|
17606
|
+
const mainViewElement = _WindowManager.initContainer(this, container, params);
|
17588
17607
|
if (this.boxManager) {
|
17589
17608
|
this.boxManager.destroy();
|
17590
17609
|
}
|
17591
|
-
const boxManager = createBoxManager(this, callbacks$1,
|
17610
|
+
const boxManager = createBoxManager(this, callbacks$1, internalEmitter, boxEmitter, {
|
17592
17611
|
collectorContainer: params.collectorContainer,
|
17593
17612
|
collectorStyles: params.collectorStyles,
|
17594
17613
|
prefersColorScheme: params.prefersColorScheme
|
@@ -17601,7 +17620,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17601
17620
|
}
|
17602
17621
|
}
|
17603
17622
|
}
|
17604
|
-
|
17623
|
+
internalEmitter.emit("updateManagerRect");
|
17605
17624
|
(_c = this.appManager) == null ? void 0 : _c.refresh();
|
17606
17625
|
(_d = this.appManager) == null ? void 0 : _d.resetMaximized();
|
17607
17626
|
(_e = this.appManager) == null ? void 0 : _e.resetMinimized();
|
@@ -17627,7 +17646,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17627
17646
|
if (this.appManager) {
|
17628
17647
|
if (this.appManager.rootDirRemoving) {
|
17629
17648
|
return new Promise((resolve, reject) => {
|
17630
|
-
|
17649
|
+
internalEmitter.once("rootDirRemoved").then(async () => {
|
17631
17650
|
try {
|
17632
17651
|
const appId = await this._addApp(params);
|
17633
17652
|
resolve(appId);
|
@@ -17797,7 +17816,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17797
17816
|
var _a;
|
17798
17817
|
this.readonly = readonly;
|
17799
17818
|
(_a = this.boxManager) == null ? void 0 : _a.setReadonly(readonly);
|
17800
|
-
|
17819
|
+
internalEmitter.emit("setReadonly", readonly);
|
17801
17820
|
}
|
17802
17821
|
switchMainViewToWriter() {
|
17803
17822
|
var _a;
|
@@ -17849,6 +17868,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17849
17868
|
return;
|
17850
17869
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(minimized, false);
|
17851
17870
|
}
|
17871
|
+
setFullscreen(fullscreen) {
|
17872
|
+
var _a;
|
17873
|
+
if (this._fullscreen !== fullscreen) {
|
17874
|
+
this._fullscreen = fullscreen;
|
17875
|
+
(_a = _WindowManager.sizer) == null ? void 0 : _a.classList.toggle("netless-window-manager-fullscreen", fullscreen);
|
17876
|
+
callbacks$1.emit("fullscreenChange", fullscreen);
|
17877
|
+
}
|
17878
|
+
}
|
17852
17879
|
get mainView() {
|
17853
17880
|
if (this.appManager) {
|
17854
17881
|
return this.appManager.mainViewProxy.view;
|
@@ -17943,6 +17970,9 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17943
17970
|
throw new AppManagerNotInitError();
|
17944
17971
|
}
|
17945
17972
|
}
|
17973
|
+
get fullscreen() {
|
17974
|
+
return Boolean(this._fullscreen);
|
17975
|
+
}
|
17946
17976
|
queryAll() {
|
17947
17977
|
var _a;
|
17948
17978
|
return Array.from(((_a = this.appManager) == null ? void 0 : _a.appProxies.values()) || []);
|
@@ -18004,6 +18034,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
18004
18034
|
(_c = this.cursorManager) == null ? void 0 : _c.destroy();
|
18005
18035
|
_WindowManager.container = void 0;
|
18006
18036
|
_WindowManager.wrapper = void 0;
|
18037
|
+
_WindowManager.sizer = void 0;
|
18007
18038
|
_WindowManager.isCreated = false;
|
18008
18039
|
if (_WindowManager.playground) {
|
18009
18040
|
(_d = _WindowManager.playground.parentNode) == null ? void 0 : _d.removeChild(_WindowManager.playground);
|
@@ -18112,7 +18143,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
18112
18143
|
}
|
18113
18144
|
_WindowManager.containerSizeRatio = ratio;
|
18114
18145
|
this.containerSizeRatio = ratio;
|
18115
|
-
|
18146
|
+
internalEmitter.emit("containerSizeRatioUpdate", ratio);
|
18116
18147
|
}
|
18117
18148
|
isDynamicPPT(scenes) {
|
18118
18149
|
var _a, _b;
|