@launchmenu/applet-notes
Version:
An applet to make short notes
137 lines • 5.49 kB
TypeScript
import { ISimpleSearchPatternMatcher } from "@launchmenu/core";
import { DataCacher, IDataHook, IDataRetriever } from "model-react";
import { Note } from "./Note";
import { NotesSource } from "./NotesSource";
import { IHighlightLanguage } from "./_types/IHighlightLanguage";
import { IInherit } from "./_types/IInherit";
import { INoteCategoryMetadata } from "./_types/INoteCategoryMetadata";
export declare class NoteCategory {
readonly ID: string;
protected notesSource: NotesSource;
protected dataSource: IDataRetriever<INoteCategoryMetadata>;
protected update: (ID: string, data?: INoteCategoryMetadata) => void;
/**
* Creates a new note category instance
* @param ID The ID of the note
* @param dataSource The data source of the note category
* @param update A function to update the category's data
* @param notesSource All registered notes, including ones not part of this category
*/
constructor(ID: string, dataSource: IDataRetriever<INoteCategoryMetadata>, update: (ID: string, data?: INoteCategoryMetadata) => void, notesSource: NotesSource);
/**
* Retrieves the name of the category
* @param hook The hook to subscribe to changes
* @returns The category's name
*/
getName(hook?: IDataHook): string;
/**
* Retrieves the notes source that this category belongs to
* @returns The notes source
*/
getSource(): NotesSource;
/** The cached notes of this category */
protected notes: DataCacher<Note[]>;
/**
* Retrieves all notes in this category
* @param hook The hook to subscribe to changes
* @returns The notes in the category
*/
getNotes(hook?: IDataHook): Note[];
/**
* Retrieves the search pattern as a text string
* @param hook The hook to subscribe to changes
* @returns The search pattern if any
*/
getSearchPattern(hook?: IDataHook): string | undefined;
/** The search pattern matcher */
protected searchPatternMatcher: ISimpleSearchPatternMatcher;
/**
* Retrieves the search pattern matcher for this category
* @returns The search pattern matcher if any
*
* @remarks The matcher is never replaced, it only changes internally, so there is no need to subscribe to changes
*/
getSearchPatternMatcher(): ISimpleSearchPatternMatcher;
/**
* Retrieves the data of this category
* @param hook The hook to subscribe to changes
* @returns All the data of the category
*/
getData(hook?: IDataHook): INoteCategoryMetadata;
/**
* Retrieves the default color for notes in this category
* @param hook The hook to subscribe to changes
* @returns The color of the note
*/
getColor(hook?: IDataHook): string;
/**
* Retrieves the default font size for notes in this category
* @param hook The hook to subscribe to changes
* @returns The font size of the note
*/
getFontSize(hook?: IDataHook): number;
/**
* Retrieves the default syntax mode for notes in this category
* @param hook The hook to subscribe to changes
* @returns The syntax mode of the note
*/
getSyntaxMode(hook?: IDataHook): IHighlightLanguage;
/**
* Retrieves the default value of whether to show rich content for notes in this category
* @param hook The hook to subscribe to changes
* @returns Whether to show rich content
*/
getShowRichContent(hook?: IDataHook): boolean;
/**
* Retrieves the default value of whether to search the content for notes in this category
* @param hook The hook to subscribe to changes
* @returns Whether to search content
*/
getSearchContent(hook?: IDataHook): boolean;
/**
* Updates the category's name
* @param name The new name of the category
*/
setName(name: string): void;
/**
* Adds a note to this category
* @param note The note to be added
*/
addNote(note: Note): void;
/**
* Deletes the category
*/
delete(): void;
/**
* Sets the search pattern as a text string
* @param pattern The search pattern for this category
* @returns The search pattern if any
*/
setSearchPattern(pattern: string | undefined): void;
/**
* Sets the default color for notes in this category
* @param color The new color of the category
*/
setColor(color: string | IInherit): void;
/**
* Sets the default font size for notes in this category
* @param fontSize The new font size of the category
*/
setFontSize(fontSize: number | IInherit): void;
/**
* Sets the default syntax mode for notes in this category
* @param mode The new syntax mode of the category
*/
setSyntaxMode(mode: IHighlightLanguage | IInherit): void;
/**
* Sets the default for whether to show rich content for notes in this category
* @param showRichContent Whether to show rich content for this category
*/
setShowRichContent(showRichContent: boolean | IInherit): void;
/**
* Sets the default for whether to search content for notes in this category
* @param searchContent Whether to search content for this category
*/
setSearchContent(searchContent: boolean | IInherit): void;
}
//# sourceMappingURL=NoteCategory.d.ts.map