@embedpdf/plugin-print 1.0.11 → 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 (38) hide show
  1. package/dist/index.cjs +2 -372
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +1 -78
  4. package/dist/index.js +25 -173
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/index.d.ts +7 -0
  7. package/dist/lib/manifest.d.ts +4 -0
  8. package/dist/lib/print-plugin.d.ts +15 -0
  9. package/dist/lib/types.d.ts +56 -0
  10. package/dist/preact/adapter.d.ts +5 -0
  11. package/dist/preact/core.d.ts +1 -0
  12. package/dist/preact/index.cjs +2 -223
  13. package/dist/preact/index.cjs.map +1 -1
  14. package/dist/preact/index.d.ts +1 -76
  15. package/dist/preact/index.js +17 -20
  16. package/dist/preact/index.js.map +1 -1
  17. package/dist/react/adapter.d.ts +4 -0
  18. package/dist/react/core.d.ts +1 -0
  19. package/dist/react/index.cjs +2 -0
  20. package/dist/react/index.cjs.map +1 -0
  21. package/dist/react/index.d.ts +1 -0
  22. package/dist/react/index.js +238 -0
  23. package/dist/react/index.js.map +1 -0
  24. package/dist/shared-preact/components/index.d.ts +1 -0
  25. package/dist/shared-preact/components/print.d.ts +15 -0
  26. package/dist/shared-preact/hooks/index.d.ts +2 -0
  27. package/dist/shared-preact/hooks/use-print-action.d.ts +8 -0
  28. package/dist/shared-preact/hooks/use-print.d.ts +11 -0
  29. package/dist/shared-preact/index.d.ts +2 -0
  30. package/dist/shared-react/components/index.d.ts +1 -0
  31. package/dist/shared-react/components/print.d.ts +15 -0
  32. package/dist/shared-react/hooks/index.d.ts +2 -0
  33. package/dist/shared-react/hooks/use-print-action.d.ts +8 -0
  34. package/dist/shared-react/hooks/use-print.d.ts +11 -0
  35. package/dist/shared-react/index.d.ts +2 -0
  36. package/package.json +23 -14
  37. package/dist/index.d.cts +0 -78
  38. package/dist/preact/index.d.cts +0 -76
@@ -0,0 +1,2 @@
1
+ export * from './use-print';
2
+ export * from './use-print-action';
@@ -0,0 +1,8 @@
1
+ import { PrintOptions } from '../../lib/index.ts';
2
+ export declare const usePrintAction: () => {
3
+ executePrint: (options: PrintOptions) => Promise<void>;
4
+ progress: import('../../lib/index.ts').PrintProgress | null;
5
+ isReady: boolean;
6
+ isPrinting: boolean;
7
+ parsePageRange: (rangeString: string) => import('../../lib/index.ts').ParsedPageRange;
8
+ };
@@ -0,0 +1,11 @@
1
+ import { PrintPlugin } from '../../lib/index.ts';
2
+ export declare const usePrintPlugin: () => {
3
+ plugin: PrintPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const usePrintCapability: () => {
8
+ provides: Readonly<import('../../lib/index.ts').PrintCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './components';
@@ -0,0 +1 @@
1
+ export * from './print';
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from '../../react/adapter.ts';
2
+ import { PrintOptions, PrintProgress, ParsedPageRange } from '../../lib/types';
3
+ interface PrintContextValue {
4
+ parsePageRange: (rangeString: string) => ParsedPageRange;
5
+ executePrint: (options: PrintOptions) => Promise<void>;
6
+ progress: PrintProgress | null;
7
+ isReady: boolean;
8
+ isPrinting: boolean;
9
+ }
10
+ interface PrintProviderProps {
11
+ children: ReactNode;
12
+ }
13
+ export declare function PrintProvider({ children }: PrintProviderProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function usePrintContext(): PrintContextValue;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './use-print';
2
+ export * from './use-print-action';
@@ -0,0 +1,8 @@
1
+ import { PrintOptions } from '../../lib/index.ts';
2
+ export declare const usePrintAction: () => {
3
+ executePrint: (options: PrintOptions) => Promise<void>;
4
+ progress: import('../../lib/index.ts').PrintProgress | null;
5
+ isReady: boolean;
6
+ isPrinting: boolean;
7
+ parsePageRange: (rangeString: string) => import('../../lib/index.ts').ParsedPageRange;
8
+ };
@@ -0,0 +1,11 @@
1
+ import { PrintPlugin } from '../../lib/index.ts';
2
+ export declare const usePrintPlugin: () => {
3
+ plugin: PrintPlugin | null;
4
+ isLoading: boolean;
5
+ ready: Promise<void>;
6
+ };
7
+ export declare const usePrintCapability: () => {
8
+ provides: Readonly<import('../../lib/index.ts').PrintCapability> | null;
9
+ isLoading: boolean;
10
+ ready: Promise<void>;
11
+ };
@@ -0,0 +1,2 @@
1
+ export * from './hooks';
2
+ export * from './components';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-print",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -15,21 +15,29 @@
15
15
  "types": "./dist/preact/index.d.ts",
16
16
  "import": "./dist/preact/index.js",
17
17
  "require": "./dist/preact/index.cjs"
18
+ },
19
+ "./react": {
20
+ "types": "./dist/react/index.d.ts",
21
+ "import": "./dist/react/index.js",
22
+ "require": "./dist/react/index.cjs"
18
23
  }
19
24
  },
20
- "dependencies": {},
25
+ "dependencies": {
26
+ "@embedpdf/models": "1.0.12"
27
+ },
21
28
  "devDependencies": {
22
29
  "@types/react": "^18.2.0",
23
- "tsup": "^8.0.0",
30
+ "@types/react-dom": "^18.2.0",
24
31
  "typescript": "^5.0.0",
25
- "@embedpdf/models": "1.0.11",
26
- "@embedpdf/plugin-render": "1.0.11"
32
+ "@embedpdf/build": "1.0.0",
33
+ "@embedpdf/plugin-render": "1.0.12"
27
34
  },
28
35
  "peerDependencies": {
29
- "react": ">=16.8.0",
30
- "react-dom": ">=16.8.0",
36
+ "react": ">=18.0.0",
37
+ "react-dom": ">=18.0.0",
31
38
  "preact": "^10.26.4",
32
- "@embedpdf/core": "1.0.11"
39
+ "@embedpdf/plugin-render": "1.0.12",
40
+ "@embedpdf/core": "1.0.12"
33
41
  },
34
42
  "files": [
35
43
  "dist",
@@ -48,11 +56,12 @@
48
56
  "access": "public"
49
57
  },
50
58
  "scripts": {
51
- "build": "PROJECT_CWD=$(pwd) pnpm -w p:build",
52
- "build:watch": "PROJECT_CWD=$(pwd) pnpm -w p:build:watch",
53
- "clean": "PROJECT_CWD=$(pwd) pnpm -w p:clean",
54
- "lint": "PROJECT_CWD=$(pwd) pnpm -w p:lint",
55
- "lint:fix": "PROJECT_CWD=$(pwd) pnpm -w p:lint:fix",
56
- "typecheck": "PROJECT_CWD=$(pwd) pnpm -w p:typecheck"
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"
57
66
  }
58
67
  }
package/dist/index.d.cts DELETED
@@ -1,78 +0,0 @@
1
- import { BasePluginConfig, BasePlugin, PluginRegistry, PluginManifest, PluginPackage } from '@embedpdf/core';
2
-
3
- interface PrintPluginConfig extends BasePluginConfig {
4
- defaultQuality?: PrintQuality;
5
- defaultIncludeAnnotations?: boolean;
6
- batchSize?: number;
7
- }
8
- declare enum PrintQuality {
9
- Normal = "normal",
10
- High = "high"
11
- }
12
- declare enum PageRangeType {
13
- Current = "current",
14
- All = "all",
15
- Custom = "custom"
16
- }
17
- interface PageRangeCurrent {
18
- type: PageRangeType.Current;
19
- currentPage: number;
20
- }
21
- interface PageRangeAll {
22
- type: PageRangeType.All;
23
- }
24
- interface PageRangeCustom {
25
- type: PageRangeType.Custom;
26
- pages: number[];
27
- }
28
- type PageRange = PageRangeCurrent | PageRangeAll | PageRangeCustom;
29
- interface PrintOptions {
30
- pageRange: PageRange;
31
- includeAnnotations: boolean;
32
- quality: PrintQuality;
33
- }
34
- interface PrintProgress {
35
- current: number;
36
- total: number;
37
- status: 'preparing' | 'rendering' | 'complete' | 'error';
38
- message?: string;
39
- }
40
- interface PrintData {
41
- blobs: Blob[];
42
- options: PrintOptions;
43
- totalPages: number;
44
- }
45
- interface ParsedPageRange {
46
- pages: number[];
47
- isValid: boolean;
48
- error?: string;
49
- }
50
- interface PrintPageResult {
51
- pageIndex: number;
52
- blob: Blob;
53
- }
54
- interface PrintCapability {
55
- preparePrint: (options: PrintOptions, onProgress?: (progress: PrintProgress) => void, onPageReady?: (result: PrintPageResult) => void) => Promise<void>;
56
- parsePageRange: (rangeString: string) => ParsedPageRange;
57
- }
58
-
59
- declare class PrintPlugin extends BasePlugin<PrintPluginConfig, PrintCapability> {
60
- static readonly id: "print";
61
- private readonly renderCapability;
62
- private readonly config;
63
- constructor(id: string, registry: PluginRegistry, config: PrintPluginConfig);
64
- initialize(_config: PrintPluginConfig): Promise<void>;
65
- protected buildCapability(): PrintCapability;
66
- private preparePrint;
67
- private renderPage;
68
- private getScaleFactor;
69
- private getPagesToPrint;
70
- private parsePageRange;
71
- }
72
-
73
- declare const PRINT_PLUGIN_ID = "print";
74
- declare const manifest: PluginManifest<PrintPluginConfig>;
75
-
76
- declare const PrintPluginPackage: PluginPackage<PrintPlugin, PrintPluginConfig>;
77
-
78
- export { PRINT_PLUGIN_ID, type PageRange, type PageRangeAll, type PageRangeCurrent, type PageRangeCustom, PageRangeType, type ParsedPageRange, type PrintCapability, type PrintData, type PrintOptions, type PrintPageResult, PrintPlugin, type PrintPluginConfig, PrintPluginPackage, type PrintProgress, PrintQuality, manifest };
@@ -1,76 +0,0 @@
1
- import * as _embedpdf_plugin_print from '@embedpdf/plugin-print';
2
- import { PrintPlugin } from '@embedpdf/plugin-print';
3
- import * as preact from 'preact';
4
- import { ComponentChildren } from 'preact';
5
-
6
- declare const usePrintPlugin: () => {
7
- plugin: PrintPlugin | null;
8
- isLoading: boolean;
9
- ready: Promise<void>;
10
- };
11
- declare const usePrintCapability: () => {
12
- provides: Readonly<_embedpdf_plugin_print.PrintCapability> | null;
13
- isLoading: boolean;
14
- ready: Promise<void>;
15
- };
16
-
17
- declare enum PrintQuality {
18
- Normal = "normal",
19
- High = "high"
20
- }
21
- declare enum PageRangeType {
22
- Current = "current",
23
- All = "all",
24
- Custom = "custom"
25
- }
26
- interface PageRangeCurrent {
27
- type: PageRangeType.Current;
28
- currentPage: number;
29
- }
30
- interface PageRangeAll {
31
- type: PageRangeType.All;
32
- }
33
- interface PageRangeCustom {
34
- type: PageRangeType.Custom;
35
- pages: number[];
36
- }
37
- type PageRange = PageRangeCurrent | PageRangeAll | PageRangeCustom;
38
- interface PrintOptions {
39
- pageRange: PageRange;
40
- includeAnnotations: boolean;
41
- quality: PrintQuality;
42
- }
43
- interface PrintProgress {
44
- current: number;
45
- total: number;
46
- status: 'preparing' | 'rendering' | 'complete' | 'error';
47
- message?: string;
48
- }
49
- interface ParsedPageRange {
50
- pages: number[];
51
- isValid: boolean;
52
- error?: string;
53
- }
54
-
55
- declare const usePrintAction: () => {
56
- executePrint: (options: PrintOptions) => Promise<void>;
57
- progress: PrintProgress | null;
58
- isReady: boolean;
59
- isPrinting: boolean;
60
- parsePageRange: (rangeString: string) => ParsedPageRange;
61
- };
62
-
63
- interface PrintContextValue {
64
- parsePageRange: (rangeString: string) => ParsedPageRange;
65
- executePrint: (options: PrintOptions) => Promise<void>;
66
- progress: PrintProgress | null;
67
- isReady: boolean;
68
- isPrinting: boolean;
69
- }
70
- interface PrintProviderProps {
71
- children: ComponentChildren;
72
- }
73
- declare function PrintProvider({ children }: PrintProviderProps): preact.JSX.Element;
74
- declare function usePrintContext(): PrintContextValue;
75
-
76
- export { PrintProvider, usePrintAction, usePrintCapability, usePrintContext, usePrintPlugin };