@formepdf/svelte 0.11.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/README.md +101 -0
- package/dist/components/AreaChart.svelte +8 -0
- package/dist/components/AreaChart.svelte.d.ts +4 -0
- package/dist/components/BarChart.svelte +8 -0
- package/dist/components/BarChart.svelte.d.ts +4 -0
- package/dist/components/Barcode.svelte +23 -0
- package/dist/components/Barcode.svelte.d.ts +18 -0
- package/dist/components/Canvas.svelte +28 -0
- package/dist/components/Canvas.svelte.d.ts +21 -0
- package/dist/components/Cell.svelte +16 -0
- package/dist/components/Cell.svelte.d.ts +11 -0
- package/dist/components/Checkbox.svelte +22 -0
- package/dist/components/Checkbox.svelte.d.ts +17 -0
- package/dist/components/Code.svelte +14 -0
- package/dist/components/Code.svelte.d.ts +9 -0
- package/dist/components/Document.svelte +33 -0
- package/dist/components/Document.svelte.d.ts +28 -0
- package/dist/components/DotPlot.svelte +8 -0
- package/dist/components/DotPlot.svelte.d.ts +4 -0
- package/dist/components/Dropdown.svelte +26 -0
- package/dist/components/Dropdown.svelte.d.ts +21 -0
- package/dist/components/Em.svelte +14 -0
- package/dist/components/Em.svelte.d.ts +9 -0
- package/dist/components/Fixed.svelte +18 -0
- package/dist/components/Fixed.svelte.d.ts +13 -0
- package/dist/components/H1.svelte +16 -0
- package/dist/components/H1.svelte.d.ts +11 -0
- package/dist/components/H2.svelte +16 -0
- package/dist/components/H2.svelte.d.ts +11 -0
- package/dist/components/H3.svelte +16 -0
- package/dist/components/H3.svelte.d.ts +11 -0
- package/dist/components/H4.svelte +16 -0
- package/dist/components/H4.svelte.d.ts +11 -0
- package/dist/components/H5.svelte +16 -0
- package/dist/components/H5.svelte.d.ts +11 -0
- package/dist/components/H6.svelte +16 -0
- package/dist/components/H6.svelte.d.ts +11 -0
- package/dist/components/Image.svelte +25 -0
- package/dist/components/Image.svelte.d.ts +20 -0
- package/dist/components/LineChart.svelte +8 -0
- package/dist/components/LineChart.svelte.d.ts +4 -0
- package/dist/components/Link.svelte +15 -0
- package/dist/components/Link.svelte.d.ts +10 -0
- package/dist/components/ListItem.svelte +14 -0
- package/dist/components/ListItem.svelte.d.ts +9 -0
- package/dist/components/OrderedList.svelte +19 -0
- package/dist/components/OrderedList.svelte.d.ts +14 -0
- package/dist/components/Page.svelte +26 -0
- package/dist/components/Page.svelte.d.ts +24 -0
- package/dist/components/PageBreak.svelte +6 -0
- package/dist/components/PageBreak.svelte.d.ts +18 -0
- package/dist/components/PieChart.svelte +8 -0
- package/dist/components/PieChart.svelte.d.ts +4 -0
- package/dist/components/QrCode.svelte +19 -0
- package/dist/components/QrCode.svelte.d.ts +14 -0
- package/dist/components/RadioButton.svelte +24 -0
- package/dist/components/RadioButton.svelte.d.ts +19 -0
- package/dist/components/Row.svelte +17 -0
- package/dist/components/Row.svelte.d.ts +12 -0
- package/dist/components/Strong.svelte +14 -0
- package/dist/components/Strong.svelte.d.ts +9 -0
- package/dist/components/Svg.svelte +26 -0
- package/dist/components/Svg.svelte.d.ts +21 -0
- package/dist/components/Table.svelte +18 -0
- package/dist/components/Table.svelte.d.ts +13 -0
- package/dist/components/Text.svelte +16 -0
- package/dist/components/Text.svelte.d.ts +11 -0
- package/dist/components/TextField.svelte +32 -0
- package/dist/components/TextField.svelte.d.ts +27 -0
- package/dist/components/UnorderedList.svelte +17 -0
- package/dist/components/UnorderedList.svelte.d.ts +12 -0
- package/dist/components/View.svelte +17 -0
- package/dist/components/View.svelte.d.ts +12 -0
- package/dist/components/Watermark.svelte +23 -0
- package/dist/components/Watermark.svelte.d.ts +18 -0
- package/dist/constants.d.ts +20 -0
- package/dist/constants.js +20 -0
- package/dist/encode.d.ts +27 -0
- package/dist/encode.js +93 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +50 -0
- package/dist/parser.d.ts +30 -0
- package/dist/parser.js +756 -0
- package/dist/preview/index.d.ts +87 -0
- package/dist/preview/index.js +256 -0
- package/dist/preview/preview-html.generated.d.ts +5 -0
- package/dist/preview/preview-html.generated.js +5 -0
- package/dist/render-document.d.ts +36 -0
- package/dist/render-document.js +47 -0
- package/dist/serialize.d.ts +36 -0
- package/dist/serialize.js +39 -0
- package/dist/stylesheet.d.ts +4 -0
- package/dist/stylesheet.js +5 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @formepdf/svelte
|
|
2
|
+
|
|
3
|
+
Svelte components for [Forme](https://github.com/formepdf/forme) PDF generation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @formepdf/svelte @formepdf/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Svelte 5 (`^5.30.0`) as a peer dependency.
|
|
12
|
+
`@formepdf/core` is an optional peer: it is only needed to render PDF bytes locally (`renderDocument`, the preview helper).
|
|
13
|
+
Serializing for the hosted API works without it.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Templates are ordinary `.svelte` files - `{#each}`, `{#if}`, snippets, and text interpolation all work.
|
|
18
|
+
`Invoice.svelte`:
|
|
19
|
+
|
|
20
|
+
```svelte
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { Document, Page, Text } from '@formepdf/svelte';
|
|
23
|
+
|
|
24
|
+
let { name = 'World' }: { name?: string } = $props();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Document>
|
|
28
|
+
<Page size="Letter" margin={54}>
|
|
29
|
+
<Text style={{ fontSize: 24, fontWeight: 700, marginBottom: 12 }}>Hello {name}</Text>
|
|
30
|
+
<Text style={{ fontSize: 10, lineHeight: 1.6 }}>Page breaks that actually work.</Text>
|
|
31
|
+
</Page>
|
|
32
|
+
</Document>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Render it in a SvelteKit endpoint:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { renderDocument } from '@formepdf/svelte';
|
|
39
|
+
import Invoice from '$lib/Invoice.svelte';
|
|
40
|
+
|
|
41
|
+
export async function GET() {
|
|
42
|
+
const pdf = await renderDocument(Invoice, { props: { name: 'Forme' } });
|
|
43
|
+
return new Response(pdf, { headers: { 'Content-Type': 'application/pdf' } });
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Components
|
|
48
|
+
|
|
49
|
+
The same components with the same props as `@formepdf/react`.
|
|
50
|
+
|
|
51
|
+
### Layout
|
|
52
|
+
- `Document` - Root container (fonts, metadata, tagged PDF, PDF/A, certification)
|
|
53
|
+
- `Page` - A page with size, margins, and orientation
|
|
54
|
+
- `View` - Flex container (like div)
|
|
55
|
+
- `Text` - Text content with font styling
|
|
56
|
+
- `H1`-`H6` - Semantic headings with per-level default styling and tagged-PDF roles
|
|
57
|
+
- `Strong`, `Em`, `Code`, `Link` - Inline formatting inside `Text` and headings
|
|
58
|
+
- `OrderedList`, `UnorderedList`, `ListItem` - Numbered and bulleted lists
|
|
59
|
+
- `Image` - JPEG, PNG, and WebP images
|
|
60
|
+
- `Fixed` - Fixed headers and footers
|
|
61
|
+
- `PageBreak` - Explicit page break
|
|
62
|
+
|
|
63
|
+
### Tables
|
|
64
|
+
- `Table`, `Row`, `Cell` - Tables with automatic header repetition across pages
|
|
65
|
+
|
|
66
|
+
### Graphics
|
|
67
|
+
- `Svg` - SVG rendering via `content` string
|
|
68
|
+
- `QrCode` - Vector QR codes
|
|
69
|
+
- `Barcode` - 1D barcodes (Code 128, Code 39, EAN-13, EAN-8, Codabar)
|
|
70
|
+
- `Canvas` - Arbitrary vector drawing via callback API (the `draw` callback runs during serialization and must be synchronous and pure)
|
|
71
|
+
- `Watermark` - Rotated text behind page content
|
|
72
|
+
|
|
73
|
+
### Charts
|
|
74
|
+
- `BarChart` - Vertical bar charts with grouped series
|
|
75
|
+
- `LineChart` - Line charts with multiple series
|
|
76
|
+
- `PieChart` - Pie and donut charts
|
|
77
|
+
- `AreaChart` - Filled area charts
|
|
78
|
+
- `DotPlot` - Dot plot with grouped data points
|
|
79
|
+
|
|
80
|
+
### Form Fields
|
|
81
|
+
- `TextField` - Text input field
|
|
82
|
+
- `Checkbox` - Checkbox with label
|
|
83
|
+
- `Dropdown` - Select dropdown with options
|
|
84
|
+
- `RadioButton` - Radio button with group support
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
- `serialize(Template, { props })` - template to Forme document object
|
|
89
|
+
- `render(Template, { props })` - template to Forme JSON string
|
|
90
|
+
- `renderToObject(Template, { props })` - alias of `serialize` mirroring the react API
|
|
91
|
+
- `renderDocument(Template, { props, ...renderOptions })` - template to PDF bytes (requires `@formepdf/core`); forwards core render options like `embedData` and `flattenForms`
|
|
92
|
+
- `renderDocumentWithLayout(Template, options)` - PDF bytes plus layout info for overlays
|
|
93
|
+
- `formePreview(Template, options)` (from `@formepdf/svelte/preview`) - GET handler for a SvelteKit catch-all route serving the live preview UI
|
|
94
|
+
- `Font.register()`, `StyleSheet.create()` - identical to the react adapter
|
|
95
|
+
- `PAGE_NUMBER`, `TOTAL_PAGES` - page-number placeholder constants (`{{pageNumber}}` cannot be typed literally in Svelte markup)
|
|
96
|
+
|
|
97
|
+
Compiled templates (`forme build --template`) are TSX-only today.
|
|
98
|
+
|
|
99
|
+
## Docs
|
|
100
|
+
|
|
101
|
+
Full documentation at [docs.formepdf.com](https://docs.formepdf.com)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BarcodeFormat, Style } from '@formepdf/shared';
|
|
3
|
+
import { encodeProps } from '../encode.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** The data to encode. */
|
|
7
|
+
data: string;
|
|
8
|
+
/** Barcode format: "Code128" (default), "Code39", "EAN13", "EAN8",
|
|
9
|
+
* "Codabar". */
|
|
10
|
+
format?: BarcodeFormat;
|
|
11
|
+
/** Width in points. Defaults to available width. */
|
|
12
|
+
width?: number;
|
|
13
|
+
/** Height in points. Default: 60. */
|
|
14
|
+
height?: number;
|
|
15
|
+
/** Bar color. Default: black. */
|
|
16
|
+
color?: string;
|
|
17
|
+
style?: Style;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let rest: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<forme-barcode props={encodeProps('Barcode', rest)}></forme-barcode>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BarcodeFormat, Style } from '@formepdf/shared';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** The data to encode. */
|
|
4
|
+
data: string;
|
|
5
|
+
/** Barcode format: "Code128" (default), "Code39", "EAN13", "EAN8",
|
|
6
|
+
* "Codabar". */
|
|
7
|
+
format?: BarcodeFormat;
|
|
8
|
+
/** Width in points. Defaults to available width. */
|
|
9
|
+
width?: number;
|
|
10
|
+
/** Height in points. Default: 60. */
|
|
11
|
+
height?: number;
|
|
12
|
+
/** Bar color. Default: black. */
|
|
13
|
+
color?: string;
|
|
14
|
+
style?: Style;
|
|
15
|
+
}
|
|
16
|
+
declare const Barcode: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type Barcode = ReturnType<typeof Barcode>;
|
|
18
|
+
export default Barcode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CanvasContext, Style } from '@formepdf/shared';
|
|
3
|
+
import { recordCanvasOperations } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Canvas width in points. */
|
|
8
|
+
width: number;
|
|
9
|
+
/** Canvas height in points. */
|
|
10
|
+
height: number;
|
|
11
|
+
/**
|
|
12
|
+
* Drawing callback that receives a recording `CanvasContext`.
|
|
13
|
+
*
|
|
14
|
+
* The callback runs once, synchronously, during server-side
|
|
15
|
+
* serialization - not at PDF render time. It must be pure:
|
|
16
|
+
* synchronous, no side effects, and no reliance on browser or
|
|
17
|
+
* runtime APIs. The recorded operations are serialized to JSON
|
|
18
|
+
* and rendered as native PDF vector commands.
|
|
19
|
+
*/
|
|
20
|
+
draw: (ctx: CanvasContext) => void;
|
|
21
|
+
style?: Style;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let { draw, ...rest }: Props = $props();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<forme-canvas props={encodeProps('Canvas', { ...rest, operations: recordCanvasOperations(draw) })}
|
|
28
|
+
></forme-canvas>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CanvasContext, Style } from '@formepdf/shared';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Canvas width in points. */
|
|
4
|
+
width: number;
|
|
5
|
+
/** Canvas height in points. */
|
|
6
|
+
height: number;
|
|
7
|
+
/**
|
|
8
|
+
* Drawing callback that receives a recording `CanvasContext`.
|
|
9
|
+
*
|
|
10
|
+
* The callback runs once, synchronously, during server-side
|
|
11
|
+
* serialization - not at PDF render time. It must be pure:
|
|
12
|
+
* synchronous, no side effects, and no reliance on browser or
|
|
13
|
+
* runtime APIs. The recorded operations are serialized to JSON
|
|
14
|
+
* and rendered as native PDF vector commands.
|
|
15
|
+
*/
|
|
16
|
+
draw: (ctx: CanvasContext) => void;
|
|
17
|
+
style?: Style;
|
|
18
|
+
}
|
|
19
|
+
declare const Canvas: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type Canvas = ReturnType<typeof Canvas>;
|
|
21
|
+
export default Canvas;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
colSpan?: number;
|
|
8
|
+
rowSpan?: number;
|
|
9
|
+
style?: Style;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-cell props={encodeProps('Cell', rest)}>{@render children?.()}</forme-cell>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
colSpan?: number;
|
|
5
|
+
rowSpan?: number;
|
|
6
|
+
style?: Style;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const Cell: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Cell = ReturnType<typeof Cell>;
|
|
11
|
+
export default Cell;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
import { encodeProps } from '../encode.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Unique field name. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Whether the checkbox is checked. Default: false. */
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** Display width in points. Default: 14. */
|
|
11
|
+
width?: number;
|
|
12
|
+
/** Display height in points. Default: 14. */
|
|
13
|
+
height?: number;
|
|
14
|
+
/** Prevent editing. Default: false. */
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
style?: Style;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let rest: Props = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<forme-checkbox props={encodeProps('Checkbox', rest)}></forme-checkbox>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Style } from '@formepdf/shared';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Unique field name. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Whether the checkbox is checked. Default: false. */
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/** Display width in points. Default: 14. */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Display height in points. Default: 14. */
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Prevent editing. Default: false. */
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
style?: Style;
|
|
14
|
+
}
|
|
15
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
17
|
+
export default Checkbox;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { children, ...rest }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<forme-code props={encodeProps('Code', rest)}>{@render children?.()}</forme-code>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Code: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Code = ReturnType<typeof Code>;
|
|
9
|
+
export default Code;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { CertificationConfig, FontRegistration, Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
title?: string;
|
|
8
|
+
author?: string;
|
|
9
|
+
subject?: string;
|
|
10
|
+
creator?: string;
|
|
11
|
+
/** Document language (BCP 47 tag, e.g. "en-US"). Emitted as /Lang in the PDF Catalog. */
|
|
12
|
+
lang?: string;
|
|
13
|
+
/** Default style applied to the entire document. Sets global fontFamily, fontSize, color, etc. */
|
|
14
|
+
style?: Style;
|
|
15
|
+
/** Whether to produce a tagged (accessible) PDF with structure tree. */
|
|
16
|
+
tagged?: boolean;
|
|
17
|
+
/** PDF/A conformance level. "2a" requires tagging, "2b" is visual-only compliance. */
|
|
18
|
+
pdfa?: '2a' | '2b';
|
|
19
|
+
/** When true, the PDF claims PDF/UA-1 conformance. Forces tagging. */
|
|
20
|
+
pdfUa?: boolean;
|
|
21
|
+
/** Digital certification configuration. Certifies the PDF with an X.509 certificate. */
|
|
22
|
+
certification?: CertificationConfig;
|
|
23
|
+
/** @deprecated Use certification */
|
|
24
|
+
signature?: CertificationConfig;
|
|
25
|
+
/** Per-document custom fonts. Merged with `Font.register()` globals; document fonts win on conflict. */
|
|
26
|
+
fonts?: FontRegistration[];
|
|
27
|
+
children?: Snippet;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let { children, ...rest }: Props = $props();
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<forme-document props={encodeProps('Document', rest)}>{@render children?.()}</forme-document>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { CertificationConfig, FontRegistration, Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
title?: string;
|
|
5
|
+
author?: string;
|
|
6
|
+
subject?: string;
|
|
7
|
+
creator?: string;
|
|
8
|
+
/** Document language (BCP 47 tag, e.g. "en-US"). Emitted as /Lang in the PDF Catalog. */
|
|
9
|
+
lang?: string;
|
|
10
|
+
/** Default style applied to the entire document. Sets global fontFamily, fontSize, color, etc. */
|
|
11
|
+
style?: Style;
|
|
12
|
+
/** Whether to produce a tagged (accessible) PDF with structure tree. */
|
|
13
|
+
tagged?: boolean;
|
|
14
|
+
/** PDF/A conformance level. "2a" requires tagging, "2b" is visual-only compliance. */
|
|
15
|
+
pdfa?: '2a' | '2b';
|
|
16
|
+
/** When true, the PDF claims PDF/UA-1 conformance. Forces tagging. */
|
|
17
|
+
pdfUa?: boolean;
|
|
18
|
+
/** Digital certification configuration. Certifies the PDF with an X.509 certificate. */
|
|
19
|
+
certification?: CertificationConfig;
|
|
20
|
+
/** @deprecated Use certification */
|
|
21
|
+
signature?: CertificationConfig;
|
|
22
|
+
/** Per-document custom fonts. Merged with `Font.register()` globals; document fonts win on conflict. */
|
|
23
|
+
fonts?: FontRegistration[];
|
|
24
|
+
children?: Snippet;
|
|
25
|
+
}
|
|
26
|
+
declare const Document: import("svelte").Component<Props, {}, "">;
|
|
27
|
+
type Document = ReturnType<typeof Document>;
|
|
28
|
+
export default Document;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
import { encodeProps } from '../encode.js';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Unique field name. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** List of selectable options. */
|
|
9
|
+
options: string[];
|
|
10
|
+
/** Pre-selected value. */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** Field width in points. */
|
|
13
|
+
width: number;
|
|
14
|
+
/** Field height in points. Default: 24. */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Prevent editing. Default: false. */
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
/** Font size in points. Default: 12. */
|
|
19
|
+
fontSize?: number;
|
|
20
|
+
style?: Style;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let rest: Props = $props();
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<forme-dropdown props={encodeProps('Dropdown', rest)}></forme-dropdown>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Style } from '@formepdf/shared';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Unique field name. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** List of selectable options. */
|
|
6
|
+
options: string[];
|
|
7
|
+
/** Pre-selected value. */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** Field width in points. */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Field height in points. Default: 24. */
|
|
12
|
+
height?: number;
|
|
13
|
+
/** Prevent editing. Default: false. */
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
/** Font size in points. Default: 12. */
|
|
16
|
+
fontSize?: number;
|
|
17
|
+
style?: Style;
|
|
18
|
+
}
|
|
19
|
+
declare const Dropdown: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type Dropdown = ReturnType<typeof Dropdown>;
|
|
21
|
+
export default Dropdown;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { children, ...rest }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<forme-em props={encodeProps('Em', rest)}>{@render children?.()}</forme-em>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
declare const Em: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Em = ReturnType<typeof Em>;
|
|
9
|
+
export default Em;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Which page edge this element repeats on. Fixed elements reduce
|
|
8
|
+
* the available content area on every page. */
|
|
9
|
+
position: 'header' | 'footer';
|
|
10
|
+
style?: Style;
|
|
11
|
+
bookmark?: string;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { children, ...rest }: Props = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<forme-fixed props={encodeProps('Fixed', rest)}>{@render children?.()}</forme-fixed>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Which page edge this element repeats on. Fixed elements reduce
|
|
5
|
+
* the available content area on every page. */
|
|
6
|
+
position: 'header' | 'footer';
|
|
7
|
+
style?: Style;
|
|
8
|
+
bookmark?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
declare const Fixed: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Fixed = ReturnType<typeof Fixed>;
|
|
13
|
+
export default Fixed;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
href?: string;
|
|
9
|
+
bookmark?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-h1 props={encodeProps('H1', rest)}>{@render children?.()}</forme-h1>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
href?: string;
|
|
6
|
+
bookmark?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const H1: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type H1 = ReturnType<typeof H1>;
|
|
11
|
+
export default H1;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
href?: string;
|
|
9
|
+
bookmark?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-h2 props={encodeProps('H2', rest)}>{@render children?.()}</forme-h2>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
href?: string;
|
|
6
|
+
bookmark?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const H2: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type H2 = ReturnType<typeof H2>;
|
|
11
|
+
export default H2;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
href?: string;
|
|
9
|
+
bookmark?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-h3 props={encodeProps('H3', rest)}>{@render children?.()}</forme-h3>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
href?: string;
|
|
6
|
+
bookmark?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const H3: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type H3 = ReturnType<typeof H3>;
|
|
11
|
+
export default H3;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
href?: string;
|
|
9
|
+
bookmark?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-h4 props={encodeProps('H4', rest)}>{@render children?.()}</forme-h4>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Style } from '@formepdf/shared';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: Style;
|
|
5
|
+
href?: string;
|
|
6
|
+
bookmark?: string;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const H4: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type H4 = ReturnType<typeof H4>;
|
|
11
|
+
export default H4;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Style } from '@formepdf/shared';
|
|
4
|
+
import { encodeProps } from '../encode.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
style?: Style;
|
|
8
|
+
href?: string;
|
|
9
|
+
bookmark?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { children, ...rest }: Props = $props();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<forme-h5 props={encodeProps('H5', rest)}>{@render children?.()}</forme-h5>
|