Documentation

This commit is contained in:
squidfunk 2019-11-20 15:37:04 +01:00
parent 89214b1897
commit b711d15dac
4 changed files with 27 additions and 26 deletions

View File

@ -58,35 +58,35 @@ interface WatchOptions {
/** /**
* Set anchor blur * Set anchor blur
* *
* @param anchor - Anchor HTML element * @param el - Anchor element
* @param blur - Anchor blur * @param blur - Anchor blur
*/ */
export function setAnchorBlur( export function setAnchorBlur(
anchor: HTMLAnchorElement, blur: boolean el: HTMLAnchorElement, blur: boolean
): void { ): void {
anchor.setAttribute("data-md-state", blur ? "blur" : "") el.setAttribute("data-md-state", blur ? "blur" : "")
} }
/** /**
* Set sidebar state lock * Set anchor active
* *
* @param anchor - Anchor HTML element * @param el - Anchor element
* @param active - Whether the anchor is active * @param active - Whether the anchor is active
*/ */
export function setAnchorActive( export function setAnchorActive(
anchor: HTMLAnchorElement, active: boolean el: HTMLAnchorElement, active: boolean
): void { ): void {
anchor.classList.toggle("md-nav__link--active", active) el.classList.toggle("md-nav__link--active", active)
} }
/** /**
* Reset anchor * Reset anchor
* *
* @param anchor - Anchor HTML element * @param el - Anchor element
*/ */
export function resetAnchor(anchor: HTMLAnchorElement) { export function resetAnchor(el: HTMLAnchorElement) {
anchor.removeAttribute("data-md-state") el.removeAttribute("data-md-state")
anchor.classList.remove("md-nav__link--active") el.classList.remove("md-nav__link--active")
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -42,22 +42,22 @@ export interface Header {
/** /**
* Set header shadow * Set header shadow
* *
* @param header - Header HTML element * @param el - Header element
* @param shadow - Shadow * @param shadow - Shadow
*/ */
export function setHeaderShadow( export function setHeaderShadow(
header: HTMLElement, shadow: boolean el: HTMLElement, shadow: boolean
): void { ): void {
header.setAttribute("data-md-state", shadow ? "shadow" : "") el.setAttribute("data-md-state", shadow ? "shadow" : "")
} }
/** /**
* Reset header * Reset header
* *
* @param header - Header HTML element * @param el - Header element
*/ */
export function resetHeader(header: HTMLElement): void { export function resetHeader(el: HTMLElement): void {
header.removeAttribute("data-md-state") el.removeAttribute("data-md-state")
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -41,13 +41,14 @@ export type NavigationIndex = Map<HTMLInputElement, HTMLElement>
/** /**
* Set navigation overflow scrolling * Set navigation overflow scrolling
* *
* @param nav - Navigation element * @param el - Navigation element
* @param active - Whether overflow scrolling is active * @param active - Whether overflow scrolling is active
*/ */
export function setNavigationOverflowScrolling( export function setNavigationOverflowScrolling(
nav: HTMLElement, active: boolean el: HTMLElement, active: boolean
): void { ): void {
nav.style.webkitOverflowScrolling = active ? "touch" : "" el.style.background = active ? "yellow" : "" // TODO: hack, temporary
el.style.webkitOverflowScrolling = active ? "touch" : ""
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -55,14 +56,14 @@ export function setNavigationOverflowScrolling(
/** /**
* Create an observable to index all navigation elements * Create an observable to index all navigation elements
* *
* @param nav - Top-level navigation element * @param el - Top-level navigation element
* *
* @return Navigation index observable * @return Navigation index observable
*/ */
export function watchNavigationIndex( export function watchNavigationIndex(
nav: HTMLElement el: HTMLElement
): Observable<NavigationIndex> { ): Observable<NavigationIndex> {
const list = getElements("nav", nav) const list = getElements("nav", el)
/* Build index to map inputs to navigation lists */ /* Build index to map inputs to navigation lists */
const index = new Map<HTMLInputElement, HTMLElement>() const index = new Map<HTMLInputElement, HTMLElement>()

View File

@ -58,7 +58,7 @@ interface WatchOptions {
/** /**
* Set sidebar height * Set sidebar height
* *
* @param el - Sidebar HTML element * @param el - Sidebar element
* @param height - Sidebar height * @param height - Sidebar height
*/ */
export function setSidebarHeight( export function setSidebarHeight(
@ -70,7 +70,7 @@ export function setSidebarHeight(
/** /**
* Set sidebar lock * Set sidebar lock
* *
* @param el - Sidebar HTML element * @param el - Sidebar element
* @param lock - Whether the sidebar is locked * @param lock - Whether the sidebar is locked
*/ */
export function setSidebarLock( export function setSidebarLock(
@ -82,7 +82,7 @@ export function setSidebarLock(
/** /**
* Reset sidebar * Reset sidebar
* *
* @param el - Sidebar HTML element * @param el - Sidebar element
*/ */
export function resetSidebar(el: HTMLElement): void { export function resetSidebar(el: HTMLElement): void {
el.removeAttribute("data-md-state") el.removeAttribute("data-md-state")