|
| 1 | +// Definitions by: Zachary Maybury <https://github.com/zmaybury> |
| 2 | +// Kylie Stewart <https://github.com/kale-stew> |
| 3 | + |
| 4 | +declare module 'spectacle' { |
| 5 | + import * as CSS from 'csstype'; |
| 6 | + import * as React from 'react'; |
| 7 | + |
| 8 | + /** |
| 9 | + * Alignment Types for Spectacle |
| 10 | + */ |
| 11 | + type alignType = |
| 12 | + | 'flex-start flex-start' |
| 13 | + | 'flex-start center' |
| 14 | + | 'flex-start flex-end' |
| 15 | + | 'center flex-start' |
| 16 | + | 'center center' |
| 17 | + | 'center flex-end' |
| 18 | + | 'flex-end flex-start' |
| 19 | + | 'flex-end center' |
| 20 | + | 'flex-end flex-end'; |
| 21 | + |
| 22 | + /** |
| 23 | + * Animation Types for Spectacle |
| 24 | + */ |
| 25 | + type easeType = |
| 26 | + | 'back' |
| 27 | + | 'backIn' |
| 28 | + | 'backOut' |
| 29 | + | 'backInOut' |
| 30 | + | 'bounce' |
| 31 | + | 'bounceIn' |
| 32 | + | 'bounceOut' |
| 33 | + | 'bounceInOut' |
| 34 | + | 'circle' |
| 35 | + | 'circleIn' |
| 36 | + | 'circleOut' |
| 37 | + | 'circleInOut' |
| 38 | + | 'linear' |
| 39 | + | 'linearIn' |
| 40 | + | 'linearOut' |
| 41 | + | 'linearInOut' |
| 42 | + | 'cubic' |
| 43 | + | 'cubicIn' |
| 44 | + | 'cubicOut' |
| 45 | + | 'cubicInOut' |
| 46 | + | 'elastic' |
| 47 | + | 'elasticIn' |
| 48 | + | 'elasticOut' |
| 49 | + | 'elasticInOut' |
| 50 | + | 'exp' |
| 51 | + | 'expIn' |
| 52 | + | 'expOut' |
| 53 | + | 'expInOut' |
| 54 | + | 'poly' |
| 55 | + | 'polyIn' |
| 56 | + | 'polyOut' |
| 57 | + | 'polyInOut' |
| 58 | + | 'quad' |
| 59 | + | 'quadIn' |
| 60 | + | 'quadOut' |
| 61 | + | 'quadInOut' |
| 62 | + | 'sin' |
| 63 | + | 'sinIn' |
| 64 | + | 'sinOut' |
| 65 | + | 'sinInOut'; |
| 66 | + |
| 67 | + /** |
| 68 | + * Progress Types for Spectacle |
| 69 | + */ |
| 70 | + type progressType = 'pacman' | 'bar' | 'number' | 'none'; |
| 71 | + |
| 72 | + /** |
| 73 | + * S Types for StyledS in Spectacle |
| 74 | + */ |
| 75 | + type sType = 'italic' | 'bold' | 'line-through' | 'underline'; |
| 76 | + |
| 77 | + /** |
| 78 | + * Target Types for links |
| 79 | + */ |
| 80 | + type targetType = '_blank' | '_self' | '_parent' | '_top'; |
| 81 | + |
| 82 | + /** |
| 83 | + * Theme Types for CodePane in Spectacle |
| 84 | + */ |
| 85 | + type themeType = 'dark' | 'light' | 'external'; |
| 86 | + |
| 87 | + /** |
| 88 | + * Transition Types for Spectacle |
| 89 | + */ |
| 90 | + type transitionType = 'slide' | 'zoom' | 'fade' | 'spin'; |
| 91 | + |
| 92 | + /** |
| 93 | + * All available DOM style properties and their types |
| 94 | + * https://www.npmjs.com/package/csstype |
| 95 | + */ |
| 96 | + interface CSSProperties extends CSS.Properties<string | number> {} |
| 97 | + |
| 98 | + interface AnimProps { |
| 99 | + easing: easeType; |
| 100 | + fromStyle: CSSProperties | CSSProperties[]; |
| 101 | + onAnim?: (forwards?: boolean, animIndex?: number) => void; |
| 102 | + order?: number; |
| 103 | + route?: object; |
| 104 | + style?: CSSProperties; |
| 105 | + toStyle: CSSProperties | CSSProperties[]; |
| 106 | + transitionDuration: number; |
| 107 | + } |
| 108 | + |
| 109 | + interface AppearProps { |
| 110 | + easing?: easeType; |
| 111 | + endValue?: object; |
| 112 | + fid?: string; |
| 113 | + order?: number; |
| 114 | + startValue?: object; |
| 115 | + style?: BaseProps['style']; |
| 116 | + transitionDuration?: number; |
| 117 | + } |
| 118 | + |
| 119 | + /** |
| 120 | + * Base props for many Spectacle components |
| 121 | + */ |
| 122 | + interface BaseProps { |
| 123 | + bgColor?: string; |
| 124 | + bgDarken?: number; |
| 125 | + bgImage?: string; |
| 126 | + bold?: boolean; |
| 127 | + caps?: boolean; |
| 128 | + className?: string; |
| 129 | + italic?: boolean; |
| 130 | + margin?: number | string; |
| 131 | + padding?: number | string; |
| 132 | + style?: CSSProperties; |
| 133 | + textAlign?: string; |
| 134 | + textColor?: string; |
| 135 | + textFont?: string; |
| 136 | + textSize?: string; |
| 137 | + } |
| 138 | + |
| 139 | + interface CodePaneProps { |
| 140 | + className?: BaseProps['className']; |
| 141 | + contentEditable?: boolean; |
| 142 | + lang?: string; |
| 143 | + source?: string; |
| 144 | + style?: BaseProps['style']; |
| 145 | + theme?: themeType; |
| 146 | + } |
| 147 | + |
| 148 | + interface ComponentPlaygroundProps { |
| 149 | + code?: string; |
| 150 | + previewBackgroundColor?: string; |
| 151 | + scope?: object; |
| 152 | + theme?: themeType; |
| 153 | + transformCode?: (code: string) => string; |
| 154 | + } |
| 155 | + |
| 156 | + interface DeckProps { |
| 157 | + autoplay?: boolean; |
| 158 | + autoplayDuration?: number; |
| 159 | + autoplayLoop?: boolean; |
| 160 | + controls?: boolean; |
| 161 | + globalStyles?: boolean; |
| 162 | + history?: any; // Needs a type, see https://github.com/ReactTraining/history |
| 163 | + onStateChange?: (previousState?: string, nextState?: string) => void; |
| 164 | + progress?: progressType; |
| 165 | + theme?: Theme; |
| 166 | + transition?: transitionType[]; |
| 167 | + transitionDuration?: number; |
| 168 | + } |
| 169 | + |
| 170 | + interface FillProps { |
| 171 | + className?: string; |
| 172 | + style?: CSSProperties; |
| 173 | + } |
| 174 | + |
| 175 | + interface FitProps extends FillProps {} // tslint:disable-line:no-empty-interface |
| 176 | + |
| 177 | + interface GoToActionProps { |
| 178 | + margin?: BaseProps['margin']; |
| 179 | + padding?: BaseProps['padding']; |
| 180 | + render?: (goToSlide?: (slide: number | string) => void) => void; |
| 181 | + slide?: number | string; |
| 182 | + style?: BaseProps['style']; |
| 183 | + } |
| 184 | + |
| 185 | + interface HeadingProps extends BaseProps { |
| 186 | + fit?: boolean; |
| 187 | + lineHeight?: number; |
| 188 | + size?: number; |
| 189 | + } |
| 190 | + |
| 191 | + interface ImageProps { |
| 192 | + alt?: string; |
| 193 | + className?: BaseProps['className']; |
| 194 | + display?: string; |
| 195 | + height?: number | string; |
| 196 | + margin?: BaseProps['margin']; |
| 197 | + padding?: BaseProps['padding']; |
| 198 | + src?: string; |
| 199 | + width?: number | string; |
| 200 | + } |
| 201 | + |
| 202 | + interface LayoutProps { |
| 203 | + style?: CSSProperties; |
| 204 | + } |
| 205 | + |
| 206 | + interface LinkProps extends BaseProps { |
| 207 | + href?: string; |
| 208 | + target?: targetType; |
| 209 | + } |
| 210 | + |
| 211 | + interface MarkdownProps { |
| 212 | + mdastConfig?: { [key: string]: number | string }; |
| 213 | + source?: string; |
| 214 | + } |
| 215 | + |
| 216 | + interface SlideProps extends BaseProps { |
| 217 | + align?: alignType; |
| 218 | + contentStyles?: CSSProperties; |
| 219 | + controlColor?: string; |
| 220 | + dispatch?: () => void; |
| 221 | + hash?: number | string; |
| 222 | + progressColor?: string; |
| 223 | + history?: any; // Needs a type, see https://github.com/ReactTraining/history |
| 224 | + id?: string; |
| 225 | + lastSlideIndex?: number; |
| 226 | + notes?: string; |
| 227 | + onActive?: (slideIndex: string | number) => void; |
| 228 | + slideIndex?: number; |
| 229 | + state?: string; |
| 230 | + transition?: transitionType[]; |
| 231 | + transitionDuration?: number; |
| 232 | + transitionIn?: transitionType[]; |
| 233 | + transitionOut?: transitionType[]; |
| 234 | + } |
| 235 | + |
| 236 | + interface SProps extends BaseProps { |
| 237 | + type?: sType | sType[]; |
| 238 | + } |
| 239 | + |
| 240 | + interface TextProps extends BaseProps { |
| 241 | + fit?: boolean; |
| 242 | + lineHeight?: number; |
| 243 | + } |
| 244 | + |
| 245 | + interface Theme { |
| 246 | + [key: string]: number | string; |
| 247 | + } |
| 248 | + |
| 249 | + class Anim extends React.Component<AnimProps> {} |
| 250 | + |
| 251 | + class Appear extends React.Component<AppearProps> {} |
| 252 | + |
| 253 | + class BlockQuote extends React.Component<BaseProps> {} |
| 254 | + |
| 255 | + class Cite extends React.Component<BaseProps> {} |
| 256 | + |
| 257 | + class Code extends React.Component<BaseProps> {} |
| 258 | + |
| 259 | + class CodePane extends React.Component<CodePaneProps> {} |
| 260 | + |
| 261 | + class ComponentPlayground extends React.Component<ComponentPlaygroundProps> {} |
| 262 | + |
| 263 | + class Deck extends React.Component<DeckProps> {} |
| 264 | + |
| 265 | + class Fill extends React.Component<FillProps> {} |
| 266 | + |
| 267 | + class Fit extends React.Component<FitProps> {} |
| 268 | + |
| 269 | + class GoToAction extends React.Component<GoToActionProps> {} |
| 270 | + |
| 271 | + class Heading extends React.Component<HeadingProps> {} |
| 272 | + |
| 273 | + class Image extends React.Component<ImageProps> {} |
| 274 | + |
| 275 | + class Layout extends React.Component<LayoutProps> {} |
| 276 | + |
| 277 | + class Link extends React.Component<LinkProps> {} |
| 278 | + |
| 279 | + class List extends React.Component<BaseProps> {} |
| 280 | + |
| 281 | + class ListItem extends React.Component<BaseProps> {} |
| 282 | + |
| 283 | + class Markdown extends React.Component<MarkdownProps> {} |
| 284 | + |
| 285 | + class Notes extends React.Component<BaseProps> {} |
| 286 | + |
| 287 | + class Quote extends React.Component<BaseProps> {} |
| 288 | + |
| 289 | + class S extends React.Component<SProps> {} |
| 290 | + |
| 291 | + class Slide extends React.Component<SlideProps> {} |
| 292 | + |
| 293 | + class SlideSet extends React.Component<BaseProps> {} |
| 294 | + |
| 295 | + class Table extends React.Component<BaseProps> {} |
| 296 | + |
| 297 | + class TableBody extends React.Component<BaseProps> {} |
| 298 | + |
| 299 | + class TableHeader extends React.Component<BaseProps> {} |
| 300 | + |
| 301 | + class TableHeaderItem extends React.Component<BaseProps> {} |
| 302 | + |
| 303 | + class TableItem extends React.Component<BaseProps> {} |
| 304 | + |
| 305 | + class TableRow extends React.Component<BaseProps> {} |
| 306 | + |
| 307 | + class Text extends React.Component<TextProps> {} |
| 308 | +} |
| 309 | + |
| 310 | +declare module 'spectacle/lib/utils/preloader' { |
| 311 | + const preloader: (obj: object) => void; |
| 312 | + export default preloader; |
| 313 | +} |
| 314 | + |
| 315 | +declare module 'spectacle/lib/themes/default' { |
| 316 | + import { Theme } from 'spectacle'; |
| 317 | + const createTheme: (...args: object[]) => Theme; |
| 318 | + export default createTheme; |
| 319 | +} |
0 commit comments