@oxog/printkit 1.0.0 → 1.1.0

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/react.d.cts CHANGED
@@ -1,92 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, RefObject, CSSProperties, ButtonHTMLAttributes } from 'react';
3
-
4
- type PageSizeName = 'A3' | 'A4' | 'A5' | 'Letter' | 'Legal' | 'Tabloid';
5
- interface CustomSize {
6
- width: number | string;
7
- height: number | string;
8
- }
9
- type PageSize = PageSizeName | CustomSize;
10
- type Orientation = 'portrait' | 'landscape';
11
- interface MarginOptions {
12
- top?: number | string;
13
- right?: number | string;
14
- bottom?: number | string;
15
- left?: number | string;
16
- }
17
- interface PageInfo {
18
- pageNumber: number;
19
- totalPages: number;
20
- title: string;
21
- date: Date;
22
- }
23
- type HeaderFooterFn = (info: PageInfo) => string;
24
- interface PrintOptions {
25
- title?: string;
26
- pageSize?: PageSize;
27
- orientation?: Orientation;
28
- margin?: number | MarginOptions;
29
- header?: string | HeaderFooterFn;
30
- footer?: string | HeaderFooterFn;
31
- styles?: string | string[];
32
- styleSheets?: string[];
33
- copyStyles?: boolean;
34
- pageBreakBefore?: string;
35
- pageBreakAfter?: string;
36
- avoidBreakInside?: string;
37
- removeAfterPrint?: boolean;
38
- printBackground?: boolean;
39
- onBeforePrint?: () => void | Promise<void>;
40
- onAfterPrint?: () => void;
41
- onError?: (error: PrintError$1) => void;
42
- }
43
- type PrintTarget = HTMLElement | string | HTMLElement[] | string[];
44
- interface PreviewOptions extends PrintOptions {
45
- modal?: ModalOptions;
46
- toolbar?: ToolbarOptions;
47
- onPrint?: () => void;
48
- onDownload?: () => void;
49
- onClose?: () => void;
50
- }
51
- interface ModalOptions {
52
- width?: string | number;
53
- height?: string | number;
54
- showToolbar?: boolean;
55
- showPageNumbers?: boolean;
56
- zoom?: number;
57
- className?: string;
58
- }
59
- interface ToolbarOptions {
60
- print?: boolean;
61
- download?: boolean;
62
- zoom?: boolean;
63
- navigation?: boolean;
64
- close?: boolean;
65
- }
66
- interface PDFOptions extends PrintOptions {
67
- quality?: number;
68
- scale?: number;
69
- metadata?: PDFMetadata;
70
- onProgress?: (progress: number) => void;
71
- }
72
- interface PDFMetadata {
73
- title?: string;
74
- author?: string;
75
- subject?: string;
76
- keywords?: string[];
77
- creator?: string;
78
- creationDate?: Date;
79
- }
80
- interface TableData {
81
- headers: string[];
82
- rows: (string | number)[][];
83
- caption?: string;
84
- }
85
- type PrintErrorCode = 'PRINT_NOT_SUPPORTED' | 'ELEMENT_NOT_FOUND' | 'IFRAME_LOAD_FAILED' | 'PDF_EXPORT_FAILED' | 'STYLE_LOAD_FAILED' | 'CANCELLED' | 'UNKNOWN';
86
- interface PrintError$1 extends Error {
87
- code: PrintErrorCode;
88
- target?: PrintTarget | undefined;
89
- }
3
+ import { P as PrintOptions, b as PrintTarget, u as PrintError, c as PreviewOptions, z as PDFOptions } from './errors-B6q-4bX_.cjs';
4
+ export { A as AVOID_BREAK_CLASS, t as BREAK_AFTER_CLASS, B as BREAK_BEFORE_CLASS, O as Orientation, r as PRINT_HIDE_CLASS, s as PRINT_ONLY_CLASS, g as PageSize, K as TableData, w as isPrintError } from './errors-B6q-4bX_.cjs';
90
5
 
91
6
  /**
92
7
  * PrintProvider props
@@ -122,15 +37,6 @@ declare const PrintContext: React.Context<PrintContextValue | null>;
122
37
  */
123
38
  declare function usePrintContext(): PrintContextValue;
124
39
 
125
- /**
126
- * Custom error class for print operations
127
- */
128
- declare class PrintError extends Error implements PrintError$1 {
129
- readonly code: PrintErrorCode;
130
- readonly target: PrintTarget | undefined;
131
- constructor(code: PrintErrorCode, message: string, target?: PrintTarget | undefined);
132
- }
133
-
134
40
  /**
135
41
  * usePrint hook result
136
42
  */
@@ -470,26 +376,4 @@ interface NoPrintProps {
470
376
  */
471
377
  declare function NoPrint({ children, className, style, as: Component, }: NoPrintProps): React__default.JSX.Element;
472
378
 
473
- /**
474
- * CSS class to hide elements when printing
475
- */
476
- declare const PRINT_HIDE_CLASS = "print-hide";
477
- /**
478
- * CSS class to show elements only when printing
479
- */
480
- declare const PRINT_ONLY_CLASS = "print-only";
481
-
482
- /**
483
- * CSS class for page break before
484
- */
485
- declare const BREAK_BEFORE_CLASS = "print-break-before";
486
- /**
487
- * CSS class for page break after
488
- */
489
- declare const BREAK_AFTER_CLASS = "print-break-after";
490
- /**
491
- * CSS class to avoid break inside
492
- */
493
- declare const AVOID_BREAK_CLASS = "print-avoid-break";
494
-
495
- export { AVOID_BREAK_CLASS, BREAK_AFTER_CLASS, BREAK_BEFORE_CLASS, NoPrint, type NoPrintProps, type Orientation, type PDFOptions, PRINT_HIDE_CLASS, PRINT_ONLY_CLASS, PageBreak, type PageBreakProps, type PageSize, type PreviewOptions, PrintButton, type PrintButtonProps, type PrintButtonRenderProps, PrintContext, type PrintContextValue, PrintOnly, type PrintOnlyProps, type PrintOptions, PrintPreview, type PrintPreviewProps, PrintProvider, type PrintProviderProps, type PrintTarget, Printable, type PrintableProps, type PrintableRef, type TableData, type UsePDFResult, type UsePrintPreviewResult, type UsePrintResult, usePDF, usePrint, usePrintContext, usePrintPreview };
379
+ export { NoPrint, type NoPrintProps, PDFOptions, PageBreak, type PageBreakProps, PreviewOptions, PrintButton, type PrintButtonProps, type PrintButtonRenderProps, PrintContext, type PrintContextValue, PrintError, PrintOnly, type PrintOnlyProps, PrintOptions, PrintPreview, type PrintPreviewProps, PrintProvider, type PrintProviderProps, PrintTarget, Printable, type PrintableProps, type PrintableRef, type UsePDFResult, type UsePrintPreviewResult, type UsePrintResult, usePDF, usePrint, usePrintContext, usePrintPreview };
package/dist/react.d.ts CHANGED
@@ -1,92 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, RefObject, CSSProperties, ButtonHTMLAttributes } from 'react';
3
-
4
- type PageSizeName = 'A3' | 'A4' | 'A5' | 'Letter' | 'Legal' | 'Tabloid';
5
- interface CustomSize {
6
- width: number | string;
7
- height: number | string;
8
- }
9
- type PageSize = PageSizeName | CustomSize;
10
- type Orientation = 'portrait' | 'landscape';
11
- interface MarginOptions {
12
- top?: number | string;
13
- right?: number | string;
14
- bottom?: number | string;
15
- left?: number | string;
16
- }
17
- interface PageInfo {
18
- pageNumber: number;
19
- totalPages: number;
20
- title: string;
21
- date: Date;
22
- }
23
- type HeaderFooterFn = (info: PageInfo) => string;
24
- interface PrintOptions {
25
- title?: string;
26
- pageSize?: PageSize;
27
- orientation?: Orientation;
28
- margin?: number | MarginOptions;
29
- header?: string | HeaderFooterFn;
30
- footer?: string | HeaderFooterFn;
31
- styles?: string | string[];
32
- styleSheets?: string[];
33
- copyStyles?: boolean;
34
- pageBreakBefore?: string;
35
- pageBreakAfter?: string;
36
- avoidBreakInside?: string;
37
- removeAfterPrint?: boolean;
38
- printBackground?: boolean;
39
- onBeforePrint?: () => void | Promise<void>;
40
- onAfterPrint?: () => void;
41
- onError?: (error: PrintError$1) => void;
42
- }
43
- type PrintTarget = HTMLElement | string | HTMLElement[] | string[];
44
- interface PreviewOptions extends PrintOptions {
45
- modal?: ModalOptions;
46
- toolbar?: ToolbarOptions;
47
- onPrint?: () => void;
48
- onDownload?: () => void;
49
- onClose?: () => void;
50
- }
51
- interface ModalOptions {
52
- width?: string | number;
53
- height?: string | number;
54
- showToolbar?: boolean;
55
- showPageNumbers?: boolean;
56
- zoom?: number;
57
- className?: string;
58
- }
59
- interface ToolbarOptions {
60
- print?: boolean;
61
- download?: boolean;
62
- zoom?: boolean;
63
- navigation?: boolean;
64
- close?: boolean;
65
- }
66
- interface PDFOptions extends PrintOptions {
67
- quality?: number;
68
- scale?: number;
69
- metadata?: PDFMetadata;
70
- onProgress?: (progress: number) => void;
71
- }
72
- interface PDFMetadata {
73
- title?: string;
74
- author?: string;
75
- subject?: string;
76
- keywords?: string[];
77
- creator?: string;
78
- creationDate?: Date;
79
- }
80
- interface TableData {
81
- headers: string[];
82
- rows: (string | number)[][];
83
- caption?: string;
84
- }
85
- type PrintErrorCode = 'PRINT_NOT_SUPPORTED' | 'ELEMENT_NOT_FOUND' | 'IFRAME_LOAD_FAILED' | 'PDF_EXPORT_FAILED' | 'STYLE_LOAD_FAILED' | 'CANCELLED' | 'UNKNOWN';
86
- interface PrintError$1 extends Error {
87
- code: PrintErrorCode;
88
- target?: PrintTarget | undefined;
89
- }
3
+ import { P as PrintOptions, b as PrintTarget, u as PrintError, c as PreviewOptions, z as PDFOptions } from './errors-B6q-4bX_.js';
4
+ export { A as AVOID_BREAK_CLASS, t as BREAK_AFTER_CLASS, B as BREAK_BEFORE_CLASS, O as Orientation, r as PRINT_HIDE_CLASS, s as PRINT_ONLY_CLASS, g as PageSize, K as TableData, w as isPrintError } from './errors-B6q-4bX_.js';
90
5
 
91
6
  /**
92
7
  * PrintProvider props
@@ -122,15 +37,6 @@ declare const PrintContext: React.Context<PrintContextValue | null>;
122
37
  */
123
38
  declare function usePrintContext(): PrintContextValue;
124
39
 
125
- /**
126
- * Custom error class for print operations
127
- */
128
- declare class PrintError extends Error implements PrintError$1 {
129
- readonly code: PrintErrorCode;
130
- readonly target: PrintTarget | undefined;
131
- constructor(code: PrintErrorCode, message: string, target?: PrintTarget | undefined);
132
- }
133
-
134
40
  /**
135
41
  * usePrint hook result
136
42
  */
@@ -470,26 +376,4 @@ interface NoPrintProps {
470
376
  */
471
377
  declare function NoPrint({ children, className, style, as: Component, }: NoPrintProps): React__default.JSX.Element;
472
378
 
473
- /**
474
- * CSS class to hide elements when printing
475
- */
476
- declare const PRINT_HIDE_CLASS = "print-hide";
477
- /**
478
- * CSS class to show elements only when printing
479
- */
480
- declare const PRINT_ONLY_CLASS = "print-only";
481
-
482
- /**
483
- * CSS class for page break before
484
- */
485
- declare const BREAK_BEFORE_CLASS = "print-break-before";
486
- /**
487
- * CSS class for page break after
488
- */
489
- declare const BREAK_AFTER_CLASS = "print-break-after";
490
- /**
491
- * CSS class to avoid break inside
492
- */
493
- declare const AVOID_BREAK_CLASS = "print-avoid-break";
494
-
495
- export { AVOID_BREAK_CLASS, BREAK_AFTER_CLASS, BREAK_BEFORE_CLASS, NoPrint, type NoPrintProps, type Orientation, type PDFOptions, PRINT_HIDE_CLASS, PRINT_ONLY_CLASS, PageBreak, type PageBreakProps, type PageSize, type PreviewOptions, PrintButton, type PrintButtonProps, type PrintButtonRenderProps, PrintContext, type PrintContextValue, PrintOnly, type PrintOnlyProps, type PrintOptions, PrintPreview, type PrintPreviewProps, PrintProvider, type PrintProviderProps, type PrintTarget, Printable, type PrintableProps, type PrintableRef, type TableData, type UsePDFResult, type UsePrintPreviewResult, type UsePrintResult, usePDF, usePrint, usePrintContext, usePrintPreview };
379
+ export { NoPrint, type NoPrintProps, PDFOptions, PageBreak, type PageBreakProps, PreviewOptions, PrintButton, type PrintButtonProps, type PrintButtonRenderProps, PrintContext, type PrintContextValue, PrintError, PrintOnly, type PrintOnlyProps, PrintOptions, PrintPreview, type PrintPreviewProps, PrintProvider, type PrintProviderProps, PrintTarget, Printable, type PrintableProps, type PrintableRef, type UsePDFResult, type UsePrintPreviewResult, type UsePrintResult, usePDF, usePrint, usePrintContext, usePrintPreview };