@netless/window-manager 0.4.62 → 0.4.63
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 +121 -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 +6 -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
|
}
|
@@ -2060,13 +2060,13 @@ class RedoUndo {
|
|
2060
2060
|
this.disposeViewCallbacks(view);
|
2061
2061
|
}
|
2062
2062
|
};
|
2063
|
-
|
2063
|
+
internalEmitter.on("focusedChange", (changed) => {
|
2064
2064
|
this.disposePrevFocusViewRedoUndoListeners(changed.prev);
|
2065
2065
|
setTimeout(() => {
|
2066
2066
|
this.addRedoUndoListeners(changed.focused);
|
2067
2067
|
}, 0);
|
2068
2068
|
});
|
2069
|
-
|
2069
|
+
internalEmitter.on("rootDirRemoved", () => {
|
2070
2070
|
this.disposePrevFocusViewRedoUndoListeners(context.focus());
|
2071
2071
|
this.addRedoUndoListeners(context.focus());
|
2072
2072
|
});
|
@@ -2138,7 +2138,7 @@ class AppManager {
|
|
2138
2138
|
onAddScene: this.onSceneChange,
|
2139
2139
|
onRemoveScene: async (node, name) => {
|
2140
2140
|
await this.onSceneChange(node);
|
2141
|
-
|
2141
|
+
internalEmitter.emit("rootDirSceneRemoved", name);
|
2142
2142
|
}
|
2143
2143
|
});
|
2144
2144
|
if (this.callbacksNode) {
|
@@ -2161,7 +2161,7 @@ class AppManager {
|
|
2161
2161
|
}
|
2162
2162
|
}, 100);
|
2163
2163
|
return new Promise((resolve, reject) => {
|
2164
|
-
|
2164
|
+
internalEmitter.once("rootDirSceneRemoved").then((name) => {
|
2165
2165
|
if (name === scene) {
|
2166
2166
|
resolve(true);
|
2167
2167
|
}
|
@@ -2186,7 +2186,7 @@ class AppManager {
|
|
2186
2186
|
this.emitMainViewScenesChange = (length) => {
|
2187
2187
|
return Promise.all([
|
2188
2188
|
callbacks$1.emit("mainViewScenesLengthChange", length),
|
2189
|
-
|
2189
|
+
internalEmitter.emit("changePageState")
|
2190
2190
|
]);
|
2191
2191
|
};
|
2192
2192
|
this.updateSceneState = (node) => {
|
@@ -2255,7 +2255,7 @@ class AppManager {
|
|
2255
2255
|
this.onMainViewIndexChange = (index2) => {
|
2256
2256
|
if (index2 !== void 0 && this._prevSceneIndex !== index2) {
|
2257
2257
|
callbacks$1.emit("mainViewSceneIndexChange", index2);
|
2258
|
-
|
2258
|
+
internalEmitter.emit("changePageState");
|
2259
2259
|
if (this.callbacksNode) {
|
2260
2260
|
this.updateSceneState(this.callbacksNode);
|
2261
2261
|
}
|
@@ -2266,7 +2266,7 @@ class AppManager {
|
|
2266
2266
|
var _a;
|
2267
2267
|
if (this._prevFocused !== focused) {
|
2268
2268
|
callbacks$1.emit("focusedChange", focused);
|
2269
|
-
|
2269
|
+
internalEmitter.emit("focusedChange", { focused, prev: this._prevFocused });
|
2270
2270
|
this._prevFocused = focused;
|
2271
2271
|
if (focused !== void 0) {
|
2272
2272
|
(_a = this.boxManager) == null ? void 0 : _a.focusBox({ appId: focused });
|
@@ -2280,6 +2280,7 @@ class AppManager {
|
|
2280
2280
|
}
|
2281
2281
|
};
|
2282
2282
|
this.attributesUpdateCallback = debounce((apps) => this._attributesUpdateCallback(apps), 100);
|
2283
|
+
this._appIds = [];
|
2283
2284
|
this.onRegisteredChange = (registered) => {
|
2284
2285
|
if (!registered)
|
2285
2286
|
return;
|
@@ -2332,7 +2333,7 @@ class AppManager {
|
|
2332
2333
|
this.appProxies.forEach((appProxy) => {
|
2333
2334
|
appProxy.appEmitter.emit("roomStateChange", state);
|
2334
2335
|
});
|
2335
|
-
|
2336
|
+
internalEmitter.emit("observerIdChange", this.displayer.observerId);
|
2336
2337
|
};
|
2337
2338
|
this.displayerWritableListener = (isReadonly) => {
|
2338
2339
|
var _a, _b;
|
@@ -2346,7 +2347,7 @@ class AppManager {
|
|
2346
2347
|
this.appProxies.forEach((appProxy) => {
|
2347
2348
|
appProxy.emitAppIsWritableChange();
|
2348
2349
|
});
|
2349
|
-
|
2350
|
+
internalEmitter.emit("writableChange", isWritable);
|
2350
2351
|
};
|
2351
2352
|
this.updateSceneIndex = () => {
|
2352
2353
|
const scenePath = this.store.getMainViewScenePath();
|
@@ -2376,7 +2377,7 @@ class AppManager {
|
|
2376
2377
|
this.appListeners.addListeners();
|
2377
2378
|
this.refresher = reconnectRefresher;
|
2378
2379
|
this.refresher.setRoom(this.room);
|
2379
|
-
this.refresher.setContext({ emitter });
|
2380
|
+
this.refresher.setContext({ emitter: internalEmitter });
|
2380
2381
|
this.sideEffectManager.add(() => {
|
2381
2382
|
return () => {
|
2382
2383
|
var _a, _b, _c;
|
@@ -2388,14 +2389,14 @@ class AppManager {
|
|
2388
2389
|
(_c = this.callbacksNode) == null ? void 0 : _c.dispose();
|
2389
2390
|
};
|
2390
2391
|
});
|
2391
|
-
|
2392
|
-
|
2392
|
+
internalEmitter.once("onCreated").then(() => this.onCreated());
|
2393
|
+
internalEmitter.on("onReconnected", () => this.onReconnected());
|
2393
2394
|
if (isPlayer(this.displayer)) {
|
2394
|
-
|
2395
|
-
|
2395
|
+
internalEmitter.on("seekStart", this.onPlayerSeekStart);
|
2396
|
+
internalEmitter.on("seek", this.onPlayerSeekDone);
|
2396
2397
|
}
|
2397
|
-
|
2398
|
-
|
2398
|
+
internalEmitter.on("removeScenes", this.onRemoveScenes);
|
2399
|
+
internalEmitter.on("setReadonly", this.onReadonlyChanged);
|
2399
2400
|
this.createRootDirScenesCallback();
|
2400
2401
|
appRegister.setSyncRegisterApp((payload) => {
|
2401
2402
|
this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
|
@@ -2410,7 +2411,7 @@ class AppManager {
|
|
2410
2411
|
}
|
2411
2412
|
}
|
2412
2413
|
this.mainViewProxy.rebind();
|
2413
|
-
|
2414
|
+
internalEmitter.emit("rootDirRemoved");
|
2414
2415
|
this.updateRootDirRemoving(false);
|
2415
2416
|
}
|
2416
2417
|
get eventName() {
|
@@ -2448,7 +2449,7 @@ class AppManager {
|
|
2448
2449
|
async onCreated() {
|
2449
2450
|
var _a, _b, _c, _d, _e, _f;
|
2450
2451
|
await this.attributesUpdateCallback(this.attributes.apps);
|
2451
|
-
|
2452
|
+
internalEmitter.emit("updateManagerRect");
|
2452
2453
|
boxEmitter.on("move", this.onBoxMove);
|
2453
2454
|
boxEmitter.on("resize", this.onBoxResize);
|
2454
2455
|
boxEmitter.on("focus", this.onBoxFocus);
|
@@ -2505,19 +2506,27 @@ class AppManager {
|
|
2505
2506
|
return () => redoUndo.destroy();
|
2506
2507
|
});
|
2507
2508
|
}
|
2509
|
+
notifyAppsChange(appIds) {
|
2510
|
+
if (this._appIds.length !== appIds.length || !this._appIds.every((id2) => appIds.includes(id2))) {
|
2511
|
+
this._appIds = appIds;
|
2512
|
+
callbacks$1.emit("appsChange", appIds);
|
2513
|
+
}
|
2514
|
+
}
|
2508
2515
|
async _attributesUpdateCallback(apps) {
|
2509
2516
|
if (apps && WindowManager.container) {
|
2510
2517
|
const appIds = Object.keys(apps);
|
2511
2518
|
if (appIds.length === 0) {
|
2512
2519
|
this.appCreateQueue.emitReady();
|
2513
2520
|
}
|
2514
|
-
const appsWithCreatedAt = appIds.map((appId) => {
|
2521
|
+
const appsWithCreatedAt = orderBy(appIds.map((appId) => {
|
2515
2522
|
return {
|
2516
2523
|
id: appId,
|
2517
2524
|
createdAt: apps[appId].createdAt
|
2518
2525
|
};
|
2519
|
-
});
|
2520
|
-
|
2526
|
+
}), "createdAt", "asc");
|
2527
|
+
const orderedAppIds = appsWithCreatedAt.map(({ id: id2 }) => id2);
|
2528
|
+
this.notifyAppsChange(orderedAppIds);
|
2529
|
+
for (const id2 of orderedAppIds) {
|
2521
2530
|
if (!this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2522
2531
|
const app = apps[id2];
|
2523
2532
|
try {
|
@@ -2562,7 +2571,7 @@ class AppManager {
|
|
2562
2571
|
if (!mainView.focusScenePath) {
|
2563
2572
|
this.setMainViewFocusPath();
|
2564
2573
|
}
|
2565
|
-
|
2574
|
+
internalEmitter.emit("mainViewMounted");
|
2566
2575
|
}
|
2567
2576
|
setMainViewFocusPath(scenePath) {
|
2568
2577
|
var _a;
|
@@ -2741,7 +2750,7 @@ class AppManager {
|
|
2741
2750
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
2742
2751
|
this.appListeners.removeListeners();
|
2743
2752
|
boxEmitter.clearListeners();
|
2744
|
-
|
2753
|
+
internalEmitter.clearListeners();
|
2745
2754
|
if (this.appProxies.size) {
|
2746
2755
|
this.appProxies.forEach((appProxy) => {
|
2747
2756
|
appProxy.destroy(true, false, true);
|
@@ -2803,11 +2812,11 @@ const createInvisiblePlugin = async (room) => {
|
|
2803
2812
|
};
|
2804
2813
|
const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
2805
2814
|
class ContainerResizeObserver {
|
2806
|
-
constructor(
|
2807
|
-
this.emitter =
|
2815
|
+
constructor(emitter) {
|
2816
|
+
this.emitter = emitter;
|
2808
2817
|
}
|
2809
|
-
static create(container, sizer, wrapper,
|
2810
|
-
const containerResizeObserver = new ContainerResizeObserver(
|
2818
|
+
static create(container, sizer, wrapper, emitter) {
|
2819
|
+
const containerResizeObserver = new ContainerResizeObserver(emitter);
|
2811
2820
|
containerResizeObserver.observePlaygroundSize(container, sizer, wrapper);
|
2812
2821
|
return containerResizeObserver;
|
2813
2822
|
}
|
@@ -3245,24 +3254,24 @@ var eventemitter3 = { exports: {} };
|
|
3245
3254
|
this.context = context;
|
3246
3255
|
this.once = once || false;
|
3247
3256
|
}
|
3248
|
-
function addListener(
|
3257
|
+
function addListener(emitter, event, fn, context, once) {
|
3249
3258
|
if (typeof fn !== "function") {
|
3250
3259
|
throw new TypeError("The listener must be a function");
|
3251
3260
|
}
|
3252
|
-
var listener = new EE(fn, context ||
|
3253
|
-
if (!
|
3254
|
-
|
3255
|
-
else if (!
|
3256
|
-
|
3261
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
3262
|
+
if (!emitter._events[evt])
|
3263
|
+
emitter._events[evt] = listener, emitter._eventsCount++;
|
3264
|
+
else if (!emitter._events[evt].fn)
|
3265
|
+
emitter._events[evt].push(listener);
|
3257
3266
|
else
|
3258
|
-
|
3259
|
-
return
|
3267
|
+
emitter._events[evt] = [emitter._events[evt], listener];
|
3268
|
+
return emitter;
|
3260
3269
|
}
|
3261
|
-
function clearEvent(
|
3262
|
-
if (--
|
3263
|
-
|
3270
|
+
function clearEvent(emitter, evt) {
|
3271
|
+
if (--emitter._eventsCount === 0)
|
3272
|
+
emitter._events = new Events2();
|
3264
3273
|
else
|
3265
|
-
delete
|
3274
|
+
delete emitter._events[evt];
|
3266
3275
|
}
|
3267
3276
|
function EventEmitter2() {
|
3268
3277
|
this._events = new Events2();
|
@@ -6182,7 +6191,7 @@ class TeleBoxManager {
|
|
6182
6191
|
return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
|
6183
6192
|
}
|
6184
6193
|
}
|
6185
|
-
const createBoxManager = (manager, callbacks2,
|
6194
|
+
const createBoxManager = (manager, callbacks2, emitter, boxEmitter2, options) => {
|
6186
6195
|
return new BoxManager({
|
6187
6196
|
safeSetAttributes: (attributes) => manager.safeSetAttributes(attributes),
|
6188
6197
|
getMainView: () => manager.mainView,
|
@@ -6204,7 +6213,7 @@ const createBoxManager = (manager, callbacks2, emitter2, boxEmitter2, options) =
|
|
6204
6213
|
return (_a = manager.appManager) == null ? void 0 : _a.store.setAppFocus(appId, true);
|
6205
6214
|
},
|
6206
6215
|
callbacks: callbacks2,
|
6207
|
-
emitter
|
6216
|
+
emitter,
|
6208
6217
|
boxEmitter: boxEmitter2
|
6209
6218
|
}, options);
|
6210
6219
|
};
|
@@ -6212,11 +6221,11 @@ class BoxManager {
|
|
6212
6221
|
constructor(context, createTeleBoxManagerConfig) {
|
6213
6222
|
this.context = context;
|
6214
6223
|
this.createTeleBoxManagerConfig = createTeleBoxManagerConfig;
|
6215
|
-
const { emitter
|
6224
|
+
const { emitter, callbacks: callbacks2, boxEmitter: boxEmitter2 } = context;
|
6216
6225
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
6217
6226
|
this.teleBoxManager._state$.reaction((state) => {
|
6218
6227
|
callbacks2.emit("boxStateChange", state);
|
6219
|
-
|
6228
|
+
emitter.emit("boxStateChange", state);
|
6220
6229
|
});
|
6221
6230
|
this.teleBoxManager._darkMode$.reaction((darkMode) => {
|
6222
6231
|
callbacks2.emit("darkModeChange", darkMode);
|
@@ -6277,8 +6286,8 @@ class BoxManager {
|
|
6277
6286
|
this.teleBoxManager.events.on("z_index", (box) => {
|
6278
6287
|
this.context.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
6279
6288
|
});
|
6280
|
-
|
6281
|
-
|
6289
|
+
emitter.on("playgroundSizeChange", () => this.updateManagerRect());
|
6290
|
+
emitter.on("updateManagerRect", () => this.updateManagerRect());
|
6282
6291
|
}
|
6283
6292
|
get mainView() {
|
6284
6293
|
return this.context.getMainView();
|
@@ -7356,10 +7365,10 @@ class CursorManager {
|
|
7356
7365
|
this.setupWrapper(wrapper);
|
7357
7366
|
}
|
7358
7367
|
this.sideEffectManager.add(() => {
|
7359
|
-
return
|
7368
|
+
return internalEmitter.on("cursorMove", this.onCursorMove);
|
7360
7369
|
});
|
7361
7370
|
this.sideEffectManager.add(() => {
|
7362
|
-
return
|
7371
|
+
return internalEmitter.on("playgroundSizeChange", () => this.updateContainerRect());
|
7363
7372
|
});
|
7364
7373
|
if (applianceIcons) {
|
7365
7374
|
this.applianceIcons = __spreadValues(__spreadValues({}, ApplianceMap), applianceIcons);
|
@@ -7458,17 +7467,15 @@ class CursorManager {
|
|
7458
7467
|
class PageStateImpl {
|
7459
7468
|
constructor(manager) {
|
7460
7469
|
this.manager = manager;
|
7461
|
-
|
7470
|
+
internalEmitter.on("changePageState", () => {
|
7462
7471
|
callbacks$1.emit("pageStateChange", this.toObject());
|
7463
7472
|
});
|
7464
7473
|
}
|
7465
7474
|
get index() {
|
7466
|
-
|
7467
|
-
return ((_a = this.manager) == null ? void 0 : _a.store.getMainViewSceneIndex()) || 0;
|
7475
|
+
return this.manager.store.getMainViewSceneIndex() || 0;
|
7468
7476
|
}
|
7469
7477
|
get length() {
|
7470
|
-
|
7471
|
-
return ((_a = this.manager) == null ? void 0 : _a.mainViewScenesLength) || 0;
|
7478
|
+
return this.manager.mainViewScenesLength || 0;
|
7472
7479
|
}
|
7473
7480
|
toObject() {
|
7474
7481
|
const index2 = this.index >= this.length ? this.length - 1 : this.index;
|
@@ -7629,16 +7636,16 @@ const delegateRemoveScenes = (room, manager) => {
|
|
7629
7636
|
(_a = manager.appManager) == null ? void 0 : _a.updateRootDirRemoving(true);
|
7630
7637
|
}
|
7631
7638
|
const result = originRemoveScenes.call(room, scenePath);
|
7632
|
-
|
7639
|
+
internalEmitter.emit("removeScenes", { scenePath, index: index2 });
|
7633
7640
|
return result;
|
7634
7641
|
};
|
7635
7642
|
};
|
7636
7643
|
const delegateSeekToProgressTime = (player) => {
|
7637
7644
|
const originSeek = player.seekToProgressTime;
|
7638
7645
|
async function newSeek(time2) {
|
7639
|
-
await
|
7646
|
+
await internalEmitter.emit("seekStart");
|
7640
7647
|
const seekResult = await originSeek.call(player, time2);
|
7641
|
-
|
7648
|
+
internalEmitter.emit("seek", time2);
|
7642
7649
|
return seekResult;
|
7643
7650
|
}
|
7644
7651
|
player.seekToProgressTime = newSeek;
|
@@ -17453,11 +17460,11 @@ IframeBridge.hiddenClass = "netless-iframe-brdige-hidden";
|
|
17453
17460
|
IframeBridge.emitter = new Emittery();
|
17454
17461
|
IframeBridge.displayer = null;
|
17455
17462
|
IframeBridge.alreadyCreate = false;
|
17456
|
-
const reconnectRefresher = new ReconnectRefresher({ emitter });
|
17463
|
+
const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
17457
17464
|
const _WindowManager = class extends InvisiblePlugin {
|
17458
17465
|
constructor(context) {
|
17459
17466
|
super(context);
|
17460
|
-
this.version = "0.4.
|
17467
|
+
this.version = "0.4.63";
|
17461
17468
|
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
17469
|
this.emitter = callbacks$1;
|
17463
17470
|
this.viewMode = ViewMode.Broadcaster;
|
@@ -17510,6 +17517,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17510
17517
|
_WindowManager.containerSizeRatio = containerSizeRatio;
|
17511
17518
|
}
|
17512
17519
|
await manager.ensureAttributes();
|
17520
|
+
manager._fullscreen = params.fullscreen;
|
17513
17521
|
manager.appManager = new AppManager(manager);
|
17514
17522
|
manager._pageState = new PageStateImpl(manager.appManager);
|
17515
17523
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
|
@@ -17520,7 +17528,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17520
17528
|
manager.bindContainer(params.container);
|
17521
17529
|
}
|
17522
17530
|
replaceRoomFunction(room, manager);
|
17523
|
-
|
17531
|
+
internalEmitter.emit("onCreated");
|
17524
17532
|
_WindowManager.isCreated = true;
|
17525
17533
|
try {
|
17526
17534
|
await initDb();
|
@@ -17551,7 +17559,12 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17551
17559
|
}
|
17552
17560
|
return manager;
|
17553
17561
|
}
|
17554
|
-
static initContainer(manager, container,
|
17562
|
+
static initContainer(manager, container, params) {
|
17563
|
+
const {
|
17564
|
+
chessboard,
|
17565
|
+
overwriteStyles,
|
17566
|
+
fullscreen
|
17567
|
+
} = params;
|
17555
17568
|
if (!_WindowManager.container) {
|
17556
17569
|
_WindowManager.container = container;
|
17557
17570
|
}
|
@@ -17560,13 +17573,17 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17560
17573
|
if (chessboard) {
|
17561
17574
|
sizer.classList.add("netless-window-manager-chess-sizer");
|
17562
17575
|
}
|
17576
|
+
if (fullscreen) {
|
17577
|
+
sizer.classList.add("netless-window-manager-fullscreen");
|
17578
|
+
}
|
17563
17579
|
if (overwriteStyles) {
|
17564
17580
|
const style2 = document.createElement("style");
|
17565
17581
|
style2.textContent = overwriteStyles;
|
17566
17582
|
playground.appendChild(style2);
|
17567
17583
|
}
|
17568
|
-
manager.containerResizeObserver = ContainerResizeObserver.create(playground, sizer, wrapper,
|
17584
|
+
manager.containerResizeObserver = ContainerResizeObserver.create(playground, sizer, wrapper, internalEmitter);
|
17569
17585
|
_WindowManager.wrapper = wrapper;
|
17586
|
+
_WindowManager.sizer = sizer;
|
17570
17587
|
return mainViewElement;
|
17571
17588
|
}
|
17572
17589
|
static get registered() {
|
@@ -17584,11 +17601,11 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17584
17601
|
} else {
|
17585
17602
|
if (_WindowManager.params) {
|
17586
17603
|
const params = _WindowManager.params;
|
17587
|
-
const mainViewElement = _WindowManager.initContainer(this, container, params
|
17604
|
+
const mainViewElement = _WindowManager.initContainer(this, container, params);
|
17588
17605
|
if (this.boxManager) {
|
17589
17606
|
this.boxManager.destroy();
|
17590
17607
|
}
|
17591
|
-
const boxManager = createBoxManager(this, callbacks$1,
|
17608
|
+
const boxManager = createBoxManager(this, callbacks$1, internalEmitter, boxEmitter, {
|
17592
17609
|
collectorContainer: params.collectorContainer,
|
17593
17610
|
collectorStyles: params.collectorStyles,
|
17594
17611
|
prefersColorScheme: params.prefersColorScheme
|
@@ -17601,7 +17618,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17601
17618
|
}
|
17602
17619
|
}
|
17603
17620
|
}
|
17604
|
-
|
17621
|
+
internalEmitter.emit("updateManagerRect");
|
17605
17622
|
(_c = this.appManager) == null ? void 0 : _c.refresh();
|
17606
17623
|
(_d = this.appManager) == null ? void 0 : _d.resetMaximized();
|
17607
17624
|
(_e = this.appManager) == null ? void 0 : _e.resetMinimized();
|
@@ -17627,7 +17644,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17627
17644
|
if (this.appManager) {
|
17628
17645
|
if (this.appManager.rootDirRemoving) {
|
17629
17646
|
return new Promise((resolve, reject) => {
|
17630
|
-
|
17647
|
+
internalEmitter.once("rootDirRemoved").then(async () => {
|
17631
17648
|
try {
|
17632
17649
|
const appId = await this._addApp(params);
|
17633
17650
|
resolve(appId);
|
@@ -17797,7 +17814,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17797
17814
|
var _a;
|
17798
17815
|
this.readonly = readonly;
|
17799
17816
|
(_a = this.boxManager) == null ? void 0 : _a.setReadonly(readonly);
|
17800
|
-
|
17817
|
+
internalEmitter.emit("setReadonly", readonly);
|
17801
17818
|
}
|
17802
17819
|
switchMainViewToWriter() {
|
17803
17820
|
var _a;
|
@@ -17849,6 +17866,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17849
17866
|
return;
|
17850
17867
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(minimized, false);
|
17851
17868
|
}
|
17869
|
+
setFullscreen(fullscreen) {
|
17870
|
+
var _a;
|
17871
|
+
if (this._fullscreen !== fullscreen) {
|
17872
|
+
this._fullscreen = fullscreen;
|
17873
|
+
(_a = _WindowManager.sizer) == null ? void 0 : _a.classList.toggle("netless-window-manager-fullscreen", fullscreen);
|
17874
|
+
callbacks$1.emit("fullscreenChange", fullscreen);
|
17875
|
+
}
|
17876
|
+
}
|
17852
17877
|
get mainView() {
|
17853
17878
|
if (this.appManager) {
|
17854
17879
|
return this.appManager.mainViewProxy.view;
|
@@ -17943,6 +17968,9 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
17943
17968
|
throw new AppManagerNotInitError();
|
17944
17969
|
}
|
17945
17970
|
}
|
17971
|
+
get fullscreen() {
|
17972
|
+
return Boolean(this._fullscreen);
|
17973
|
+
}
|
17946
17974
|
queryAll() {
|
17947
17975
|
var _a;
|
17948
17976
|
return Array.from(((_a = this.appManager) == null ? void 0 : _a.appProxies.values()) || []);
|
@@ -18004,6 +18032,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
18004
18032
|
(_c = this.cursorManager) == null ? void 0 : _c.destroy();
|
18005
18033
|
_WindowManager.container = void 0;
|
18006
18034
|
_WindowManager.wrapper = void 0;
|
18035
|
+
_WindowManager.sizer = void 0;
|
18007
18036
|
_WindowManager.isCreated = false;
|
18008
18037
|
if (_WindowManager.playground) {
|
18009
18038
|
(_d = _WindowManager.playground.parentNode) == null ? void 0 : _d.removeChild(_WindowManager.playground);
|
@@ -18112,7 +18141,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
18112
18141
|
}
|
18113
18142
|
_WindowManager.containerSizeRatio = ratio;
|
18114
18143
|
this.containerSizeRatio = ratio;
|
18115
|
-
|
18144
|
+
internalEmitter.emit("containerSizeRatioUpdate", ratio);
|
18116
18145
|
}
|
18117
18146
|
isDynamicPPT(scenes) {
|
18118
18147
|
var _a, _b;
|