@embedpdf/plugin-thumbnail 1.0.11 → 1.0.13
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.cjs +2 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -54
- package/dist/index.js +9 -17
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/manifest.d.ts +4 -0
- package/dist/lib/thumbnail-plugin.d.ts +17 -0
- package/dist/lib/types.d.ts +30 -0
- package/dist/preact/adapter.d.ts +5 -0
- package/dist/preact/core.d.ts +1 -0
- package/dist/preact/index.cjs +2 -124
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.d.ts +1 -34
- package/dist/preact/index.js +18 -24
- package/dist/preact/index.js.map +1 -1
- package/dist/react/adapter.d.ts +2 -0
- package/dist/react/core.d.ts +1 -0
- package/dist/react/index.cjs +2 -124
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +1 -30
- package/dist/react/index.js +17 -24
- package/dist/react/index.js.map +1 -1
- package/dist/shared-preact/components/index.d.ts +2 -0
- package/dist/shared-preact/components/thumbnail-img.d.ts +8 -0
- package/dist/shared-preact/components/thumbnails-pane.d.ts +10 -0
- package/dist/shared-preact/hooks/index.d.ts +1 -0
- package/dist/shared-preact/hooks/use-thumbnail.d.ts +11 -0
- package/dist/shared-preact/index.d.ts +2 -0
- package/dist/shared-react/components/index.d.ts +2 -0
- package/dist/shared-react/components/thumbnail-img.d.ts +8 -0
- package/dist/shared-react/components/thumbnails-pane.d.ts +10 -0
- package/dist/shared-react/hooks/index.d.ts +1 -0
- package/dist/shared-react/hooks/use-thumbnail.d.ts +11 -0
- package/dist/shared-react/index.d.ts +2 -0
- package/package.json +14 -11
- package/dist/index.d.cts +0 -54
- package/dist/preact/index.d.cts +0 -34
- package/dist/react/index.d.cts +0 -30
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThumbnailPlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useThumbnailPlugin: () => {
|
|
3
|
+
plugin: ThumbnailPlugin | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useThumbnailCapability: () => {
|
|
8
|
+
provides: Readonly<import('../../lib/index.ts').ThumbnailCapability> | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
|
+
import { ThumbMeta } from '../../lib/index.ts';
|
|
3
|
+
type ThumbnailImgProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
meta: ThumbMeta;
|
|
6
|
+
};
|
|
7
|
+
export declare function ThumbImg({ meta, style, ...props }: ThumbnailImgProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes, CSSProperties, ReactNode } from '../../react/adapter.ts';
|
|
2
|
+
import { ThumbMeta } from '../../lib/index.ts';
|
|
3
|
+
type ThumbnailsProps = Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'children'> & {
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
children: (m: ThumbMeta) => ReactNode;
|
|
6
|
+
selectedPage?: number;
|
|
7
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
8
|
+
};
|
|
9
|
+
export declare function ThumbnailsPane({ style, selectedPage, scrollOptions, ...props }: ThumbnailsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-thumbnail';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThumbnailPlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useThumbnailPlugin: () => {
|
|
3
|
+
plugin: ThumbnailPlugin | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useThumbnailCapability: () => {
|
|
8
|
+
provides: Readonly<import('../../lib/index.ts').ThumbnailCapability> | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-thumbnail",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,19 +23,21 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@embedpdf/models": "1.0.
|
|
26
|
+
"@embedpdf/models": "1.0.13"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/react": "^18.2.0",
|
|
30
|
-
"tsup": "^8.0.0",
|
|
31
30
|
"typescript": "^5.0.0",
|
|
32
|
-
"@embedpdf/
|
|
31
|
+
"@embedpdf/build": "1.0.0",
|
|
32
|
+
"@embedpdf/core": "1.0.13",
|
|
33
|
+
"@embedpdf/plugin-render": "1.0.13"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"react": ">=16.8.0",
|
|
36
37
|
"react-dom": ">=16.8.0",
|
|
37
38
|
"preact": "^10.26.4",
|
|
38
|
-
"@embedpdf/core": "1.0.
|
|
39
|
+
"@embedpdf/core": "1.0.13",
|
|
40
|
+
"@embedpdf/plugin-render": "1.0.13"
|
|
39
41
|
},
|
|
40
42
|
"files": [
|
|
41
43
|
"dist",
|
|
@@ -54,11 +56,12 @@
|
|
|
54
56
|
"access": "public"
|
|
55
57
|
},
|
|
56
58
|
"scripts": {
|
|
57
|
-
"build": "
|
|
58
|
-
"build:
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
59
|
+
"build:base": "vite build --mode base",
|
|
60
|
+
"build:react": "vite build --mode react",
|
|
61
|
+
"build:preact": "vite build --mode preact",
|
|
62
|
+
"build": "pnpm run clean && concurrently -c auto -n base,react,preact \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\"",
|
|
63
|
+
"clean": "rimraf dist",
|
|
64
|
+
"lint": "eslint src --color",
|
|
65
|
+
"lint:fix": "eslint src --color --fix"
|
|
63
66
|
}
|
|
64
67
|
}
|
package/dist/index.d.cts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { BasePluginConfig, BasePlugin, PluginRegistry, PluginManifest, PluginPackage } from '@embedpdf/core';
|
|
2
|
-
import { Task, PdfErrorReason } from '@embedpdf/models';
|
|
3
|
-
|
|
4
|
-
interface ThumbnailPluginConfig extends BasePluginConfig {
|
|
5
|
-
width?: number;
|
|
6
|
-
gap?: number;
|
|
7
|
-
buffer?: number;
|
|
8
|
-
labelHeight?: number;
|
|
9
|
-
}
|
|
10
|
-
interface ThumbMeta {
|
|
11
|
-
pageIndex: number;
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
wrapperHeight: number;
|
|
15
|
-
top: number;
|
|
16
|
-
labelHeight: number;
|
|
17
|
-
}
|
|
18
|
-
interface WindowState {
|
|
19
|
-
start: number;
|
|
20
|
-
end: number;
|
|
21
|
-
items: ThumbMeta[];
|
|
22
|
-
totalHeight: number;
|
|
23
|
-
}
|
|
24
|
-
interface ThumbnailCapability {
|
|
25
|
-
/** called from UI on every scroll */
|
|
26
|
-
setViewport(offsetY: number, viewportH: number): void;
|
|
27
|
-
/** listen to window changes */
|
|
28
|
-
onWindow(cb: (w: WindowState) => void): () => void;
|
|
29
|
-
/** lazily render one thumb */
|
|
30
|
-
renderThumb(pageIdx: number, dpr: number): Task<Blob, PdfErrorReason>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare class ThumbnailPlugin extends BasePlugin<ThumbnailPluginConfig, ThumbnailCapability> {
|
|
34
|
-
private cfg;
|
|
35
|
-
static readonly id: "thumbnail";
|
|
36
|
-
private renderCapability;
|
|
37
|
-
private thumbs;
|
|
38
|
-
private window;
|
|
39
|
-
private readonly emitWindow;
|
|
40
|
-
private readonly taskCache;
|
|
41
|
-
constructor(id: string, registry: PluginRegistry, cfg: ThumbnailPluginConfig);
|
|
42
|
-
initialize(): Promise<void>;
|
|
43
|
-
private setWindowState;
|
|
44
|
-
protected buildCapability(): ThumbnailCapability;
|
|
45
|
-
private updateWindow;
|
|
46
|
-
private renderThumb;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare const THUMBNAIL_PLUGIN_ID = "thumbnail";
|
|
50
|
-
declare const manifest: PluginManifest<ThumbnailPluginConfig>;
|
|
51
|
-
|
|
52
|
-
declare const ThumbnailPluginPackage: PluginPackage<ThumbnailPlugin, ThumbnailPluginConfig>;
|
|
53
|
-
|
|
54
|
-
export { THUMBNAIL_PLUGIN_ID, type ThumbMeta, type ThumbnailCapability, ThumbnailPlugin, type ThumbnailPluginConfig, ThumbnailPluginPackage, type WindowState, manifest };
|
package/dist/preact/index.d.cts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as _embedpdf_plugin_thumbnail from '@embedpdf/plugin-thumbnail';
|
|
2
|
-
import { ThumbnailPlugin, ThumbMeta } from '@embedpdf/plugin-thumbnail';
|
|
3
|
-
import { JSX, ComponentChildren } from 'preact';
|
|
4
|
-
|
|
5
|
-
declare const useThumbnailPlugin: () => {
|
|
6
|
-
plugin: ThumbnailPlugin | null;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
ready: Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
declare const useThumbnailCapability: () => {
|
|
11
|
-
provides: Readonly<_embedpdf_plugin_thumbnail.ThumbnailCapability> | null;
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
ready: Promise<void>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** @jsxImportSource preact */
|
|
17
|
-
|
|
18
|
-
type ThumbnailsProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
19
|
-
style?: JSX.CSSProperties;
|
|
20
|
-
children: (m: ThumbMeta) => ComponentChildren;
|
|
21
|
-
selectedPage?: number;
|
|
22
|
-
scrollOptions?: ScrollIntoViewOptions;
|
|
23
|
-
};
|
|
24
|
-
declare function ThumbnailsPane({ style, selectedPage, scrollOptions, ...props }: ThumbnailsProps): JSX.Element;
|
|
25
|
-
|
|
26
|
-
/** @jsxImportSource preact */
|
|
27
|
-
|
|
28
|
-
type ThumbnailImgProps = Omit<JSX.HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
29
|
-
style?: JSX.CSSProperties;
|
|
30
|
-
meta: ThumbMeta;
|
|
31
|
-
};
|
|
32
|
-
declare function ThumbImg({ meta, style, ...props }: ThumbnailImgProps): JSX.Element | null;
|
|
33
|
-
|
|
34
|
-
export { ThumbImg, ThumbnailsPane, useThumbnailCapability, useThumbnailPlugin };
|
package/dist/react/index.d.cts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as _embedpdf_plugin_thumbnail from '@embedpdf/plugin-thumbnail';
|
|
2
|
-
import { ThumbnailPlugin, ThumbMeta } from '@embedpdf/plugin-thumbnail';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
declare const useThumbnailPlugin: () => {
|
|
6
|
-
plugin: ThumbnailPlugin | null;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
ready: Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
declare const useThumbnailCapability: () => {
|
|
11
|
-
provides: Readonly<_embedpdf_plugin_thumbnail.ThumbnailCapability> | null;
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
ready: Promise<void>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type ThumbnailsProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'children'> & {
|
|
17
|
-
style?: React.CSSProperties;
|
|
18
|
-
children: (m: ThumbMeta) => React.ReactNode;
|
|
19
|
-
selectedPage?: number;
|
|
20
|
-
scrollOptions?: ScrollIntoViewOptions;
|
|
21
|
-
};
|
|
22
|
-
declare function ThumbnailsPane({ style, selectedPage, scrollOptions, ...props }: ThumbnailsProps): react_jsx_runtime.JSX.Element;
|
|
23
|
-
|
|
24
|
-
type ThumbnailImgProps = Omit<React.HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
|
-
meta: ThumbMeta;
|
|
27
|
-
};
|
|
28
|
-
declare function ThumbImg({ meta, style, ...props }: ThumbnailImgProps): react_jsx_runtime.JSX.Element | null;
|
|
29
|
-
|
|
30
|
-
export { ThumbImg, ThumbnailsPane, useThumbnailCapability, useThumbnailPlugin };
|