@netless/app-presentation 0.1.9-beta.5 → 0.1.9-beta.6
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/build.ts +3 -0
- package/dist/index.d.ts +53 -40
- package/dist/index.global.js +214 -126
- package/dist/index.js +214 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +215 -126
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
- package/src/app-presentation.ts +104 -17
- package/src/presentation.ts +5 -5
- package/src/scrollbar/index.ts +34 -19
package/build.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { View, AppContext,
|
|
1
|
+
import { NetlessApp, View, AppContext, WindowManager } from '@netless/window-manager';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A
|
|
5
|
-
|
|
6
|
-
type Disposer<T = any> = () => T;
|
|
7
|
-
/**
|
|
8
|
-
* An object that has a `dispose` method to dispose resources.
|
|
4
|
+
* A combination of {@link Disposer} and {@link IDisposable}.
|
|
5
|
+
* It can be called to dispose resources or call the `dispose` method to dispose resources.
|
|
9
6
|
*/
|
|
10
|
-
interface
|
|
7
|
+
interface DisposableDisposer<T = any> {
|
|
8
|
+
(): T;
|
|
11
9
|
dispose(): T;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
@@ -15,11 +13,13 @@ interface IDisposable<T = any> {
|
|
|
15
13
|
*/
|
|
16
14
|
type DisposableType<T = any> = Disposer<T> | IDisposable<T>;
|
|
17
15
|
/**
|
|
18
|
-
* A
|
|
19
|
-
* It can be called to dispose resources or call the `dispose` method to dispose resources.
|
|
16
|
+
* A function that can be called to dispose resources.
|
|
20
17
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
type Disposer<T = any> = () => T;
|
|
19
|
+
/**
|
|
20
|
+
* An object that has a `dispose` method to dispose resources.
|
|
21
|
+
*/
|
|
22
|
+
interface IDisposable<T = any> {
|
|
23
23
|
dispose(): T;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -35,13 +35,13 @@ interface DisposableDisposer<T = any> {
|
|
|
35
35
|
*/
|
|
36
36
|
interface DisposableStore extends DisposableDisposer {
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* @internal
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
_disposables_?: Set<DisposableType>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Flush and clear all of the {@link Disposer}s and {@link IDisposable}s in the store.
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
(): void;
|
|
45
45
|
/**
|
|
46
46
|
* Add a {@link DisposableType} to the store.
|
|
47
47
|
*
|
|
@@ -69,6 +69,23 @@ interface DisposableStore extends DisposableDisposer {
|
|
|
69
69
|
* @returns The same array of {@link DisposableType}s.
|
|
70
70
|
*/
|
|
71
71
|
add<T extends DisposableType>(disposables: T | T[]): T | T[];
|
|
72
|
+
/**
|
|
73
|
+
* Flush and clear all of the {@link Disposer}s and {@link IDisposable}s in the store.
|
|
74
|
+
*/
|
|
75
|
+
dispose(this: void): void;
|
|
76
|
+
/**
|
|
77
|
+
* Invoke the {@link DisposableType} and remove it from the store at the specific key.
|
|
78
|
+
*
|
|
79
|
+
* @param disposable The {@link DisposableType} to be flushed. Flush all if omitted.
|
|
80
|
+
*/
|
|
81
|
+
flush(disposable?: DisposableType): void;
|
|
82
|
+
/**
|
|
83
|
+
* Check if a {@link DisposableType} is in the store.
|
|
84
|
+
*
|
|
85
|
+
* @param disposable The {@link DisposableType}.
|
|
86
|
+
* @returns `true` if the {@link DisposableType} is in the store, otherwise `false`.
|
|
87
|
+
*/
|
|
88
|
+
has(disposable: DisposableType): boolean;
|
|
72
89
|
/**
|
|
73
90
|
* Invoke the executor function and add the returned {@link DisposableType} to the store.
|
|
74
91
|
*
|
|
@@ -83,10 +100,10 @@ interface DisposableStore extends DisposableDisposer {
|
|
|
83
100
|
*
|
|
84
101
|
* Do nothing if `null | undefined` is returned or the returned {@link DisposableType} is already in the store.
|
|
85
102
|
*
|
|
86
|
-
* @param executor A function that returns either a {@link DisposableType} or `null`.
|
|
87
|
-
* @returns The returned {@link DisposableType}, or `undefined` if the executor returns `null`.
|
|
103
|
+
* @param executor A function that returns either a {@link DisposableType} or `undefined | null`.
|
|
104
|
+
* @returns The returned {@link DisposableType}, or `undefined` if the executor returns `undefined | null`.
|
|
88
105
|
*/
|
|
89
|
-
make<T extends DisposableType>(executor: () =>
|
|
106
|
+
make<T extends DisposableType>(executor: () => null | T | undefined | void): T | void;
|
|
90
107
|
/**
|
|
91
108
|
* Invoke the executor function and add each {@link DisposableType} in the returned array to the store.
|
|
92
109
|
*
|
|
@@ -104,7 +121,7 @@ interface DisposableStore extends DisposableDisposer {
|
|
|
104
121
|
* @param executor A function that returns either an array of {@link DisposableType}s or `undefined | null`.
|
|
105
122
|
* @returns The returned array of {@link DisposableType}s, or `undefined` if the executor returns `undefined | null`.
|
|
106
123
|
*/
|
|
107
|
-
make<T extends DisposableType[]>(executor: () =>
|
|
124
|
+
make<T extends DisposableType[]>(executor: () => null | T | undefined | void): T | void;
|
|
108
125
|
/**
|
|
109
126
|
* Invoke the executor function and the returned {@link DisposableType}s to the store. Do nothing if `undefined | null` is returned.
|
|
110
127
|
*
|
|
@@ -113,31 +130,18 @@ interface DisposableStore extends DisposableDisposer {
|
|
|
113
130
|
* @param executor A function that returns either an array of {@link DisposableType}s or `undefined | null`.
|
|
114
131
|
* @returns The returned array of {@link DisposableType}s, or `undefined` if the executor returns `undefined | null`.
|
|
115
132
|
*/
|
|
116
|
-
make<T extends DisposableType>(executor: () => T | T[] |
|
|
117
|
-
/**
|
|
118
|
-
* Check if a {@link DisposableType} is in the store.
|
|
119
|
-
*
|
|
120
|
-
* @param disposable The {@link DisposableType}.
|
|
121
|
-
* @returns `true` if the {@link DisposableType} is in the store, otherwise `false`.
|
|
122
|
-
*/
|
|
123
|
-
has(disposable: DisposableType): boolean;
|
|
133
|
+
make<T extends DisposableType>(executor: () => null | T | T[] | undefined | void): T | T[] | void;
|
|
124
134
|
/**
|
|
125
135
|
* Remove the {@link DisposableType} from the store. Does not invoke the removed {@link DisposableType}.
|
|
126
136
|
*
|
|
127
|
-
* @param disposable The {@link DisposableType} to be
|
|
137
|
+
* @param disposable The {@link DisposableType} to be removed.
|
|
128
138
|
* @returns `true` if the {@link DisposableType} is found and removed, otherwise `false`.
|
|
129
139
|
*/
|
|
130
140
|
remove(disposable: DisposableType): boolean;
|
|
131
141
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* @param disposable The {@link DisposableType} to be flushed. Flush all if omitted.
|
|
135
|
-
*/
|
|
136
|
-
flush(disposable?: DisposableType): void;
|
|
137
|
-
/**
|
|
138
|
-
* Flush and clear all of the {@link Disposer}s and {@link IDisposable}s in the store.
|
|
142
|
+
* Get the number of {@link DisposableType}s in the store.
|
|
139
143
|
*/
|
|
140
|
-
|
|
144
|
+
size(): number;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
interface ILazyLoadInstance {
|
|
@@ -304,8 +308,6 @@ declare class Presentation implements IDisposable<void> {
|
|
|
304
308
|
private isEditable;
|
|
305
309
|
}
|
|
306
310
|
|
|
307
|
-
declare const __inline: string;
|
|
308
|
-
|
|
309
311
|
interface ScrollbarEventCallback {
|
|
310
312
|
onScrollbarDragStart?: () => void;
|
|
311
313
|
onScrollbarDragEnd?: () => void;
|
|
@@ -347,6 +349,10 @@ interface PresentationAppOptions {
|
|
|
347
349
|
/** debounceSync is used to set the presentation debounce sync, it will be used in the presentation, and the presentation will be debounce sync when the app is initialized */
|
|
348
350
|
debounceSync?: boolean;
|
|
349
351
|
scrollbarEventCallback?: ScrollbarEventCallback;
|
|
352
|
+
/** goToPageByClick is used to set the presentation go to page by click, it will be used in the presentation, and the presentation will be go to page by click when the app is initialized */
|
|
353
|
+
goToPageByClick?: boolean;
|
|
354
|
+
/** useClipView is used to set the presentation use clip view, it will be used in the presentation, and the presentation will be use clip view when the app is initialized */
|
|
355
|
+
useClipView?: boolean;
|
|
350
356
|
}
|
|
351
357
|
interface PresentationController {
|
|
352
358
|
readonly app: Presentation;
|
|
@@ -382,8 +388,14 @@ interface PresentationController {
|
|
|
382
388
|
getOriginScale: () => number;
|
|
383
389
|
/** get the view scale */
|
|
384
390
|
getScale: () => number;
|
|
391
|
+
/** get the page size */
|
|
392
|
+
getPageSize: () => {
|
|
393
|
+
width: number;
|
|
394
|
+
height: number;
|
|
395
|
+
};
|
|
396
|
+
/** screenshot the current page */
|
|
397
|
+
screenshotCurrentPageAsync: (context: CanvasRenderingContext2D, width?: number, height?: number) => Promise<void>;
|
|
385
398
|
}
|
|
386
|
-
|
|
387
399
|
declare const NetlessAppPresentation: NetlessApp<{}, {}, PresentationAppOptions, PresentationController>;
|
|
388
400
|
type RegisterFn = typeof WindowManager["register"];
|
|
389
401
|
interface InstallOptions {
|
|
@@ -409,4 +421,5 @@ declare const install: (register: RegisterFn, options?: InstallOptions) => Promi
|
|
|
409
421
|
|
|
410
422
|
declare const version: string;
|
|
411
423
|
|
|
412
|
-
export {
|
|
424
|
+
export { NetlessAppPresentation, Presentation, NetlessAppPresentation as default, install, version };
|
|
425
|
+
export type { InstallOptions, Logger, PresentationAppOptions, PresentationConfig, PresentationController, PresentationPage, RegisterFn };
|