From 70880592a041189ee6b5b92546ae2a7dea9ca45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Berre=C3=9Fem?= Date: Thu, 4 Apr 2019 10:07:38 +0200 Subject: [PATCH] :art: add namespace 'Recipe' for interfaces and types --- types/hummus-recipe/index.d.ts | 322 +++++++++++++++++---------------- 1 file changed, 167 insertions(+), 155 deletions(-) diff --git a/types/hummus-recipe/index.d.ts b/types/hummus-recipe/index.d.ts index 247956428d..8d575e6f4b 100644 --- a/types/hummus-recipe/index.d.ts +++ b/types/hummus-recipe/index.d.ts @@ -4,172 +4,174 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -export interface RecipeOptions { - version?: number; - author?: string; - title?: string; - subject?: string; - keywords?: string[]; -} +export namespace Recipe { + interface RecipeOptions { + version?: number; + author?: string; + title?: string; + subject?: string; + keywords?: string[]; + } -export interface CommentOptions { - title?: string; - date?: string; - open?: boolean; - richText?: boolean; - flag?: - | "invisible" - | "hidden" - | "print" - | "nozoom" - | "norotate" - | "noview" - | "readonly" - | "locked" - | "togglenoview"; -} + interface CommentOptions { + title?: string; + date?: string; + open?: boolean; + richText?: boolean; + flag?: + | "invisible" + | "hidden" + | "print" + | "nozoom" + | "norotate" + | "noview" + | "readonly" + | "locked" + | "togglenoview"; + } -export interface AnnotOptions { - title?: string; - open?: boolean; - richText?: boolean; - flag?: - | "invisible" - | "hidden" - | "print" - | "nozoom" - | "norotate" - | "noview" - | "readonly" - | "locked" - | "togglenoview"; - icon?: - | "Comment" - | "Key" - | "Note" - | "Help" - | "NewParagraph" - | "Paragraph" - | "Insert"; - width?: number; - height?: number; -} + interface AnnotOptions { + title?: string; + open?: boolean; + richText?: boolean; + flag?: + | "invisible" + | "hidden" + | "print" + | "nozoom" + | "norotate" + | "noview" + | "readonly" + | "locked" + | "togglenoview"; + icon?: + | "Comment" + | "Key" + | "Note" + | "Help" + | "NewParagraph" + | "Paragraph" + | "Insert"; + width?: number; + height?: number; + } -export interface EncryptOptions { - password?: string; - ownerPassword?: string; - userProtectionFlag?: number; -} + interface EncryptOptions { + password?: string; + ownerPassword?: string; + userProtectionFlag?: number; + } -export interface ImageOptions { - width?: number; - height?: number; - scale?: number; - keepAspectRatio?: boolean; - opacity?: number; - align?: string; -} + interface ImageOptions { + width?: number; + height?: number; + scale?: number; + keepAspectRatio?: boolean; + opacity?: number; + align?: string; + } -export interface InfoOptions { - version?: string; - author?: string; - title?: string; - subject?: string; - keywords?: string[]; -} + interface InfoOptions { + version?: string; + author?: string; + title?: string; + subject?: string; + keywords?: string[]; + } -export interface OverlayOptions { - scale?: number; - keepAspectRatio?: boolean; - fitWidth?: boolean; - fitHeight?: boolean; -} + interface OverlayOptions { + scale?: number; + keepAspectRatio?: boolean; + fitWidth?: boolean; + fitHeight?: boolean; + } -export interface TextBoxStyle { - lineWidth?: number; - stroke?: string | number[]; - dash?: number[]; - fill?: string | number[]; - opacity?: number; -} + interface TextBoxStyle { + lineWidth?: number; + stroke?: string | number[]; + dash?: number[]; + fill?: string | number[]; + opacity?: number; + } -export interface TextBox { - width?: number; - height?: number; - minHeight?: number; - padding?: number | number[]; - lineHeight?: number; - textAlign?: string; - style?: TextBoxStyle; -} + interface TextBox { + width?: number; + height?: number; + minHeight?: number; + padding?: number | number[]; + lineHeight?: number; + textAlign?: string; + style?: TextBoxStyle; + } -export interface TextOptions { - color?: string | number[]; - opacity?: number; - rotation?: number; - rotationOrigin?: number[]; - font?: string; - size?: number; - align?: string; - highlight?: boolean; - underline?: boolean; - strikeOut?: boolean; - textBox?: TextBox; -} + interface TextOptions { + color?: string | number[]; + opacity?: number; + rotation?: number; + rotationOrigin?: number[]; + font?: string; + size?: number; + align?: string; + highlight?: boolean; + underline?: boolean; + strikeOut?: boolean; + textBox?: TextBox; + } -export interface LineToOptions { - color?: string | number[]; - stroke?: string | number[]; - fill?: string | number[]; - lineWidth?: number; - opacity?: number; - dash?: number[]; -} + interface LineToOptions { + color?: string | number[]; + stroke?: string | number[]; + fill?: string | number[]; + lineWidth?: number; + opacity?: number; + dash?: number[]; + } -export interface LineOptions { - color?: string | number[]; - stroke?: string | number[]; - lineWidth?: number; - dash?: number[]; -} + interface LineOptions { + color?: string | number[]; + stroke?: string | number[]; + lineWidth?: number; + dash?: number[]; + } -export interface PolygonOptions { - color?: string | number[]; - stroke?: string | number[]; - fill?: string | number[]; - lineWidth?: number; - opacity?: number; - dash?: number[]; -} + interface PolygonOptions { + color?: string | number[]; + stroke?: string | number[]; + fill?: string | number[]; + lineWidth?: number; + opacity?: number; + dash?: number[]; + } -export interface CircleOptions { - color?: string | number[]; - stroke?: string | number[]; - fill?: string | number[]; - lineWidth?: number; - opacity?: number; - dash?: number[]; -} + interface CircleOptions { + color?: string | number[]; + stroke?: string | number[]; + fill?: string | number[]; + lineWidth?: number; + opacity?: number; + dash?: number[]; + } -export interface RectangleOptions { - color?: string | number[]; - stroke?: string | number[]; - fill?: string | number[]; - lineWidth?: number; - opacity?: number; - dash?: number[]; - rotation?: number; - rotationOrigin?: number[]; + interface RectangleOptions { + color?: string | number[]; + stroke?: string | number[]; + fill?: string | number[]; + lineWidth?: number; + opacity?: number; + dash?: number[]; + rotation?: number; + rotationOrigin?: number[]; + } } export class Recipe { - constructor(src: string, output: string, options?: RecipeOptions); + constructor(src: string, output: string, options?: Recipe.RecipeOptions); comment( text: string, x: number, y: number, - options?: CommentOptions + options?: Recipe.CommentOptions ): Recipe; annot( @@ -192,18 +194,23 @@ export class Recipe { | "Ink" | "FileAttachment" | "Sound", - options?: AnnotOptions + options?: Recipe.AnnotOptions ): Recipe; appendPage(pdfSrc: string, pages: number | number[]): Recipe; - encrypt(options: EncryptOptions): Recipe; + encrypt(options: Recipe.EncryptOptions): Recipe; registerFont(fontName: string, fontSrcPath: string): Recipe; - image(imgSrc: string, x: number, y: number, options?: ImageOptions): Recipe; + image( + imgSrc: string, + x: number, + y: number, + options?: Recipe.ImageOptions + ): Recipe; - info(options?: InfoOptions): Recipe; + info(options?: Recipe.InfoOptions): Recipe; custom(key?: string, value?: string): Recipe; @@ -217,7 +224,7 @@ export class Recipe { pdfSrc: string, x: number, y: number, - options?: OverlayOptions + options?: Recipe.OverlayOptions ): Recipe; createPage(pageWidth: number, pageHeight: number): Recipe; @@ -230,21 +237,26 @@ export class Recipe { split(outputDir: string, prefix: string): Recipe; - text(text: string, x: number, y: number, options?: TextOptions): Recipe; + text( + text: string, + x: number, + y: number, + options?: Recipe.TextOptions + ): Recipe; moveTo(x: number, y: number): Recipe; - lineTo(x: number, y: number, options?: LineToOptions): Recipe; + lineTo(x: number, y: number, options?: Recipe.LineToOptions): Recipe; - line(coordinates: number[][], options?: LineOptions): Recipe; + line(coordinates: number[][], options?: Recipe.LineOptions): Recipe; - polygon(coordinates: number[][], options?: PolygonOptions): Recipe; + polygon(coordinates: number[][], options?: Recipe.PolygonOptions): Recipe; circle( x: number, y: number, radius: number, - options?: CircleOptions + options?: Recipe.CircleOptions ): Recipe; rectangle( @@ -252,7 +264,7 @@ export class Recipe { y: number, width: number, height: number, - options?: RectangleOptions + options?: Recipe.RectangleOptions ): Recipe; endPDF(callback?: () => any): Recipe;