@formepdf/shared 0.21.0 → 0.23.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/index.d.ts +1 -1
- package/dist/parser.d.ts +28 -1
- package/dist/parser.js +4 -0
- package/dist/types.d.ts +36 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export { recordCanvasOperations } from './canvas.js';
|
|
|
5
5
|
export { STRONG_DEFAULTS, EM_DEFAULTS, CODE_DEFAULTS, LINK_DEFAULTS, HEADING_DEFAULTS, mapListMarker, } from './semantics.js';
|
|
6
6
|
export { buildBarChartKind, buildLineChartKind, buildPieChartKind, buildAreaChartKind, buildDotPlotKind, } from './charts.js';
|
|
7
7
|
export type { BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps, } from './charts.js';
|
|
8
|
-
export type { Style, GridTrackSize, Edges, Corners, EdgeColors, CertificationConfig, SignatureConfig, ColumnDef, BarcodeFormat, ChartDataPoint, PieDataPoint, ChartSeries, DotPlotGroup, CanvasContext, CanvasOp, TextRun, ListMarker, FormeDocument, FormeFont, FormeNode, FormeNodeKind, FormeStyle, FormeMetadata, FormePageConfig, FormePageSize, FormeEdges, FormeBoxShadow, FormeGradientStop, FormeBackground, FormeMarginEdges, FormeColumnDef, FormeColumnWidth, FormeDimension, FormeColor, FormeEdgeValues, FormeCornerValues, FormeGridTrackSize, FormeGridPlacement, FormeListMarkerType, FormeTransformOp, } from './types.js';
|
|
8
|
+
export type { Style, GridTrackSize, Edges, Corners, EdgeColors, CertificationConfig, SignatureConfig, ColumnDef, BarcodeFormat, ChartDataPoint, PieDataPoint, ChartSeries, DotPlotGroup, CanvasContext, CanvasOp, TextRun, ListMarker, FormeDocument, FormeDocumentClaimProps, FormeFont, FormeNode, FormeNodeKind, FormeStyle, FormeMetadata, FormePageConfig, FormePageSize, FormeEdges, FormeBoxShadow, FormeGradientStop, FormeBackground, FormeMarginEdges, FormeColumnDef, FormeColumnWidth, FormeDimension, FormeColor, FormeEdgeValues, FormeCornerValues, FormeGridTrackSize, FormeGridPlacement, FormeListMarkerType, FormeTransformOp, } from './types.js';
|
|
9
9
|
export { parseMarkup } from './parser.js';
|
|
10
10
|
export { encodeProps, reviveBytesMarker } from './encode.js';
|
package/dist/parser.d.ts
CHANGED
|
@@ -26,5 +26,32 @@
|
|
|
26
26
|
* - Newlines inside interpolated *values* are treated like template
|
|
27
27
|
* text and collapse to a space.
|
|
28
28
|
*/
|
|
29
|
-
import type {
|
|
29
|
+
import type { FormeDocumentClaimProps } from './types.js';
|
|
30
|
+
import type { CertificationConfig, FontRegistration, FormeDocument, Style } from './index.js';
|
|
31
|
+
/**
|
|
32
|
+
* Parse placeholder markup emitted by the Forme Svelte components into
|
|
33
|
+
* a Forme JSON document object. The markup must contain a single
|
|
34
|
+
* `<forme-document>` root element.
|
|
35
|
+
*/
|
|
36
|
+
interface DocumentProps {
|
|
37
|
+
title?: string;
|
|
38
|
+
author?: string;
|
|
39
|
+
subject?: string;
|
|
40
|
+
creator?: string;
|
|
41
|
+
lang?: string;
|
|
42
|
+
style?: Style;
|
|
43
|
+
tagged?: boolean;
|
|
44
|
+
pdfa?: '2a' | '2b' | '2u' | '3a' | '3b' | '3u' | '4' | '4f';
|
|
45
|
+
pdfVersion?: '1.7' | '2.0';
|
|
46
|
+
pdfUa?: boolean;
|
|
47
|
+
pdfUa2?: boolean;
|
|
48
|
+
certification?: CertificationConfig;
|
|
49
|
+
/** @deprecated Use certification */
|
|
50
|
+
signature?: CertificationConfig;
|
|
51
|
+
fonts?: FontRegistration[];
|
|
52
|
+
}
|
|
53
|
+
type Exact<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
|
|
54
|
+
type AssertTrue<T extends true> = T;
|
|
55
|
+
export type _DocumentClaimParity = AssertTrue<Exact<Pick<DocumentProps, keyof FormeDocumentClaimProps>, FormeDocumentClaimProps>>;
|
|
30
56
|
export declare function parseMarkup(markup: string): FormeDocument;
|
|
57
|
+
export {};
|
package/dist/parser.js
CHANGED
|
@@ -93,8 +93,12 @@ export function parseMarkup(markup) {
|
|
|
93
93
|
result.tagged = props.tagged;
|
|
94
94
|
if (props.pdfa !== undefined)
|
|
95
95
|
result.pdfa = props.pdfa;
|
|
96
|
+
if (props.pdfVersion !== undefined)
|
|
97
|
+
result.pdfVersion = props.pdfVersion;
|
|
96
98
|
if (props.pdfUa)
|
|
97
99
|
result.pdfUa = true;
|
|
100
|
+
if (props.pdfUa2)
|
|
101
|
+
result.pdfUa2 = true;
|
|
98
102
|
const cert = props.certification ?? props.signature;
|
|
99
103
|
if (cert) {
|
|
100
104
|
if (props.signature && !props.certification) {
|
package/dist/types.d.ts
CHANGED
|
@@ -364,11 +364,46 @@ export interface FormeDocument {
|
|
|
364
364
|
defaultStyle?: FormeStyle;
|
|
365
365
|
fonts?: FormeFont[];
|
|
366
366
|
tagged?: boolean;
|
|
367
|
-
|
|
367
|
+
/**
|
|
368
|
+
* PDF/A archival conformance. 2x/3x are the PDF 1.7 (ISO 32000-1)
|
|
369
|
+
* levels; '4' and '4f' are ISO 19005-4:2020 over PDF 2.0 — claiming
|
|
370
|
+
* them implies pdfVersion "2.0" and requires every font embedded.
|
|
371
|
+
* NOTE: PDF/A-4 is NOT an accessibility claim — the a/b/u split is
|
|
372
|
+
* gone and tagging requirements moved wholly to PDF/UA-2.
|
|
373
|
+
*/
|
|
374
|
+
pdfa?: '2a' | '2b' | '2u' | '3a' | '3b' | '3u' | '4' | '4f';
|
|
375
|
+
/**
|
|
376
|
+
* Output PDF version, default "1.7" (today's writer, byte-for-byte).
|
|
377
|
+
* "2.0" writes ISO 32000-2: XMP metadata always, no trailer /Info,
|
|
378
|
+
* and EVERY FONT MUST BE EMBEDDED — PDF 2.0 removes the standard-14
|
|
379
|
+
* provision, so the base-14 defaults (Helvetica etc.) hard-error
|
|
380
|
+
* unless @formepdf/fonts-standard (or your own fonts) are registered.
|
|
381
|
+
* 1.7-based claims (pdfa 2x/3x, pdfUa) are errors under "2.0".
|
|
382
|
+
*/
|
|
383
|
+
pdfVersion?: '1.7' | '2.0';
|
|
368
384
|
pdfUa?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* PDF/UA-2 accessibility (ISO 14289-2:2024) — the PDF 2.0 successor
|
|
387
|
+
* to pdfUa. Implies pdfVersion "2.0" (so every font must be embedded)
|
|
388
|
+
* and forces tagging with the 2.0 structure namespace. Contradicts
|
|
389
|
+
* pdfUa and the 1.7 pdfa levels (2x/3x); composes with pdfa '4'/'4f'
|
|
390
|
+
* for a file that is archival AND accessible.
|
|
391
|
+
*/
|
|
392
|
+
pdfUa2?: boolean;
|
|
369
393
|
flattenForms?: boolean;
|
|
370
394
|
certification?: CertificationConfig;
|
|
371
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* The document-level conformance claims every authoring adapter exposes
|
|
398
|
+
* 1:1 as `<Document>` props and its serializer passes straight through.
|
|
399
|
+
* Adapters assert compile-time parity against this type (see the
|
|
400
|
+
* `_DocumentClaimParity` guards) — a claim added here without reaching an
|
|
401
|
+
* adapter's prop types fails that adapter's build instead of shipping
|
|
402
|
+
* serializable but type-invisible, which is how `pdfVersion` first went
|
|
403
|
+
* out (and `passes` before it: real on one layer, absent on the layer
|
|
404
|
+
* users touch).
|
|
405
|
+
*/
|
|
406
|
+
export type FormeDocumentClaimProps = Pick<FormeDocument, 'tagged' | 'pdfa' | 'pdfVersion' | 'pdfUa' | 'pdfUa2'>;
|
|
372
407
|
export interface FormeMetadata {
|
|
373
408
|
title?: string;
|
|
374
409
|
author?: string;
|