@embedpdf/plugin-tiling 1.0.10 → 1.0.12

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.
Files changed (52) hide show
  1. package/dist/index.cjs +2 -269
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +1 -86
  4. package/dist/index.js +21 -35
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/actions.d.ts +18 -0
  7. package/dist/lib/index.d.ts +8 -0
  8. package/dist/lib/manifest.d.ts +4 -0
  9. package/dist/lib/reducer.d.ts +5 -0
  10. package/dist/lib/tiling-plugin.d.ts +17 -0
  11. package/dist/lib/types.d.ts +46 -0
  12. package/dist/lib/utils.d.ts +8 -0
  13. package/dist/preact/adapter.d.ts +5 -0
  14. package/dist/preact/core.d.ts +1 -0
  15. package/dist/preact/index.cjs +2 -128
  16. package/dist/preact/index.cjs.map +1 -1
  17. package/dist/preact/index.d.ts +1 -23
  18. package/dist/preact/index.js +11 -19
  19. package/dist/preact/index.js.map +1 -1
  20. package/dist/react/adapter.d.ts +2 -0
  21. package/dist/react/core.d.ts +1 -0
  22. package/dist/react/index.cjs +2 -128
  23. package/dist/react/index.cjs.map +1 -1
  24. package/dist/react/index.d.ts +1 -23
  25. package/dist/react/index.js +10 -19
  26. package/dist/react/index.js.map +1 -1
  27. package/dist/shared-preact/components/index.d.ts +1 -0
  28. package/dist/shared-preact/components/tile-img.d.ts +9 -0
  29. package/dist/shared-preact/components/tiling-layer.d.ts +8 -0
  30. package/dist/shared-preact/hooks/index.d.ts +1 -0
  31. package/dist/shared-preact/hooks/use-tiling.d.ts +11 -0
  32. package/dist/shared-preact/index.d.ts +2 -0
  33. package/dist/shared-react/components/index.d.ts +1 -0
  34. package/dist/shared-react/components/tile-img.d.ts +9 -0
  35. package/dist/shared-react/components/tiling-layer.d.ts +8 -0
  36. package/dist/shared-react/hooks/index.d.ts +1 -0
  37. package/dist/shared-react/hooks/use-tiling.d.ts +11 -0
  38. package/dist/shared-react/index.d.ts +2 -0
  39. package/dist/vue/components/index.d.ts +2 -0
  40. package/dist/vue/components/tile-img.vue.d.ts +13 -0
  41. package/dist/vue/components/tiling-layer.vue.d.ts +8 -0
  42. package/dist/vue/hooks/index.d.ts +1 -0
  43. package/dist/vue/hooks/use-tiling.d.ts +5 -0
  44. package/dist/vue/index.cjs +2 -0
  45. package/dist/vue/index.cjs.map +1 -0
  46. package/dist/vue/index.d.ts +2 -0
  47. package/dist/vue/index.js +118 -0
  48. package/dist/vue/index.js.map +1 -0
  49. package/package.json +25 -14
  50. package/dist/index.d.cts +0 -86
  51. package/dist/preact/index.d.cts +0 -23
  52. package/dist/react/index.d.cts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-tiling",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -20,25 +20,34 @@
20
20
  "types": "./dist/react/index.d.ts",
21
21
  "import": "./dist/react/index.js",
22
22
  "require": "./dist/react/index.cjs"
23
+ },
24
+ "./vue": {
25
+ "types": "./dist/vue/index.d.ts",
26
+ "import": "./dist/vue/index.js",
27
+ "require": "./dist/vue/index.cjs"
23
28
  }
24
29
  },
25
30
  "dependencies": {
26
- "@embedpdf/models": "1.0.10"
31
+ "@embedpdf/models": "1.0.12"
27
32
  },
28
33
  "devDependencies": {
29
34
  "@types/react": "^18.2.0",
30
- "tsup": "^8.0.0",
31
35
  "typescript": "^5.0.0",
32
- "@embedpdf/core": "1.0.10",
33
- "@embedpdf/plugin-render": "1.0.10",
34
- "@embedpdf/plugin-scroll": "1.0.10",
35
- "@embedpdf/plugin-viewport": "1.0.10"
36
+ "@embedpdf/core": "1.0.12",
37
+ "@embedpdf/plugin-render": "1.0.12",
38
+ "@embedpdf/build": "1.0.0",
39
+ "@embedpdf/plugin-scroll": "1.0.12",
40
+ "@embedpdf/plugin-viewport": "1.0.12"
36
41
  },
37
42
  "peerDependencies": {
38
43
  "react": ">=16.8.0",
39
44
  "react-dom": ">=16.8.0",
40
45
  "preact": "^10.26.4",
41
- "@embedpdf/core": "1.0.10"
46
+ "vue": ">=3.2.0",
47
+ "@embedpdf/core": "1.0.12",
48
+ "@embedpdf/plugin-scroll": "1.0.12",
49
+ "@embedpdf/plugin-render": "1.0.12",
50
+ "@embedpdf/plugin-viewport": "1.0.12"
42
51
  },
43
52
  "files": [
44
53
  "dist",
@@ -57,11 +66,13 @@
57
66
  "access": "public"
58
67
  },
59
68
  "scripts": {
60
- "build": "PROJECT_CWD=$(pwd) pnpm -w p:build",
61
- "build:watch": "PROJECT_CWD=$(pwd) pnpm -w p:build:watch",
62
- "clean": "PROJECT_CWD=$(pwd) pnpm -w p:clean",
63
- "lint": "PROJECT_CWD=$(pwd) pnpm -w p:lint",
64
- "lint:fix": "PROJECT_CWD=$(pwd) pnpm -w p:lint:fix",
65
- "typecheck": "PROJECT_CWD=$(pwd) pnpm -w p:typecheck"
69
+ "build:base": "vite build --mode base",
70
+ "build:react": "vite build --mode react",
71
+ "build:preact": "vite build --mode preact",
72
+ "build:vue": "vite build --mode vue",
73
+ "build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\"",
74
+ "clean": "rimraf dist",
75
+ "lint": "eslint src --color",
76
+ "lint:fix": "eslint src --color --fix"
66
77
  }
67
78
  }
package/dist/index.d.cts DELETED
@@ -1,86 +0,0 @@
1
- import { BasePluginConfig, EventHook, BasePlugin, PluginRegistry, StoreState, CoreState, PluginManifest, PluginPackage } from '@embedpdf/core';
2
- import { Rect, Task, PdfErrorReason, Rotation, PdfPageObject } from '@embedpdf/models';
3
- import { PageVisibilityMetrics } from '@embedpdf/plugin-scroll';
4
-
5
- interface TilingPluginConfig extends BasePluginConfig {
6
- tileSize: number;
7
- overlapPx: number;
8
- extraRings: number;
9
- }
10
- interface VisibleRect {
11
- pageX: number;
12
- pageY: number;
13
- visibleWidth: number;
14
- visibleHeight: number;
15
- }
16
- type TileStatus = 'queued' | 'rendering' | 'ready';
17
- interface Tile {
18
- status: TileStatus;
19
- screenRect: Rect;
20
- pageRect: Rect;
21
- isFallback: boolean;
22
- srcScale: number;
23
- col: number;
24
- row: number;
25
- id: string;
26
- }
27
- interface TilingState {
28
- visibleTiles: Record<number, Tile[]>;
29
- }
30
- interface TilingCapability {
31
- renderTile: (options: RenderTileOptions) => Task<Blob, PdfErrorReason>;
32
- onTileRendering: EventHook<Record<number, Tile[]>>;
33
- }
34
- interface CalculateTilesForPageOptions {
35
- tileSize: number;
36
- overlapPx: number;
37
- extraRings: number;
38
- scale: number;
39
- rotation: Rotation;
40
- page: PdfPageObject;
41
- metric: PageVisibilityMetrics;
42
- }
43
- interface RenderTileOptions {
44
- pageIndex: number;
45
- tile: Tile;
46
- dpr: number;
47
- }
48
-
49
- declare const UPDATE_VISIBLE_TILES = "UPDATE_VISIBLE_TILES";
50
- declare const MARK_TILE_STATUS = "MARK_TILE_STATUS";
51
- type UpdateVisibleTilesAction = {
52
- type: typeof UPDATE_VISIBLE_TILES;
53
- payload: Record<number, Tile[]>;
54
- };
55
- type MarkTileStatusAction = {
56
- type: typeof MARK_TILE_STATUS;
57
- payload: {
58
- pageIndex: number;
59
- tileId: string;
60
- status: TileStatus;
61
- };
62
- };
63
- type TilingAction = UpdateVisibleTilesAction | MarkTileStatusAction;
64
-
65
- declare class TilingPlugin extends BasePlugin<TilingPluginConfig, TilingCapability> {
66
- static readonly id: "tiling";
67
- private readonly tileRendering$;
68
- private config;
69
- private renderCapability;
70
- private scrollCapability;
71
- private viewportCapability;
72
- constructor(id: string, registry: PluginRegistry, config: TilingPluginConfig);
73
- initialize(): Promise<void>;
74
- protected onCoreStoreUpdated(oldState: StoreState<CoreState>, newState: StoreState<CoreState>): void;
75
- private calculateVisibleTiles;
76
- onStoreUpdated(_prevState: TilingState, newState: TilingState): void;
77
- protected buildCapability(): TilingCapability;
78
- private renderTile;
79
- }
80
-
81
- declare const TILING_PLUGIN_ID = "tiling";
82
- declare const manifest: PluginManifest<TilingPluginConfig>;
83
-
84
- declare const TilingPluginPackage: PluginPackage<TilingPlugin, TilingPluginConfig, TilingState, TilingAction>;
85
-
86
- export { type CalculateTilesForPageOptions, type RenderTileOptions, TILING_PLUGIN_ID, type Tile, type TileStatus, type TilingCapability, TilingPlugin, type TilingPluginConfig, TilingPluginPackage, type TilingState, type VisibleRect, manifest };
@@ -1,23 +0,0 @@
1
- import * as _embedpdf_plugin_tiling from '@embedpdf/plugin-tiling';
2
- import { TilingPlugin } from '@embedpdf/plugin-tiling';
3
- import { JSX } from 'preact';
4
-
5
- declare const useTilingPlugin: () => {
6
- plugin: TilingPlugin | null;
7
- isLoading: boolean;
8
- ready: Promise<void>;
9
- };
10
- declare const useTilingCapability: () => {
11
- provides: Readonly<_embedpdf_plugin_tiling.TilingCapability> | null;
12
- isLoading: boolean;
13
- ready: Promise<void>;
14
- };
15
-
16
- type TilingLayoutProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & {
17
- pageIndex: number;
18
- scale: number;
19
- style?: JSX.CSSProperties;
20
- };
21
- declare function TilingLayer({ pageIndex, scale, style, ...props }: TilingLayoutProps): JSX.Element;
22
-
23
- export { TilingLayer, useTilingCapability, useTilingPlugin };
@@ -1,23 +0,0 @@
1
- import * as _embedpdf_plugin_tiling from '@embedpdf/plugin-tiling';
2
- import { TilingPlugin } from '@embedpdf/plugin-tiling';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
-
5
- declare const useTilingPlugin: () => {
6
- plugin: TilingPlugin | null;
7
- isLoading: boolean;
8
- ready: Promise<void>;
9
- };
10
- declare const useTilingCapability: () => {
11
- provides: Readonly<_embedpdf_plugin_tiling.TilingCapability> | null;
12
- isLoading: boolean;
13
- ready: Promise<void>;
14
- };
15
-
16
- type TilingLayoutProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'style'> & {
17
- pageIndex: number;
18
- scale: number;
19
- style?: React.CSSProperties;
20
- };
21
- declare function TilingLayer({ pageIndex, scale, style, ...props }: TilingLayoutProps): react_jsx_runtime.JSX.Element;
22
-
23
- export { TilingLayer, useTilingCapability, useTilingPlugin };