UNPKG

@jirkasa/code-box

Version:

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

46 lines (45 loc) 2.02 kB
import CodeBoxFile from "../CodeBoxFile"; import ProjectCodeBox from "./ProjectCodeBox"; /** Represents file of project code box. */ declare class ProjectCodeBoxFile extends CodeBoxFile<ProjectCodeBox> { /** * Returns path to folder in which the file is located. * @returns Path to folder in which the file is located. */ getFolderPath(): string | null; /** * Moves file to folder (if folder does not exist, it is created; package is not changed). * @param folderPath Path to folder. * @returns Indicates whether file has been successfully moved to folder (it can return false if there already is file with the same name). */ moveToFolder(folderPath: string): boolean; /** * Returns name of file. * @returns File name. */ getFileName(): string | null; /** * Changes name of file. * @param newName New file name. * @returns Indicates whether name of file has been successfully changed (it can return false if there already is file with the same name in the same folder). */ changeFileName(newName: string): boolean; /** * Returns package of file. * @returns Package of file. If null is returned, file belongs to default package. If undefined is returned, file doesn't belong to any package. */ getPackage(): string | null | undefined; /** * Changes package of file. * @param packageName Package name (null for default package). If package does not exist, it is created. * @param keepFolderPath Determines whether file should stay in the same folder (if false, file can be moved to different folder based on package). * @returns Indicates whether change has been successfully completed. */ changePackage(packageName: string | null, keepFolderPath: boolean): boolean; /** * Removes file from package. * @returns Indicates whether file has been successfully removed from package. */ removePackage(): void; } export default ProjectCodeBoxFile;