-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bec8e7e
commit f31bd69
Showing
16 changed files
with
427 additions
and
483 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
export default class Renderer { | ||
/** | ||
* @param {{content: HTMLElement|Element, page: Document|Node, title: string, wrapper: Element}} props | ||
*/ | ||
constructor({ content, page, title, wrapper }: { | ||
content: HTMLElement | Element; | ||
page: Document | Node; | ||
title: string; | ||
wrapper: Element; | ||
}); | ||
_contentString: string; | ||
_DOM: HTMLDivElement; | ||
page: Node | Document; | ||
title: string; | ||
wrapper: Element; | ||
content: Element; | ||
onEnter(): void; | ||
onEnterCompleted(): void; | ||
onLeave(): void; | ||
onLeaveCompleted(): void; | ||
initialLoad(): void; | ||
update(): void; | ||
createDom(): void; | ||
remove(): void; | ||
/** | ||
* Called when transitioning into the current page. | ||
* @param {Transition} transition | ||
* @param {string|HTMLElement|false} trigger | ||
* @return {Promise<null>} | ||
*/ | ||
enter(transition: Transition, trigger: string | HTMLElement | false): Promise<null>; | ||
/** | ||
* Called when transitioning away from the current page. | ||
* @param {Transition} transition | ||
* @param {string|HTMLElement|false} trigger | ||
* @param {boolean} removeOldContent | ||
* @return {Promise<null>} | ||
*/ | ||
leave(transition: Transition, trigger: string | HTMLElement | false, removeOldContent: boolean): Promise<null>; | ||
} | ||
import Transition from "./Transition"; | ||
export default class Renderer { | ||
/** | ||
* @param {{content: HTMLElement|Element, page: Document|Node, title: string, wrapper: Element}} props | ||
*/ | ||
constructor({ content, page, title, wrapper }: { | ||
content: HTMLElement | Element; | ||
page: Document | Node; | ||
title: string; | ||
wrapper: Element; | ||
}); | ||
_contentString: string; | ||
_DOM: HTMLDivElement; | ||
page: Node | Document; | ||
title: string; | ||
wrapper: Element; | ||
content: Element; | ||
onEnter(): void; | ||
onEnterCompleted(): void; | ||
onLeave(): void; | ||
onLeaveCompleted(): void; | ||
initialLoad(): void; | ||
update(): void; | ||
createDom(): void; | ||
remove(): void; | ||
/** | ||
* Called when transitioning into the current page. | ||
* @param {Transition} transition | ||
* @param {string|HTMLElement|false} trigger | ||
* @return {Promise<null>} | ||
*/ | ||
enter(transition: Transition, trigger: string | HTMLElement | false): Promise<null>; | ||
/** | ||
* Called when transitioning away from the current page. | ||
* @param {Transition} transition | ||
* @param {string|HTMLElement|false} trigger | ||
* @param {boolean} removeOldContent | ||
* @return {Promise<null>} | ||
*/ | ||
leave(transition: Transition, trigger: string | HTMLElement | false, removeOldContent: boolean): Promise<null>; | ||
} | ||
import Transition from "./Transition"; |
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 |
---|---|---|
@@ -1,34 +1,34 @@ | ||
export default class RouteStore { | ||
/** | ||
* @type {Map<string, Map<string, string>>} | ||
*/ | ||
data: Map<string, Map<string, string>>; | ||
/** | ||
* @type {Map<string, RegExp>} | ||
*/ | ||
regexCache: Map<string, RegExp>; | ||
/** | ||
* | ||
* @param {string} fromPattern | ||
* @param {string} toPattern | ||
* @param {string} transition | ||
*/ | ||
add(fromPattern: string, toPattern: string, transition: string): void; | ||
/** | ||
* | ||
* @param {{ raw: string, href: string, hasHash: boolean, pathname: string }} currentUrl | ||
* @param {{ raw: string, href: string, hasHash: boolean, pathname: string }} nextUrl | ||
* @return {string|null} | ||
*/ | ||
findMatch(currentUrl: { | ||
raw: string; | ||
href: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}, nextUrl: { | ||
raw: string; | ||
href: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}): string | null; | ||
} | ||
export default class RouteStore { | ||
/** | ||
* @type {Map<string, Map<string, string>>} | ||
*/ | ||
data: Map<string, Map<string, string>>; | ||
/** | ||
* @type {Map<string, RegExp>} | ||
*/ | ||
regexCache: Map<string, RegExp>; | ||
/** | ||
* | ||
* @param {string} fromPattern | ||
* @param {string} toPattern | ||
* @param {string} transition | ||
*/ | ||
add(fromPattern: string, toPattern: string, transition: string): void; | ||
/** | ||
* | ||
* @param {{ raw: string, href: string, hasHash: boolean, pathname: string }} currentUrl | ||
* @param {{ raw: string, href: string, hasHash: boolean, pathname: string }} nextUrl | ||
* @return {string|null} | ||
*/ | ||
findMatch(currentUrl: { | ||
raw: string; | ||
href: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}, nextUrl: { | ||
raw: string; | ||
href: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}): string | null; | ||
} |
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 |
---|---|---|
@@ -1,43 +1,43 @@ | ||
export default class Transition { | ||
/** | ||
* @param {{wrapper: HTMLElement}} props | ||
*/ | ||
constructor({ wrapper }: { | ||
wrapper: HTMLElement; | ||
}); | ||
wrapper: HTMLElement; | ||
/** | ||
* @param {{ from: HTMLElement|Element, trigger: string|HTMLElement|false }} props | ||
* @return {Promise<void>} | ||
*/ | ||
leave(props: { | ||
from: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
}): Promise<void>; | ||
/** | ||
* @param {{ to: HTMLElement|Element, trigger: string|HTMLElement|false }} props | ||
* @return {Promise<void>} | ||
*/ | ||
enter(props: { | ||
to: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
}): Promise<void>; | ||
/** | ||
* Handle the transition leaving the previous page. | ||
* @param {{from: HTMLElement|Element, trigger: string|HTMLElement|false, done: function}} props | ||
*/ | ||
onLeave({ from, trigger, done }: { | ||
from: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
done: Function; | ||
}): void; | ||
/** | ||
* Handle the transition entering the next page. | ||
* @param {{to: HTMLElement|Element, trigger: string|HTMLElement|false, done: function}} props | ||
*/ | ||
onEnter({ to, trigger, done }: { | ||
to: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
done: Function; | ||
}): void; | ||
} | ||
export default class Transition { | ||
/** | ||
* @param {{wrapper: HTMLElement}} props | ||
*/ | ||
constructor({ wrapper }: { | ||
wrapper: HTMLElement; | ||
}); | ||
wrapper: HTMLElement; | ||
/** | ||
* @param {{ from: HTMLElement|Element, trigger: string|HTMLElement|false }} props | ||
* @return {Promise<void>} | ||
*/ | ||
leave(props: { | ||
from: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
}): Promise<void>; | ||
/** | ||
* @param {{ to: HTMLElement|Element, trigger: string|HTMLElement|false }} props | ||
* @return {Promise<void>} | ||
*/ | ||
enter(props: { | ||
to: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
}): Promise<void>; | ||
/** | ||
* Handle the transition leaving the previous page. | ||
* @param {{from: HTMLElement|Element, trigger: string|HTMLElement|false, done: function}} props | ||
*/ | ||
onLeave({ from, trigger, done }: { | ||
from: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
done: Function; | ||
}): void; | ||
/** | ||
* Handle the transition entering the next page. | ||
* @param {{to: HTMLElement|Element, trigger: string|HTMLElement|false, done: function}} props | ||
*/ | ||
onEnter({ to, trigger, done }: { | ||
to: HTMLElement | Element; | ||
trigger: string | HTMLElement | false; | ||
done: Function; | ||
}): void; | ||
} |
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 |
---|---|---|
@@ -1,50 +1,42 @@ | ||
/** | ||
* Parse a HTML string into a proper Document. | ||
* @param {string|Document} html | ||
* @return {Document|*} | ||
*/ | ||
export function parseDom(html: string | Document): Document | any; | ||
/** | ||
* Extract details from a given URL string. Assumed to be on the current TLD. | ||
* @param {string} url | ||
* @return {{raw: string, href: string, host: string, hasHash: boolean, pathname: string}} | ||
*/ | ||
export function processUrl(url: string): { | ||
raw: string; | ||
href: string; | ||
host: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}; | ||
/** | ||
* Reloads a provided script/stylesheet by replacing with itself. | ||
* @param {HTMLElement|HTMLScriptElement} node | ||
*/ | ||
export function reloadScript(node: HTMLElement | HTMLScriptElement): void; | ||
/** | ||
* Reloads a provided inline-stylesheet by replacing with itself. | ||
* @param {HTMLStyleElement} node | ||
*/ | ||
export function reloadInlineStyle(node: HTMLStyleElement): void; | ||
/** | ||
* Loads a provided script/stylesheet by appending a clone to the current document. | ||
* @param {HTMLElement} node | ||
*/ | ||
export function appendScript(node: HTMLElement): void; | ||
/** | ||
* Loads a provided inline-stylesheet by appending a clone to the current document. | ||
* @param {HTMLStyleElement} node | ||
*/ | ||
export function appendInlineStyle(node: HTMLStyleElement): void; | ||
/** | ||
* Creates a clone of a given HTMLElement | ||
* @param {HTMLElement} node | ||
* @return {HTMLElement} | ||
*/ | ||
export function duplicateScript(node: HTMLElement): HTMLElement; | ||
/** | ||
* Creates a clone of a given HTMLStyleElement | ||
* @param {HTMLStyleElement} node | ||
* @return {HTMLStyleElement} | ||
*/ | ||
export function duplicateInlineStyle(node: HTMLStyleElement): HTMLStyleElement; | ||
/** | ||
* Parse a HTML string into a proper Document. | ||
* | ||
* @param {string|Document} html | ||
* @return {Document|*} | ||
*/ | ||
export function parseDom(html: string | Document): Document | any; | ||
/** | ||
* Extract details from a given URL string. Assumed to be on the current TLD. | ||
* | ||
* @param {string} url | ||
* @return {{raw: string, href: string, host: string, hasHash: boolean, pathname: string}} | ||
*/ | ||
export function processUrl(url: string): { | ||
raw: string; | ||
href: string; | ||
host: string; | ||
hasHash: boolean; | ||
pathname: string; | ||
}; | ||
/** | ||
* Reloads a provided script/stylesheet by replacing with itself. | ||
* | ||
* @param {HTMLElement|HTMLScriptElement|HTMLStyleElement} node | ||
* @param {string} elementType - 'SCRIPT' or 'STYLE' | ||
*/ | ||
export function reloadElement(node: HTMLElement | HTMLScriptElement | HTMLStyleElement, elementType: string): void; | ||
/** | ||
* Loads a provided script/stylesheet by appending a clone to the current document. | ||
* | ||
* @param {HTMLElement|HTMLStyleElement} node | ||
* @param {string} elementType - 'SCRIPT' or 'STYLE' | ||
*/ | ||
export function appendElement(node: HTMLElement | HTMLStyleElement, elementType: string): void; | ||
/** | ||
* Creates a clone of a given HTMLElement or HTMLStyleElement | ||
* | ||
* @param {HTMLElement|HTMLStyleElement} node | ||
* @param {string} elementType - 'SCRIPT' or 'STYLE' | ||
* @return {HTMLElement|HTMLStyleElement} | ||
*/ | ||
export function duplicateElement(node: HTMLElement | HTMLStyleElement, elementType: string): HTMLElement | HTMLStyleElement; |
Oops, something went wrong.