-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: supports plugins to customize layout and rendering (#20)
Exposes plugin model to allow users to extend, closes #17 Adds support for HTML blockquote element Updates several dependencies including major breaking change updates to [htmlparser2](https://github.com/fb55/htmlparser2) BREAKING CHANGE: `HtmlNode.name` => `HtmlNode.tagName` to be compatible with htmlparser2's v4.0.0 types update
- Loading branch information
1 parent
daec3b0
commit 6e41bbf
Showing
38 changed files
with
1,405 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export interface LayoutContext { | ||
/** | ||
* Returns the specified stack. | ||
* If the stack is not yet created it will return an empty stack. | ||
* @param stackName The stack name (state key) to retrieve. | ||
*/ | ||
getStateStack<TValue>(stackName: string): TValue[] | ||
/** | ||
* Pushes the specified state onto the specified stack. | ||
* If the stack does not yet exist, it will be created and the value pushed onto it. | ||
* NOTE: If you want to evaluate the stack itself, use @see getStateStack and it will return the stack. | ||
* @param stackName The ´key/name of the stack to push the value onto. | ||
* @param value The value to push onto the top of the stack. | ||
*/ | ||
pushState<TValue>(stackName: string, value: TValue): void | ||
/** | ||
* Pops the top value from the specified stack and returns it. | ||
* If the stack doesn't exist or is empty @see undefined is returned. | ||
* @param stackName The key/name of the stack to pop the value from. | ||
*/ | ||
popState<TValue>(stackName: string): TValue | undefined | ||
/** | ||
* Returns the top value from the specified stack without removing it from the stack. | ||
* @param stackName The key/name of the stack to peek at. | ||
*/ | ||
peekState<TValue>(stackName: string): TValue | undefined | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CssBox, HtmlNode, LayoutContext } from "." | ||
import { CssBoxFactoryFunc } from "./css/layout/CssBoxFactory" | ||
|
||
export interface LayoutManager { | ||
/** | ||
* Creates a new @see CssBox instance. | ||
*/ | ||
createBox: CssBoxFactoryFunc | ||
/** | ||
* Lays out a set of @see CssBox objects for the specified HTML elements. | ||
*/ | ||
layout(context: LayoutContext, elements: HtmlNode[]): CssBox[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.