@netless/app-slide 0.2.32 → 0.2.33
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 +975 -20
- package/dist/main.cjs.js +2 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -2
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +2 -2
- package/dist/main.iife.js.map +1 -1
- package/package.json +3 -3
- package/dist/DocsViewer/icons/arrow-left.d.ts +0 -1
- package/dist/DocsViewer/icons/arrow-right.d.ts +0 -1
- package/dist/DocsViewer/icons/pause.d.ts +0 -1
- package/dist/DocsViewer/icons/play.d.ts +0 -1
- package/dist/DocsViewer/icons/sidebar.d.ts +0 -1
- package/dist/DocsViewer/index.d.ts +0 -53
- package/dist/SlideController/helpers.d.ts +0 -6
- package/dist/SlideController/index.d.ts +0 -64
- package/dist/SlideDocsViewer/index.d.ts +0 -60
- package/dist/SlidePreviewer/index.d.ts +0 -52
- package/dist/typings.d.ts +0 -17
- package/dist/utils/bgcolor.d.ts +0 -3
- package/dist/utils/freezer.d.ts +0 -28
- package/dist/utils/helpers.d.ts +0 -6
- package/dist/utils/logger.d.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/app-slide",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"README-zh.md"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@netless/slide": "^0.11.
|
|
13
|
+
"@netless/slide": "^0.11.2",
|
|
14
14
|
"@types/color-string": "^1.5.2",
|
|
15
15
|
"color-string": "^1.9.1",
|
|
16
16
|
"jspdf": "2.5.1",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"types": "
|
|
29
|
+
"types": "node scripts/build-types.mjs",
|
|
30
30
|
"build": "vite build && npm run types",
|
|
31
31
|
"build:dev": "vite build --mode development && npm run types",
|
|
32
32
|
"cleanup": "rimraf ./dist"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function arrowLeftSVG(namespace: string): SVGElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function arrowRightSVG(namespace: string): SVGElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function pauseSVG(namespace: string): SVGElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function playSVG(namespace: string): SVGElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sidebarSVG(namespace: string): SVGElement;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { SideEffectManager } from "side-effect-manager";
|
|
2
|
-
export interface DocsViewerPage {
|
|
3
|
-
src: string;
|
|
4
|
-
height: number;
|
|
5
|
-
width: number;
|
|
6
|
-
thumbnail?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface DocsViewerConfig {
|
|
9
|
-
readonly: boolean;
|
|
10
|
-
onNewPageIndex: (index: number) => void;
|
|
11
|
-
onPlay?: () => void;
|
|
12
|
-
}
|
|
13
|
-
export declare class DocsViewer {
|
|
14
|
-
constructor({ readonly, onNewPageIndex, onPlay }: DocsViewerConfig);
|
|
15
|
-
protected readonly: boolean;
|
|
16
|
-
protected onNewPageIndex: (index: number) => void;
|
|
17
|
-
protected onPlay?: () => void;
|
|
18
|
-
private _pages;
|
|
19
|
-
set pages(value: DocsViewerPage[]);
|
|
20
|
-
get pages(): DocsViewerPage[];
|
|
21
|
-
$content: HTMLElement;
|
|
22
|
-
$preview: HTMLElement;
|
|
23
|
-
$previewMask: HTMLElement;
|
|
24
|
-
$footer: HTMLElement;
|
|
25
|
-
$pageNumberInput: HTMLInputElement;
|
|
26
|
-
$totalPage: HTMLSpanElement;
|
|
27
|
-
$btnPlay: HTMLButtonElement;
|
|
28
|
-
$btnSidebar: HTMLButtonElement;
|
|
29
|
-
pageIndex: number;
|
|
30
|
-
unmount(): void;
|
|
31
|
-
setReadonly(readonly: boolean): void;
|
|
32
|
-
destroy(): void;
|
|
33
|
-
setPageIndex(pageIndex: number): void;
|
|
34
|
-
refreshTotalPage(): void;
|
|
35
|
-
setSmallBox(isSmallBox: boolean): void;
|
|
36
|
-
render(): HTMLElement;
|
|
37
|
-
protected renderContent(): HTMLElement;
|
|
38
|
-
private previewLazyLoad?;
|
|
39
|
-
protected renderPreview(): HTMLElement;
|
|
40
|
-
private refreshPreview;
|
|
41
|
-
protected renderPreviewMask(): HTMLElement;
|
|
42
|
-
setPaused: () => void;
|
|
43
|
-
setPlaying: () => void;
|
|
44
|
-
refreshBtnSidebar(): void;
|
|
45
|
-
protected renderFooter(): HTMLElement;
|
|
46
|
-
protected renderFooterBtn(className: string, $icon: SVGElement, $iconActive?: SVGElement): HTMLButtonElement;
|
|
47
|
-
protected togglePreview(isShowPreview?: boolean): void;
|
|
48
|
-
protected wrapClassName(className: string): string;
|
|
49
|
-
protected namespace: string;
|
|
50
|
-
protected isShowPreview: boolean;
|
|
51
|
-
protected isSmallBox: boolean;
|
|
52
|
-
protected sideEffect: SideEffectManager;
|
|
53
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AppContext, Room } from "@netless/window-manager";
|
|
2
|
-
import type { Slide } from "@netless/slide";
|
|
3
|
-
import type { DocsViewerPage } from "../DocsViewer";
|
|
4
|
-
import type { Attributes } from "../typings";
|
|
5
|
-
export declare function createDocsViewerPages(slide: Slide): DocsViewerPage[];
|
|
6
|
-
export declare function syncSceneWithSlide(room: Room, context: AppContext<Attributes>, slide: Slide, baseScenePath: string): void;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { AppContext } from "@netless/window-manager";
|
|
2
|
-
import type { Attributes, MagixEvents } from "../typings";
|
|
3
|
-
import type { AppOptions } from "..";
|
|
4
|
-
import { Slide } from "@netless/slide";
|
|
5
|
-
export { syncSceneWithSlide, createDocsViewerPages } from "./helpers";
|
|
6
|
-
export declare const DefaultUrl = "https://convertcdn.netless.link/dynamicConvert";
|
|
7
|
-
export declare const MaxPollCount = 40;
|
|
8
|
-
export declare const EmptyAttributes: Attributes;
|
|
9
|
-
export interface SlideControllerOptions {
|
|
10
|
-
context: AppContext<Attributes, MagixEvents, AppOptions>;
|
|
11
|
-
anchor: HTMLDivElement;
|
|
12
|
-
onRenderEnd: () => void;
|
|
13
|
-
onPageChanged: (page: number) => void;
|
|
14
|
-
onTransitionStart: () => void;
|
|
15
|
-
onTransitionEnd: () => void;
|
|
16
|
-
onError: (args: {
|
|
17
|
-
error: Error;
|
|
18
|
-
index: number;
|
|
19
|
-
}) => void;
|
|
20
|
-
onRenderError?: (error: Error, pageIndex: number) => void;
|
|
21
|
-
showRenderError?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export declare class SlideController {
|
|
24
|
-
readonly context: SlideControllerOptions["context"];
|
|
25
|
-
readonly slide: Slide;
|
|
26
|
-
readonly showRenderError: boolean;
|
|
27
|
-
readonly onRenderError?: (error: Error, pageIndex: number) => void;
|
|
28
|
-
private readonly room?;
|
|
29
|
-
private readonly player?;
|
|
30
|
-
private readonly sideEffect;
|
|
31
|
-
private readonly onPageChanged;
|
|
32
|
-
private readonly onTransitionStart;
|
|
33
|
-
private readonly onTransitionEnd;
|
|
34
|
-
private readonly onError;
|
|
35
|
-
private syncStateOnceFlag;
|
|
36
|
-
private visible;
|
|
37
|
-
private savedIsFrozen;
|
|
38
|
-
constructor({ context, anchor, onPageChanged, onTransitionStart, onTransitionEnd, onError, onRenderError, showRenderError, }: SlideControllerOptions);
|
|
39
|
-
ready: boolean;
|
|
40
|
-
private resolveReady;
|
|
41
|
-
readonly readyPromise: Promise<void>;
|
|
42
|
-
jumpToPage(page: number): void;
|
|
43
|
-
private initialize;
|
|
44
|
-
private kickStart;
|
|
45
|
-
private registerEventListeners;
|
|
46
|
-
private onSyncDispatch;
|
|
47
|
-
private magixEventListener;
|
|
48
|
-
private syncStateOnce;
|
|
49
|
-
private onStateChange;
|
|
50
|
-
private pollCount;
|
|
51
|
-
private pollReadyState;
|
|
52
|
-
private _pageCount;
|
|
53
|
-
get pageCount(): number;
|
|
54
|
-
get page(): number;
|
|
55
|
-
private createSlide;
|
|
56
|
-
private destroyed;
|
|
57
|
-
destroy(): void;
|
|
58
|
-
timestamp: () => number;
|
|
59
|
-
isFrozen: boolean;
|
|
60
|
-
private _toFreeze;
|
|
61
|
-
freeze: () => void;
|
|
62
|
-
unfreeze: () => Promise<void>;
|
|
63
|
-
private onVisibilityChange;
|
|
64
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyTeleBox, View } from "@netless/window-manager";
|
|
2
|
-
import type { SlideController, SlideControllerOptions } from "../SlideController";
|
|
3
|
-
import { SideEffectManager } from "side-effect-manager";
|
|
4
|
-
import { DocsViewer } from "../DocsViewer";
|
|
5
|
-
export declare const ClickThroughAppliances: Set<string>;
|
|
6
|
-
export declare type MountSlideOptions = Omit<SlideControllerOptions, "context" | "onPageChanged"> & {
|
|
7
|
-
onReady: () => void;
|
|
8
|
-
};
|
|
9
|
-
export interface SlideDocsViewerConfig {
|
|
10
|
-
box: ReadonlyTeleBox;
|
|
11
|
-
view: View;
|
|
12
|
-
mountSlideController: (options: MountSlideOptions) => SlideController;
|
|
13
|
-
mountWhiteboard: (dom: HTMLDivElement) => void;
|
|
14
|
-
baseScenePath: string;
|
|
15
|
-
appId: string;
|
|
16
|
-
}
|
|
17
|
-
export interface SavePdfConfig {
|
|
18
|
-
appId: string;
|
|
19
|
-
type: "@netless/_request_save_pdf_";
|
|
20
|
-
}
|
|
21
|
-
export declare class SlideDocsViewer {
|
|
22
|
-
viewer: DocsViewer;
|
|
23
|
-
slideController: SlideController | null;
|
|
24
|
-
protected readonly box: ReadonlyTeleBox;
|
|
25
|
-
protected readonly whiteboardView: SlideDocsViewerConfig["view"];
|
|
26
|
-
protected readonly mountSlideController: SlideDocsViewerConfig["mountSlideController"];
|
|
27
|
-
protected readonly mountWhiteboard: SlideDocsViewerConfig["mountWhiteboard"];
|
|
28
|
-
private readonly baseScenePath;
|
|
29
|
-
private readonly appId;
|
|
30
|
-
private isViewMounted;
|
|
31
|
-
constructor({ box, view, mountSlideController, mountWhiteboard, baseScenePath, appId, }: SlideDocsViewerConfig);
|
|
32
|
-
$slide: HTMLDivElement;
|
|
33
|
-
$whiteboardView: HTMLDivElement;
|
|
34
|
-
$overlay: HTMLDivElement;
|
|
35
|
-
render(): void;
|
|
36
|
-
protected renderOverlay(): HTMLDivElement;
|
|
37
|
-
protected renderSlideContainer(): HTMLDivElement;
|
|
38
|
-
protected renderWhiteboardView(): HTMLDivElement;
|
|
39
|
-
mount(): this;
|
|
40
|
-
protected onError: ({ error, index }: {
|
|
41
|
-
error: Error;
|
|
42
|
-
index: number;
|
|
43
|
-
}) => void;
|
|
44
|
-
protected onRenderEnd: () => void;
|
|
45
|
-
protected refreshPages: () => void;
|
|
46
|
-
protected getPageIndex(page: number): number;
|
|
47
|
-
unmount(): this;
|
|
48
|
-
setReadonly(readonly: boolean): void;
|
|
49
|
-
destroy(): void;
|
|
50
|
-
toggleClickThrough(tool?: string): void;
|
|
51
|
-
protected scaleDocsToFit: () => void;
|
|
52
|
-
protected onPlay: () => void;
|
|
53
|
-
protected onNewPageIndex: (index: number) => void;
|
|
54
|
-
protected sideEffect: SideEffectManager;
|
|
55
|
-
protected wrapClassName(className: string): string;
|
|
56
|
-
protected namespace: string;
|
|
57
|
-
private getWhiteSnapshot;
|
|
58
|
-
private reportProgress;
|
|
59
|
-
private toPdf;
|
|
60
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Slide } from "@netless/slide";
|
|
2
|
-
import { DocsViewer } from "../DocsViewer";
|
|
3
|
-
export interface PreviewParams {
|
|
4
|
-
container: HTMLElement;
|
|
5
|
-
taskId: string;
|
|
6
|
-
url?: string;
|
|
7
|
-
debug?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export default function previewSlide({ container, taskId, url, debug, }: PreviewParams): SlidePreviewer;
|
|
10
|
-
export declare class SlidePreviewer {
|
|
11
|
-
readonly viewer: DocsViewer;
|
|
12
|
-
readonly bgColor: string;
|
|
13
|
-
readonly target: HTMLElement;
|
|
14
|
-
slide: Slide | null;
|
|
15
|
-
debug: boolean;
|
|
16
|
-
$slide: HTMLDivElement;
|
|
17
|
-
private readonly sideEffect;
|
|
18
|
-
ready: boolean;
|
|
19
|
-
private resolveReady;
|
|
20
|
-
readonly readyPromise: Promise<void>;
|
|
21
|
-
constructor(config: {
|
|
22
|
-
target: HTMLElement;
|
|
23
|
-
});
|
|
24
|
-
render(): void;
|
|
25
|
-
/**
|
|
26
|
-
* In case you have a different window -- for example, in electron.
|
|
27
|
-
* Use this method to re-register hotkeys.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* previewer.registerHotKeys(windowLike)
|
|
31
|
-
*/
|
|
32
|
-
registerHotKeys(windowLike: Window): void;
|
|
33
|
-
private hotkeyListener;
|
|
34
|
-
mount(taskId: string, url: string): void;
|
|
35
|
-
protected renderStyle(): HTMLElement;
|
|
36
|
-
protected registerEventListeners(): void;
|
|
37
|
-
protected onPageChanged: (page: number) => void;
|
|
38
|
-
protected onTransitionStart: () => void;
|
|
39
|
-
protected onTransitionEnd: () => void;
|
|
40
|
-
protected onError: ({ error }: {
|
|
41
|
-
error: Error;
|
|
42
|
-
}) => void;
|
|
43
|
-
private destroyed;
|
|
44
|
-
destroy(): void;
|
|
45
|
-
protected refreshPages: () => void;
|
|
46
|
-
protected getPageIndex(page: number): number;
|
|
47
|
-
protected renderSlideContainer(): HTMLDivElement;
|
|
48
|
-
protected onPlay: () => void;
|
|
49
|
-
protected onNewPageIndex: (index: number) => void;
|
|
50
|
-
protected wrapClassName(className: string): string;
|
|
51
|
-
protected namespace: string;
|
|
52
|
-
}
|
package/dist/typings.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Slide, SLIDE_EVENTS, SyncEvent } from "@netless/slide";
|
|
2
|
-
export declare type SlideState = Slide["slideState"];
|
|
3
|
-
export interface Attributes {
|
|
4
|
-
/** convert task id */
|
|
5
|
-
taskId: string;
|
|
6
|
-
/** base url of converted resources */
|
|
7
|
-
url: string;
|
|
8
|
-
/** internal state of slide, do not change */
|
|
9
|
-
state: SlideState | null;
|
|
10
|
-
}
|
|
11
|
-
export declare type MagixPayload = {
|
|
12
|
-
type: typeof SLIDE_EVENTS.syncDispatch;
|
|
13
|
-
payload: SyncEvent;
|
|
14
|
-
};
|
|
15
|
-
export declare type MagixEvents = {
|
|
16
|
-
[SLIDE_EVENTS.syncDispatch]: MagixPayload;
|
|
17
|
-
};
|
package/dist/utils/bgcolor.d.ts
DELETED
package/dist/utils/freezer.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyTeleBox, RegisterParams } from "@netless/window-manager";
|
|
2
|
-
export interface FreezableSlide {
|
|
3
|
-
freeze: () => void;
|
|
4
|
-
unfreeze: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare let useFreezer: boolean;
|
|
7
|
-
export declare let FreezerLength: number;
|
|
8
|
-
export declare function getFreezerLength(): number;
|
|
9
|
-
/** @param length - must be >= 1, default is 2 */
|
|
10
|
-
export declare function setFreezerLength(length: number): void;
|
|
11
|
-
export declare const apps: {
|
|
12
|
-
map: Map<string, FreezableSlide>;
|
|
13
|
-
boxes: Map<string, ReadonlyTeleBox>;
|
|
14
|
-
queue: string[];
|
|
15
|
-
validateQueue(): void;
|
|
16
|
-
set(appId: string, slide: FreezableSlide, box: ReadonlyTeleBox): void;
|
|
17
|
-
delete(appId: string): void;
|
|
18
|
-
focus(appId: string): void;
|
|
19
|
-
};
|
|
20
|
-
export declare function onCreated(callback: (appId: string) => void): () => boolean;
|
|
21
|
-
export declare function onDestroyed(callback: (appId: string) => void): () => boolean;
|
|
22
|
-
export declare type AddHooks = NonNullable<RegisterParams["addHooks"]>;
|
|
23
|
-
/**
|
|
24
|
-
* Put this function in your register code:
|
|
25
|
-
* `WindowManager.register({ kind: 'Slide', src: SlideApp, addHooks })`
|
|
26
|
-
* So that it will automatically freeze the app when it is not in focus.
|
|
27
|
-
*/
|
|
28
|
-
export declare const addHooks: AddHooks;
|
package/dist/utils/helpers.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function clamp(value: number, min: number, max: number): number;
|
|
2
|
-
export declare function flattenEvent(ev: MouseEvent | TouchEvent): MouseEvent | Touch;
|
|
3
|
-
export declare function preventEvent(ev: Event): void;
|
|
4
|
-
export declare function isObj(obj: unknown): boolean;
|
|
5
|
-
export declare function wait(ms: number): Promise<void>;
|
|
6
|
-
export declare function deepClone<T>(obj: T): T;
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { AppContext, Displayer } from "@netless/window-manager";
|
|
2
|
-
import type { SlideController } from "../SlideController";
|
|
3
|
-
declare type DebugMessage = {
|
|
4
|
-
slide: boolean | "__instance" | "__debug";
|
|
5
|
-
};
|
|
6
|
-
declare type RoomLogger = {
|
|
7
|
-
debug: (...args: any) => void;
|
|
8
|
-
info: (...args: any) => void;
|
|
9
|
-
warn: (...args: any) => void;
|
|
10
|
-
};
|
|
11
|
-
declare class Logger {
|
|
12
|
-
enable: boolean;
|
|
13
|
-
apps: Record<string, {
|
|
14
|
-
context?: AppContext | null;
|
|
15
|
-
controller?: SlideController | null;
|
|
16
|
-
}>;
|
|
17
|
-
setAppContext(appId: string, context: AppContext | null): void;
|
|
18
|
-
setAppController(appId: string, controller: SlideController | null): void;
|
|
19
|
-
deleteApp(appId: string): void;
|
|
20
|
-
level: "debug" | "verbose";
|
|
21
|
-
roomLogger: RoomLogger | null;
|
|
22
|
-
constructor(enable: boolean);
|
|
23
|
-
initialize(): void;
|
|
24
|
-
dispose(): void;
|
|
25
|
-
log(...args: any[]): void;
|
|
26
|
-
verbose(...args: any[]): void;
|
|
27
|
-
warn(...args: any[]): void;
|
|
28
|
-
/**
|
|
29
|
-
* @example
|
|
30
|
-
* window.postMessage({ slide: '__debug' })
|
|
31
|
-
* window.dispatchEvent(new MessageEvent('message', { data: { slide: '__debug' } }))
|
|
32
|
-
*/
|
|
33
|
-
_onMessage: (ev: MessageEvent<DebugMessage> | CustomEvent<DebugMessage>) => void;
|
|
34
|
-
}
|
|
35
|
-
export declare const logger: Logger;
|
|
36
|
-
export declare const log: (...args: any[]) => void;
|
|
37
|
-
export declare const verbose: (...args: any[]) => void;
|
|
38
|
-
export declare const setRoomLogger: (displayer: Displayer) => void;
|
|
39
|
-
export {};
|