Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add local test file and support html parsing #8

Merged
merged 4 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 20 additions & 8 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,32 @@ interface TelescopeNode {
depth: number;
telescopicOut: TelescopicOutput;
}
/**
* Modes that designate what form the input text is in and should be interpreted as.
*/
declare enum TextMode {
Text = "text",
Html = "html"
}
declare const TextModeValues: TextMode[];
interface Config {
/**
* Character used to separate entries on the same level. Defaults to a single space (" ")
*/
* Character used to separate entries on the same level. Defaults to a single space (" ")
*/
separator?: string;
/**
* If true, allows sections to expand automatically on mouse over rather than requiring a click.
*/
* If true, allows sections to expand automatically on mouse over rather than requiring a click.
*/
shouldExpandOnMouseOver?: boolean;
/**
* A mode that designates what form the input text is in and should be interpreted as.
*/
textMode?: TextMode;
}
declare const DefaultConfig: Config;
declare type CreateTelescopicTextConfig = Pick<Config, "shouldExpandOnMouseOver" | "textMode">;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pick<T> is so big brain here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 🧠

declare let _lastHoveredTime: number;
declare function _hydrate(line: Content, node: any, shouldExpandOnMouseOver?: boolean): void;
declare function _createTelescopicText(content: Content[], shouldExpandOnMouseOver?: boolean): HTMLDivElement;
declare function _hydrate(line: Content, node: any, config?: CreateTelescopicTextConfig): void;
declare function _createTelescopicText(content: Content[], config?: CreateTelescopicTextConfig): HTMLDivElement;
/*****************/
/*****************/
declare function _parseMarkdown(mdContent: string): TelescopicOutput;
Expand All @@ -43,4 +55,4 @@ declare function _parseMarkdownIntoContent(mdContent: string, separator?: string
* @param config - Configuration options provided to create interactive, telescopic text.
* @returns HTML div containing the telescoping text.
*/
declare function createTelescopicTextFromBulletedList(listContent: string, { separator, shouldExpandOnMouseOver }?: Config): HTMLDivElement;
declare function createTelescopicTextFromBulletedList(listContent: string, { separator, shouldExpandOnMouseOver, textMode, }?: Config): HTMLDivElement;
81 changes: 53 additions & 28 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.