@netless/app-slide 0.2.99 → 0.2.100-alpha.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/index.d.ts +63 -5
- package/dist/main.cjs.js +364 -334
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +5404 -2958
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +359 -329
- package/dist/main.iife.js.map +1 -1
- package/package.json +11 -9
- package/src/DocsViewer/ResizableContainer.ts +5 -12
- package/src/SlideController/index.ts +16 -12
- package/src/SlideController/recovery.ts +17 -0
- package/src/SlideDocsViewer/index.ts +138 -3
- package/src/index.ts +8 -3
- package/LICENSE +0 -21
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { RegisterParams, ReadonlyTeleBox, Room, AppContext, Player, View, Netles
|
|
|
2
2
|
import { SlideError, VolumeAdjuster } from '@netless/ppt-player';
|
|
3
3
|
import { IPlugin } from '@netless/plugin-system';
|
|
4
4
|
|
|
5
|
+
declare type SyncEventQueuePolicy = "fifo" | "latest-pending-render";
|
|
6
|
+
|
|
5
7
|
declare class AliTrackLogger {
|
|
6
8
|
private logList;
|
|
7
9
|
private checkTimer;
|
|
@@ -204,6 +206,10 @@ interface ISlideRenderOptions {
|
|
|
204
206
|
*/
|
|
205
207
|
transitionResolutionLevel?: number;
|
|
206
208
|
antialias?: boolean;
|
|
209
|
+
/** Maximum compressed bytes accepted for one client-decoded GIF. */
|
|
210
|
+
localGifMaxCompressedBytes?: number;
|
|
211
|
+
/** Maximum estimated GIF working set for one cached slide. */
|
|
212
|
+
localGifMaxWorkingSetBytes?: number;
|
|
207
213
|
}
|
|
208
214
|
interface INavigatorDelegate {
|
|
209
215
|
gotoPage?: (index: number) => void;
|
|
@@ -235,6 +241,12 @@ interface ISlideConfig {
|
|
|
235
241
|
* "local" Local mode, no synchronization events will be triggered
|
|
236
242
|
*/
|
|
237
243
|
mode: "interactive" | "sync" | "local" | "addLink";
|
|
244
|
+
/**
|
|
245
|
+
* Queue policy for received synchronization events.
|
|
246
|
+
* Default is "fifo". "latest-pending-render" lets interactive clients skip pending intermediate pages.
|
|
247
|
+
* Non-interactive modes always use "fifo".
|
|
248
|
+
*/
|
|
249
|
+
syncEventQueuePolicy?: SyncEventQueuePolicy;
|
|
238
250
|
/**
|
|
239
251
|
* Whether to enable global clicking, after turning on, as long as you click within the ppt viewport range,
|
|
240
252
|
* and do not trigger interactive elements inside ppt, it will trigger the next action.
|
|
@@ -303,13 +315,18 @@ interface ISlideConfig {
|
|
|
303
315
|
skipActionWhenFrozen?: boolean;
|
|
304
316
|
enableAutoForward?: boolean;
|
|
305
317
|
customLinks?: CustomLink[];
|
|
318
|
+
/**
|
|
319
|
+
* Disable the built-in ResizeObserver and rely on external notifyFrameResize() calls.
|
|
320
|
+
* Set this to true when using window-manager's boxSizeChange event as the resize signal.
|
|
321
|
+
* @default false
|
|
322
|
+
*/
|
|
323
|
+
disableFrameResizeObserver?: boolean;
|
|
306
324
|
resourceMaxRetries?: number;
|
|
307
325
|
onResourceMaxRetries?: (url: string, error: Error) => void;
|
|
308
326
|
}
|
|
309
327
|
interface MediaState {
|
|
310
328
|
type: "pause" | "play";
|
|
311
329
|
time: number;
|
|
312
|
-
frozenTime?: number;
|
|
313
330
|
fullscreen?: boolean;
|
|
314
331
|
}
|
|
315
332
|
interface TimeNodeSeqState {
|
|
@@ -460,12 +477,14 @@ declare class Slide extends Slide_base {
|
|
|
460
477
|
private userInputTime;
|
|
461
478
|
private isSyncingSlideState;
|
|
462
479
|
private frozenTaskManager;
|
|
480
|
+
private frozenMediaTimes;
|
|
463
481
|
private randomId;
|
|
464
482
|
private resize;
|
|
465
483
|
private isAnimating;
|
|
466
484
|
private renderingTaskManager;
|
|
467
485
|
private isLoading;
|
|
468
486
|
private interactive;
|
|
487
|
+
private syncCatchUpInputBlocked;
|
|
469
488
|
private anchor;
|
|
470
489
|
private tracker;
|
|
471
490
|
private player?;
|
|
@@ -481,6 +500,7 @@ declare class Slide extends Slide_base {
|
|
|
481
500
|
private enableGlobalClick;
|
|
482
501
|
private lastEmitedState;
|
|
483
502
|
private syncQueue;
|
|
503
|
+
private selfSyncEvents;
|
|
484
504
|
private playerController;
|
|
485
505
|
private lock;
|
|
486
506
|
private isInitResized;
|
|
@@ -504,6 +524,10 @@ declare class Slide extends Slide_base {
|
|
|
504
524
|
private get dispatchIncrId();
|
|
505
525
|
constructor(initConfig: ISlideConfig);
|
|
506
526
|
private _updateVolumeByStaticAdjuster;
|
|
527
|
+
private handleSyncQueueCompact;
|
|
528
|
+
private handleSyncQueueCompactRenderComplete;
|
|
529
|
+
private handleSyncQueueCatchUpStateChange;
|
|
530
|
+
private updatePlayerInteractive;
|
|
507
531
|
private recoverHandler;
|
|
508
532
|
private reportError;
|
|
509
533
|
initSlideConfig(config: ISlideConfig): ISlideConfig;
|
|
@@ -522,6 +546,12 @@ declare class Slide extends Slide_base {
|
|
|
522
546
|
private updateStageCountLimit;
|
|
523
547
|
private setMedianControllerAttribute;
|
|
524
548
|
private frameResizeHandler;
|
|
549
|
+
/**
|
|
550
|
+
* Notify the slide that its frame container may have changed size.
|
|
551
|
+
* Call this when using an external resize signal (e.g. window-manager's boxSizeChange event)
|
|
552
|
+
* instead of the built-in ResizeObserver.
|
|
553
|
+
*/
|
|
554
|
+
notifyFrameResize(): void;
|
|
525
555
|
/**
|
|
526
556
|
* Update ppt fixed height and width, this method only takes effect when the fixedFrameSize configuration item is set.
|
|
527
557
|
* @param width Width value that needs to be updated, unit px.
|
|
@@ -644,6 +674,7 @@ declare class Slide extends Slide_base {
|
|
|
644
674
|
* @param isForward Whether to flip forward or backward, affecting the page transition animation.
|
|
645
675
|
*/
|
|
646
676
|
doRenderSlide(index: number, isForward?: boolean): Promise<void>;
|
|
677
|
+
private enqueueRenderSlide;
|
|
647
678
|
getSnapshot(): string | null;
|
|
648
679
|
/**
|
|
649
680
|
* 执行下一个主序列动画
|
|
@@ -669,6 +700,11 @@ declare class Slide extends Slide_base {
|
|
|
669
700
|
* @param val boolean
|
|
670
701
|
*/
|
|
671
702
|
setInteractive(val: boolean): void;
|
|
703
|
+
/**
|
|
704
|
+
* Set how received synchronization events are scheduled.
|
|
705
|
+
* Changing the policy does not reorder or clear the current pending queue by itself.
|
|
706
|
+
*/
|
|
707
|
+
setSyncEventQueuePolicy(policy: SyncEventQueuePolicy): void;
|
|
672
708
|
/**
|
|
673
709
|
* Pause playback, asynchronous operation.
|
|
674
710
|
*/
|
|
@@ -689,6 +725,10 @@ declare class Slide extends Slide_base {
|
|
|
689
725
|
release(callback?: () => void): void;
|
|
690
726
|
private _doDestroy;
|
|
691
727
|
private waitLoadEnd;
|
|
728
|
+
/**
|
|
729
|
+
* Preload a slide. Destroying or evicting the pending slide rejects with
|
|
730
|
+
* PreloadCancelledError.
|
|
731
|
+
*/
|
|
692
732
|
preload(index: number): Promise<void>;
|
|
693
733
|
preloadResource(index: number): Promise<void>;
|
|
694
734
|
/**
|
|
@@ -1008,7 +1048,6 @@ declare class ResizableContainer {
|
|
|
1008
1048
|
private whiteboardContainer;
|
|
1009
1049
|
private slide;
|
|
1010
1050
|
private scale;
|
|
1011
|
-
private resizeObserver;
|
|
1012
1051
|
private slideWidth;
|
|
1013
1052
|
private slideHeight;
|
|
1014
1053
|
private scrollBar;
|
|
@@ -1016,7 +1055,7 @@ declare class ResizableContainer {
|
|
|
1016
1055
|
private translateX;
|
|
1017
1056
|
private translateY;
|
|
1018
1057
|
private enableResize;
|
|
1019
|
-
constructor(parent: HTMLElement, context: AppContext<Attributes, MagixEvents, AppOptions>, enableResize: boolean);
|
|
1058
|
+
constructor(parent: HTMLElement, context: AppContext<Attributes, MagixEvents, AppOptions>, enableResize: boolean, _box?: ReadonlyTeleBox);
|
|
1020
1059
|
getTranslate(): {
|
|
1021
1060
|
x: number;
|
|
1022
1061
|
y: number;
|
|
@@ -1034,7 +1073,7 @@ declare class ResizableContainer {
|
|
|
1034
1073
|
addSlideContainer(slideContainer: HTMLDivElement): void;
|
|
1035
1074
|
addWhiteboardContainer(whiteboardContainer: HTMLDivElement): void;
|
|
1036
1075
|
getCurrentScale(): number;
|
|
1037
|
-
destroy(): void;
|
|
1076
|
+
destroy(_box?: ReadonlyTeleBox): void;
|
|
1038
1077
|
}
|
|
1039
1078
|
|
|
1040
1079
|
type MountSlideOptions = Omit<SlideControllerOptions, "context" | "onPageChanged"> & {
|
|
@@ -1066,18 +1105,36 @@ declare class SlideDocsViewer {
|
|
|
1066
1105
|
protected readonly appId: string;
|
|
1067
1106
|
protected isViewMounted: boolean;
|
|
1068
1107
|
protected justSildeReadonly: boolean;
|
|
1108
|
+
protected syncEventQueuePolicy: SyncEventQueuePolicy;
|
|
1069
1109
|
private enableScale;
|
|
1110
|
+
private boxSizeEventCount;
|
|
1111
|
+
private latestBoxSize;
|
|
1112
|
+
private lastObserverSize;
|
|
1113
|
+
private lastAppliedSize;
|
|
1114
|
+
private lastAppliedSource;
|
|
1115
|
+
private offBoxSizeChange;
|
|
1116
|
+
private contentResizeObserver;
|
|
1070
1117
|
constructor({ context, box, view, mountSlideController, mountWhiteboard, baseScenePath, appId, urlInterrupter, enableScale, onPagesReady, onNavigate, }: SlideDocsViewerConfig);
|
|
1071
1118
|
$slide: HTMLDivElement;
|
|
1072
1119
|
$whiteboardView: HTMLDivElement;
|
|
1073
1120
|
$overlay: HTMLDivElement;
|
|
1074
1121
|
resizableContainer: ResizableContainer;
|
|
1075
1122
|
setJustSildeReadonly(justSildeReadonly: boolean): void;
|
|
1123
|
+
setSyncEventQueuePolicy(policy: SyncEventQueuePolicy): void;
|
|
1124
|
+
protected applyInteractionState(): void;
|
|
1076
1125
|
render(): void;
|
|
1077
1126
|
protected renderOverlay(): HTMLDivElement;
|
|
1078
1127
|
protected renderSlideContainer(): HTMLDivElement;
|
|
1079
1128
|
protected renderWhiteboardView(): HTMLDivElement;
|
|
1080
1129
|
mount(): this;
|
|
1130
|
+
private _getContentSize;
|
|
1131
|
+
private _applyResize;
|
|
1132
|
+
private _applyCurrentBoxSize;
|
|
1133
|
+
private _onObserverSize;
|
|
1134
|
+
private _reconnectContentObserver;
|
|
1135
|
+
private _observeContentSize;
|
|
1136
|
+
private _onContextBoxSizeChange;
|
|
1137
|
+
private _registerBoxSizeChange;
|
|
1081
1138
|
protected onError: ({ error, index }: {
|
|
1082
1139
|
error: Error;
|
|
1083
1140
|
index: number;
|
|
@@ -1198,7 +1255,7 @@ declare class SlidePreviewer {
|
|
|
1198
1255
|
declare const usePlugin: (plugin: any) => any;
|
|
1199
1256
|
declare const version: string;
|
|
1200
1257
|
|
|
1201
|
-
interface AppOptions extends Pick<ISlideConfig, "rtcAudio" | "useLocalCache" | "resourceTimeout" | "loaderDelegate" | "urlInterrupter" | "navigatorDelegate" | "fixedFrameSize" | "logger" | "enableGlobalClick" | "skipActionWhenFrozen"> {
|
|
1258
|
+
interface AppOptions extends Pick<ISlideConfig, "rtcAudio" | "useLocalCache" | "resourceTimeout" | "loaderDelegate" | "urlInterrupter" | "navigatorDelegate" | "fixedFrameSize" | "logger" | "enableGlobalClick" | "skipActionWhenFrozen" | "syncEventQueuePolicy"> {
|
|
1202
1259
|
/** show debug controller */
|
|
1203
1260
|
debug?: boolean;
|
|
1204
1261
|
/** scale */
|
|
@@ -1247,6 +1304,7 @@ interface AppResult {
|
|
|
1247
1304
|
prevPage: () => boolean;
|
|
1248
1305
|
jumpToPage: (page: number) => boolean;
|
|
1249
1306
|
setSildeReadonly: (bol: boolean) => void;
|
|
1307
|
+
setSyncEventQueuePolicy: (policy: NonNullable<ISlideConfig["syncEventQueuePolicy"]>) => void;
|
|
1250
1308
|
onScaleChanged: (cb: (scale: number) => void) => void;
|
|
1251
1309
|
scaleView: (to: number) => void;
|
|
1252
1310
|
getViewScale: () => number | undefined;
|