@hyper-elements/react 0.0.1 → 0.3.1
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/GUIDE.md +195 -0
- package/LICENSE +21 -0
- package/README.md +388 -2
- package/REFERENCE.md +951 -0
- package/dist/builder.cjs +8545 -0
- package/dist/builder.cjs.map +1 -0
- package/dist/builder.d.cts +89 -0
- package/dist/builder.d.ts +89 -0
- package/dist/builder.js +8518 -0
- package/dist/builder.js.map +1 -0
- package/dist/image.cjs +472 -0
- package/dist/image.cjs.map +1 -0
- package/dist/image.d.cts +34 -0
- package/dist/image.d.ts +34 -0
- package/dist/image.js +466 -0
- package/dist/image.js.map +1 -0
- package/dist/inspect.cjs +3601 -0
- package/dist/inspect.cjs.map +1 -0
- package/dist/inspect.d.cts +472 -0
- package/dist/inspect.d.ts +472 -0
- package/dist/inspect.js +3572 -0
- package/dist/inspect.js.map +1 -0
- package/dist/pdf.cjs +1256 -0
- package/dist/pdf.cjs.map +1 -0
- package/dist/pdf.d.cts +29 -0
- package/dist/pdf.d.ts +29 -0
- package/dist/pdf.js +1254 -0
- package/dist/pdf.js.map +1 -0
- package/dist/primitives.cjs +5550 -0
- package/dist/primitives.cjs.map +1 -0
- package/dist/primitives.d.cts +7302 -0
- package/dist/primitives.d.ts +7302 -0
- package/dist/primitives.js +5476 -0
- package/dist/primitives.js.map +1 -0
- package/package.json +143 -7
- package/index.js +0 -3
package/dist/pdf.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Diagnostic } from '@hyper-elements/react';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PdfFont {
|
|
5
|
+
/** The family a template names in its fontFamily stacks ("Inter"). */
|
|
6
|
+
family: string;
|
|
7
|
+
/** The font file (TTF, OTF or WOFF; not WOFF2). */
|
|
8
|
+
src: Uint8Array | ArrayBuffer;
|
|
9
|
+
weight?: number;
|
|
10
|
+
style?: "normal" | "italic";
|
|
11
|
+
}
|
|
12
|
+
interface PdfOptions {
|
|
13
|
+
/** Font files, by the family the template names: PDF output loads none itself. */
|
|
14
|
+
fonts?: PdfFont[];
|
|
15
|
+
/** Image files (PNG or JPEG; an SVG's alt text is shown instead), by the URL the template gives: PDF output loads none itself. */
|
|
16
|
+
images?: Record<string, Uint8Array | ArrayBuffer>;
|
|
17
|
+
/** When the PDF says it was made (a fixed date by default, so a template makes the same file every time). */
|
|
18
|
+
date?: Date;
|
|
19
|
+
}
|
|
20
|
+
interface PdfResult {
|
|
21
|
+
/** The PDF file. */
|
|
22
|
+
pdf: Uint8Array;
|
|
23
|
+
/** Warnings and notes (errors are thrown). */
|
|
24
|
+
diagnostics: Diagnostic[];
|
|
25
|
+
}
|
|
26
|
+
/** A Document written as a PDF. Rejects with an `ElementsError` listing the problems if it has errors. */
|
|
27
|
+
declare function renderPdf(element: ReactElement, options?: PdfOptions): Promise<PdfResult>;
|
|
28
|
+
|
|
29
|
+
export { type PdfFont, type PdfOptions, type PdfResult, renderPdf };
|