Skip to content

Commit

Permalink
Create a FontOptions interface and extend other interfaces appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Cronin committed Jan 22, 2020
1 parent 1c5634f commit ec2fcb5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
23 changes: 9 additions & 14 deletions src/core-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export type ShapeFill = Color | { type: string; color: Color; alpha?: number }
export type BkgdOpts = { src?: string; path?: string; data?: string }
type MediaType = 'audio' | 'online' | 'video'

export interface FontOptions {
fontFace?: string
fontSize?: number
}
export interface PositionOptions {
x?: Coord
y?: Coord
Expand Down Expand Up @@ -253,11 +257,9 @@ export interface IShapeOptions extends PositionOptions {
shadow?: IShadowOptions
}

export interface IChartTitleOpts {
export interface IChartTitleOpts extends FontOptions {
title: string
color?: String
fontSize?: number
fontFace?: string
rotate?: number
titleAlign?: string
titlePos?: { x: number; y: number }
Expand Down Expand Up @@ -286,7 +288,7 @@ export interface ITableToSlidesOpts extends ITableOptions {
slideMargin?: Margin
verbose?: boolean // Undocumented; shows verbose output
}
export interface ITableCellOpts {
export interface ITableCellOpts extends FontOptions {
autoPageCharWeight?: number
autoPageLineWeight?: number
align?: HAlign
Expand All @@ -295,13 +297,11 @@ export interface ITableCellOpts {
color?: Color
colspan?: number
fill?: ShapeFill
fontFace?: string
fontSize?: number
margin?: Margin
rowspan?: number
valign?: VAlign
}
export interface ITableOptions extends PositionOptions {
export interface ITableOptions extends PositionOptions, FontOptions {
align?: HAlign
autoPage?: boolean
autoPageCharWeight?: number
Expand All @@ -311,7 +311,6 @@ export interface ITableOptions extends PositionOptions {
colspan?: number
colW?: number | number[]
fill?: Color
fontSize?: number
margin?: Margin
newSlideStartY?: number
rowW?: number | number[]
Expand Down Expand Up @@ -341,7 +340,7 @@ export interface TableRowSlide {
rows: ITableRow[]
}

export interface ITextOpts extends PositionOptions, OptsDataOrPath {
export interface ITextOpts extends PositionOptions, OptsDataOrPath, FontOptions {
align?: HAlign
autoFit?: boolean
bodyProp?: {
Expand All @@ -362,8 +361,6 @@ export interface ITextOpts extends PositionOptions, OptsDataOrPath {
charSpacing?: number
color?: string
fill?: ShapeFill
fontFace?: string
fontSize?: number
glow?: IGlowOptions
hyperlink?: HyperLink
indentLevel?: number
Expand Down Expand Up @@ -413,9 +410,7 @@ export interface IUserLayout {
width: number
height: number
}
export interface ISlideNumber extends PositionOptions {
fontFace?: string
fontSize?: number
export interface ISlideNumber extends PositionOptions, FontOptions {
color?: string
}
export interface ISlideMasterOptions {
Expand Down
23 changes: 9 additions & 14 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ declare namespace PptxGenJS {
export type BkgdOpts = { src?: string; path?: string; data?: string }
type MediaType = 'audio' | 'online' | 'video'

export interface FontOptions {
fontFace?: string
fontSize?: number
}
export interface PositionOptions {
x?: Coord
y?: Coord
Expand Down Expand Up @@ -377,11 +381,9 @@ declare namespace PptxGenJS {
shadow?: IShadowOptions
}

export interface IChartTitleOpts {
export interface IChartTitleOpts extends FontOptions {
title: string
color?: String
fontSize?: number
fontFace?: string
rotate?: number
titleAlign?: string
titlePos?: { x: number; y: number }
Expand Down Expand Up @@ -410,7 +412,7 @@ declare namespace PptxGenJS {
slideMargin?: Margin
verbose?: boolean // Undocumented; shows verbose output
}
export interface ITableCellOpts {
export interface ITableCellOpts extends FontOptions {
autoPageCharWeight?: number
autoPageLineWeight?: number
align?: HAlign
Expand All @@ -419,13 +421,11 @@ declare namespace PptxGenJS {
color?: Color
colspan?: number
fill?: ShapeFill
fontFace?: string
fontSize?: number
margin?: Margin
rowspan?: number
valign?: VAlign
}
export interface ITableOptions extends PositionOptions {
export interface ITableOptions extends PositionOptions, FontOptions {
align?: HAlign
autoPage?: boolean
autoPageCharWeight?: number
Expand All @@ -435,7 +435,6 @@ declare namespace PptxGenJS {
colspan?: number
colW?: number | number[]
fill?: Color
fontSize?: number
margin?: Margin
newSlideStartY?: number
rowW?: number | number[]
Expand Down Expand Up @@ -465,7 +464,7 @@ declare namespace PptxGenJS {
rows: ITableRow[]
}

export interface ITextOpts extends PositionOptions, OptsDataOrPath {
export interface ITextOpts extends PositionOptions, OptsDataOrPath, FontOptions {
align?: HAlign
autoFit?: boolean
bodyProp?: {
Expand All @@ -486,8 +485,6 @@ declare namespace PptxGenJS {
charSpacing?: number
color?: string
fill?: ShapeFill
fontFace?: string
fontSize?: number
glow?: IGlowOptions
hyperlink?: HyperLink
indentLevel?: number
Expand Down Expand Up @@ -537,9 +534,7 @@ declare namespace PptxGenJS {
width: number
height: number
}
export interface ISlideNumber extends PositionOptions {
fontFace?: string
fontSize?: number
export interface ISlideNumber extends PositionOptions, FontOptions {
color?: string
}
export interface ISlideMasterOptions {
Expand Down

0 comments on commit ec2fcb5

Please sign in to comment.