diff --git a/src/core-interfaces.ts b/src/core-interfaces.ts index b539a0387..336955d3a 100644 --- a/src/core-interfaces.ts +++ b/src/core-interfaces.ts @@ -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 @@ -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 } @@ -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 @@ -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 @@ -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[] @@ -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?: { @@ -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 @@ -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 { @@ -570,4 +565,5 @@ export interface IPresentation { imageCounter: number slides?: ISlide[] slideLayouts?: ISlideLayout[] + shapes: {[key: string]: IShape} } diff --git a/types/index.d.ts b/types/index.d.ts index 315d68565..3a71c0751 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -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 @@ -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 @@ -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?: { @@ -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 @@ -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 @@ -842,7 +843,6 @@ declare namespace PptxGenJS { colspan?: number colW?: number | number[] fill?: Color - fontSize?: number margin?: Margin newSlideStartY?: number rowW?: number | number[] @@ -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?: { @@ -896,8 +896,6 @@ declare namespace PptxGenJS { charSpacing?: number color?: string fill?: ShapeFill - fontFace?: string - fontSize?: number glow?: IGlowOptions hyperlink?: HyperLink indentLevel?: number @@ -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 {