Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
registered with `PdfMaker.registerFont()`. The `FontsDefinition` and
`FontDefinition` types have been removed.

- The deprecated standalone `makePdf` function. Use
`new PdfMaker().makePdf()` instead.

- The deprecated `Polyline` and `PolyLineOpts` types from the graphics
API. Use `Path` instead.

- The deprecated `bold` and `italic` text properties. Use
`fontWeight: 'bold'` and `fontStyle: 'italic'` instead.

- The deprecated type aliases `InfoAttrs`, `CustomInfoAttrs`,
`LineOpts`, `RectOpts`, `CircleOpts`, `PathOpts`, `BlockAttrs`,
and `TextAttrs`. Use their `*Props` counterparts instead.

### Breaking

- Text height is now based on the OS/2 typographic metrics
Expand Down
17 changes: 0 additions & 17 deletions src/api/PdfMaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,3 @@ export class PdfMaker {
return await renderDocument(def, pages);
}
}

/**
* Generates a PDF from the given document definition.
*
* @param definition The definition of the document to generate.
* @returns The generated PDF document.
*
* @deprecated Create an instance of `PdfMaker` and call `makePdf` on
* that instance.
*/
export async function makePdf(definition: DocumentDefinition): Promise<Uint8Array> {
console.warn(
'makePdf is deprecated. Create an instance of `PdfMaker` and call `makePdf` on that instance.',
);
const pdfMaker = new PdfMaker();
return await pdfMaker.makePdf(definition);
}
10 changes: 0 additions & 10 deletions src/api/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ export type EmbeddedFile = {
relationship?: FileRelationShip;
};

/**
* @deprecated Use `InfoProps` instead.
*/
export type InfoAttrs = InfoProps;

/**
* Standard metadata properties to include in the PDF's *document
* information dictionary*. These properties are usually displayed by
Expand Down Expand Up @@ -195,11 +190,6 @@ export type InfoProps = {
producer?: string;
};

/**
* @deprecated Use `CustomInfoProps` instead.
*/
export type CustomInfoAttrs = CustomInfoProps;

/**
* Custom metadata properties to include in the PDF's *document
* information dictionary*. These properties should be prefixed with
Expand Down
33 changes: 1 addition & 32 deletions src/api/graphics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Color } from './colors.ts';

export type Shape = Rect | Circle | Line | Path | Polyline;
export type Shape = Rect | Circle | Line | Path;

/**
* A straight line.
Expand All @@ -27,9 +27,6 @@ export type Line = {

export type LineProps = Omit<StrokeProps, 'lineJoin'> & TransformProps;

/** @deprecated Use `LineProps` instead. */
export type LineOpts = LineProps;

/**
* Creates a line with the given coordinates and properties.
*
Expand Down Expand Up @@ -68,9 +65,6 @@ export type Rect = {

export type RectProps = Omit<StrokeProps, 'lineCap'> & FillProps & TransformProps;

/** @deprecated Use `RectProps` instead. */
export type RectOpts = RectProps;

/**
* Creates a rectangle with the given coordinates and properties.
*
Expand Down Expand Up @@ -105,9 +99,6 @@ export type Circle = {

export type CircleProps = Omit<StrokeProps, 'lineCap' | 'lineJoin'> & FillProps & TransformProps;

/** @deprecated Use `CircleProps` instead. */
export type CircleOpts = CircleProps;

/**
* Creates a circle with the given center, radius, and properties.
*
Expand All @@ -133,9 +124,6 @@ export type Path = {

export type PathProps = StrokeProps & FillProps & TransformProps;

/** @deprecated Use `PathProps` instead. */
export type PathOpts = PathProps;

/**
* Creates a path with the given path data and properties.
*
Expand All @@ -146,25 +134,6 @@ export function path(d: string, props?: PathProps): Path {
return { ...props, type: 'path', d };
}

/**
* A polyline, i.e. a line consisting of multiple segments.
* @deprecated Use `Path` instead.
*/
export type Polyline = {
type: 'polyline';
/**
* The points of the polyline, each point as an object with `x` and `y` coordinates.
*/
points: { x: number; y: number }[];
/**
* Whether to close the path by drawing a line from the last point to the first point.
*/
closePath?: boolean;
} & PolyLineOpts;

/** @deprecated Use `Path` instead of `PolyLine`. */
export type PolyLineOpts = StrokeProps & FillProps & TransformProps;

export type LineCap = 'butt' | 'round' | 'square';
export type LineJoin = 'miter' | 'round' | 'bevel';

Expand Down
5 changes: 0 additions & 5 deletions src/api/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ export function rows(rows: Block[], props?: Omit<RowsBlock, 'rows'>): RowsBlock
*/
export type EmptyBlock = BlockProps;

/**
* @deprecated Use `BlockProps` instead.
*/
export type BlockAttrs = BlockProps;

/**
* Properties that can be applied to a block.
*/
Expand Down
17 changes: 0 additions & 17 deletions src/api/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ export type FontWeight = number | 'normal' | 'bold';
*/
export type FontStyle = 'normal' | 'italic' | 'oblique';

/**
* @deprecated Use `TextProps` instead.
*/
export type TextAttrs = TextProps;

/**
* Text properties that can be applied to a text.
*/
Expand Down Expand Up @@ -92,18 +87,6 @@ export type TextProps = {
*/
lineHeight?: number;

/**
* Whether to use a bold variant of the selected font.
* @deprecated Use `fontWeight: 'bold'` instead.
*/
bold?: boolean;

/**
* Whether to use an italic variant of the selected font.
* @deprecated Use `fontStyle: 'italic'` instead.
*/
italic?: boolean;

/**
* The text color.
*/
Expand Down