diff --git a/CHANGELOG.md b/CHANGELOG.md index 370e0e2..29478c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/api/PdfMaker.ts b/src/api/PdfMaker.ts index f7679dc..19c6dab 100644 --- a/src/api/PdfMaker.ts +++ b/src/api/PdfMaker.ts @@ -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 { - 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); -} diff --git a/src/api/document.ts b/src/api/document.ts index f01edf8..91fd8af 100644 --- a/src/api/document.ts +++ b/src/api/document.ts @@ -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 @@ -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 diff --git a/src/api/graphics.ts b/src/api/graphics.ts index a6dbed3..7368607 100644 --- a/src/api/graphics.ts +++ b/src/api/graphics.ts @@ -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. @@ -27,9 +27,6 @@ export type Line = { export type LineProps = Omit & TransformProps; -/** @deprecated Use `LineProps` instead. */ -export type LineOpts = LineProps; - /** * Creates a line with the given coordinates and properties. * @@ -68,9 +65,6 @@ export type Rect = { export type RectProps = Omit & FillProps & TransformProps; -/** @deprecated Use `RectProps` instead. */ -export type RectOpts = RectProps; - /** * Creates a rectangle with the given coordinates and properties. * @@ -105,9 +99,6 @@ export type Circle = { export type CircleProps = Omit & FillProps & TransformProps; -/** @deprecated Use `CircleProps` instead. */ -export type CircleOpts = CircleProps; - /** * Creates a circle with the given center, radius, and properties. * @@ -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. * @@ -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'; diff --git a/src/api/layout.ts b/src/api/layout.ts index a56428f..996ad37 100644 --- a/src/api/layout.ts +++ b/src/api/layout.ts @@ -134,11 +134,6 @@ export function rows(rows: Block[], props?: Omit): RowsBlock */ export type EmptyBlock = BlockProps; -/** - * @deprecated Use `BlockProps` instead. - */ -export type BlockAttrs = BlockProps; - /** * Properties that can be applied to a block. */ diff --git a/src/api/text.ts b/src/api/text.ts index a97994a..c6eb49d 100644 --- a/src/api/text.ts +++ b/src/api/text.ts @@ -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. */ @@ -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. */