UNPKG

@jirkasa/code-box

Version:

Showcase code samples on the web with a container that lets users select and display different samples.

51 lines (50 loc) 1.65 kB
import CodeView from "../code-view/CodeView"; import EventSourcePoint from "../utils/EventSourcePoint"; /** Represents code view button. */ declare abstract class CodeViewButton { /** Event source for which is fired event when code view to which the button belongs to should be set as active. */ private showCodeViewEventSource; /** Code view to which the button belongs to. */ private codeView; /** * Creates new code view button. * @param showCodeViewEventSource Event source for which will be fired event when code view to which the button belongs to should be set as active. * @param codeView Code view to which the button belongs to. */ constructor(showCodeViewEventSource: EventSourcePoint<CodeViewButton, CodeView>, codeView: CodeView); /** * Appends button to element. * @param container Element to append button to. */ abstract appendTo(container: HTMLElement): void; /** * Detaches button from its parent element. */ abstract detach(): void; /** * Sets text of button. * @param text Text. */ abstract setText(text: string): void; /** * Displays button as active. */ abstract setAsActive(): void; /** * Displays button as inactive. */ abstract setAsInactive(): void; /** * Enables tab navigation. */ abstract enableTabNavigation(): void; /** * Disables tab navigation. */ abstract disableTabNavigation(): void; /** * Fires event to show code view to which the button belongs to. */ protected showCodeView(): void; } export default CodeViewButton;