Skip to content

Commit

Permalink
Merge pull request #650 from viacomaa/add-shapes-and-font-options-types
Browse files Browse the repository at this point in the history
Add shapes and font options types
  • Loading branch information
gitbrent authored Jan 28, 2020
2 parents 21a4d49 + 4a54267 commit 14934e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
24 changes: 10 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 @@ -247,11 +251,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 @@ -280,7 +282,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 @@ -289,13 +291,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 @@ -305,7 +305,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 @@ -335,7 +334,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 @@ -356,8 +355,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 @@ -407,9 +404,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 Expand Up @@ -570,4 +565,5 @@ export interface IPresentation {
imageCounter: number
slides?: ISlide[]
slideLayouts?: ISlideLayout[]
shapes: {[key: string]: IShape}
}
24 changes: 10 additions & 14 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ declare class PptxGenJS {
* @note the `revision` value must be a whole number only (without "." or "," - otherwise, PPT will throw errors upon opening!)
*/
revision: string
shapes: {[key: string]: PptxGenJS.IShape}
subject: string
title: string

Expand Down Expand Up @@ -552,6 +553,10 @@ declare namespace PptxGenJS {
}
type MediaType = 'audio' | 'online' | 'video'

export interface FontOptions {
fontFace?: string
fontSize?: number
}
export interface PositionOptions {
x?: Coord
y?: Coord
Expand Down Expand Up @@ -768,11 +773,9 @@ declare namespace PptxGenJS {
rotate?: number
shadow?: IShadowOptions
}
export interface IChartTitleOpts {
export interface IChartTitleOpts extends FontOptions {
title: string
color?: String
fontSize?: number
fontFace?: string
rotate?: number
titleAlign?: string
titlePos?: {
Expand Down Expand Up @@ -817,7 +820,7 @@ declare namespace PptxGenJS {
slideMargin?: Margin
verbose?: boolean
}
export interface ITableCellOpts {
export interface ITableCellOpts extends FontOptions {
autoPageCharWeight?: number
autoPageLineWeight?: number
align?: HAlign
Expand All @@ -826,13 +829,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 @@ -842,7 +843,6 @@ declare namespace PptxGenJS {
colspan?: number
colW?: number | number[]
fill?: Color
fontSize?: number
margin?: Margin
newSlideStartY?: number
rowW?: number | number[]
Expand All @@ -869,7 +869,7 @@ declare namespace PptxGenJS {
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 @@ -896,8 +896,6 @@ declare namespace PptxGenJS {
charSpacing?: number
color?: string
fill?: ShapeFill
fontFace?: string
fontSize?: number
glow?: IGlowOptions
hyperlink?: HyperLink
indentLevel?: number
Expand Down Expand Up @@ -947,9 +945,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 14934e3

Please sign in to comment.