mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-01 02:08:46 -04:00
Migrated to ESLint
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
import { Observable, merge } from "rxjs"
|
||||
|
||||
import { getElements, Viewport } from "~/browser"
|
||||
import { Viewport, getElements } from "~/browser"
|
||||
|
||||
import { Component } from "../../_"
|
||||
import { CodeBlock, mountCodeBlock } from "../code"
|
||||
@@ -64,7 +64,7 @@ interface MountOptions {
|
||||
* @param el - Content element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Content component observable
|
||||
* @returns Content component observable
|
||||
*/
|
||||
export function mountContent(
|
||||
el: HTMLElement, { target$, viewport$, print$ }: MountOptions
|
||||
|
||||
@@ -32,9 +32,9 @@ import {
|
||||
|
||||
import { resetFocusable, setFocusable } from "~/actions"
|
||||
import {
|
||||
Viewport,
|
||||
getElementContentSize,
|
||||
getElementSize,
|
||||
Viewport,
|
||||
watchMedia
|
||||
} from "~/browser"
|
||||
import { renderClipboardButton } from "~/templates"
|
||||
@@ -89,7 +89,7 @@ let index = 0
|
||||
* @param el - Code block element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Code block observable
|
||||
* @returns Code block observable
|
||||
*/
|
||||
export function watchCodeBlock(
|
||||
el: HTMLElement, { viewport$ }: WatchOptions
|
||||
@@ -117,7 +117,7 @@ export function watchCodeBlock(
|
||||
* @param el - Code block element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Code block component observable
|
||||
* @returns Code block component observable
|
||||
*/
|
||||
export function mountCodeBlock(
|
||||
el: HTMLElement, options: MountOptions
|
||||
|
||||
@@ -71,7 +71,7 @@ interface MountOptions {
|
||||
* @param el - Details element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Details observable
|
||||
* @returns Details observable
|
||||
*/
|
||||
export function watchDetails(
|
||||
el: HTMLDetailsElement, { target$, print$ }: WatchOptions
|
||||
@@ -94,7 +94,7 @@ export function watchDetails(
|
||||
* @param el - Details element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Details component observable
|
||||
* @returns Details component observable
|
||||
*/
|
||||
export function mountDetails(
|
||||
el: HTMLDetailsElement, options: MountOptions
|
||||
|
||||
@@ -54,7 +54,7 @@ const sentinel = createElement("table")
|
||||
*
|
||||
* @param el - Data table element
|
||||
*
|
||||
* @return Data table component observable
|
||||
* @returns Data table component observable
|
||||
*/
|
||||
export function mountDataTable(
|
||||
el: HTMLElement
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
import {
|
||||
Observable,
|
||||
Subject,
|
||||
merge,
|
||||
animationFrameScheduler,
|
||||
merge,
|
||||
of
|
||||
} from "rxjs"
|
||||
import {
|
||||
@@ -81,10 +81,10 @@ interface MountOptions {
|
||||
/**
|
||||
* Watch dialog
|
||||
*
|
||||
* @param el - Dialog element
|
||||
* @param _el - Dialog element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Dialog observable
|
||||
* @returns Dialog observable
|
||||
*/
|
||||
export function watchDialog(
|
||||
_el: HTMLElement, { message$ }: WatchOptions
|
||||
@@ -102,14 +102,13 @@ export function watchDialog(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mount dialog
|
||||
*
|
||||
* @param el - Dialog element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Dialog component observable
|
||||
* @returns Dialog component observable
|
||||
*/
|
||||
export function mountDialog(
|
||||
el: HTMLElement, { message$ }: MountOptions
|
||||
|
||||
@@ -20,7 +20,13 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, defer, of, Subject, animationFrameScheduler } from "rxjs"
|
||||
import {
|
||||
Observable,
|
||||
Subject,
|
||||
animationFrameScheduler,
|
||||
defer,
|
||||
of
|
||||
} from "rxjs"
|
||||
import {
|
||||
combineLatestWith,
|
||||
distinctUntilChanged,
|
||||
@@ -70,7 +76,7 @@ interface MountOptions {
|
||||
*
|
||||
* @param el - Header element
|
||||
*
|
||||
* @return Header observable
|
||||
* @returns Header observable
|
||||
*/
|
||||
export function watchHeader(
|
||||
el: HTMLElement
|
||||
@@ -106,7 +112,7 @@ export function watchHeader(
|
||||
* @param el - Header element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Header component observable
|
||||
* @returns Header component observable
|
||||
*/
|
||||
export function mountHeader(
|
||||
el: HTMLElement, { header$, main$ }: MountOptions
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, animationFrameScheduler, Subject } from "rxjs"
|
||||
import { Observable, Subject, animationFrameScheduler } from "rxjs"
|
||||
import {
|
||||
distinctUntilKeyChanged,
|
||||
finalize,
|
||||
@@ -84,7 +84,7 @@ interface MountOptions {
|
||||
* @param el - Heading element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Header title observable
|
||||
* @returns Header title observable
|
||||
*/
|
||||
export function watchHeaderTitle(
|
||||
el: HTMLHeadingElement, { viewport$, header$ }: WatchOptions
|
||||
@@ -107,7 +107,7 @@ export function watchHeaderTitle(
|
||||
* @param el - Header title element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Header title component observable
|
||||
* @returns Header title component observable
|
||||
*/
|
||||
export function mountHeaderTitle(
|
||||
el: HTMLElement, options: MountOptions
|
||||
|
||||
@@ -75,7 +75,7 @@ interface WatchOptions {
|
||||
* @param el - Main area element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Main area observable
|
||||
* @returns Main area observable
|
||||
*/
|
||||
export function watchMain(
|
||||
el: HTMLElement, { viewport$, header$ }: WatchOptions
|
||||
|
||||
@@ -25,11 +25,15 @@ import { filter, sample, take } from "rxjs/operators"
|
||||
|
||||
import { configuration } from "~/_"
|
||||
import { getElementOrThrow } from "~/browser"
|
||||
import { isSearchQueryMessage, isSearchReadyMessage, setupSearchWorker } from "~/integrations"
|
||||
import {
|
||||
isSearchQueryMessage,
|
||||
isSearchReadyMessage,
|
||||
setupSearchWorker
|
||||
} from "~/integrations"
|
||||
|
||||
import { Component } from "../../_"
|
||||
import { mountSearchQuery, SearchQuery } from "../query"
|
||||
import { mountSearchResult, SearchResult } from "../result"
|
||||
import { SearchQuery, mountSearchQuery } from "../query"
|
||||
import { SearchResult, mountSearchResult } from "../result"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Types
|
||||
@@ -51,7 +55,7 @@ export type Search =
|
||||
*
|
||||
* @param url - Search index URL
|
||||
*
|
||||
* @return Promise resolving with search index
|
||||
* @returns Promise resolving with search index
|
||||
*/
|
||||
function fetchSearchIndex(url: string) {
|
||||
return __search?.index || fetch(url, { credentials: "same-origin" })
|
||||
@@ -67,7 +71,7 @@ function fetchSearchIndex(url: string) {
|
||||
*
|
||||
* @param el - Search element
|
||||
*
|
||||
* @return Search component observable
|
||||
* @returns Search component observable
|
||||
*/
|
||||
export function mountSearch(
|
||||
el: HTMLElement
|
||||
|
||||
@@ -49,10 +49,10 @@ import {
|
||||
watchElementFocus
|
||||
} from "~/browser"
|
||||
import {
|
||||
defaultTransform,
|
||||
SearchWorker,
|
||||
SearchMessageType,
|
||||
SearchQueryMessage,
|
||||
SearchMessageType
|
||||
SearchWorker,
|
||||
defaultTransform
|
||||
} from "~/integrations"
|
||||
|
||||
import { Component } from "../../_"
|
||||
@@ -80,9 +80,8 @@ export interface SearchQuery {
|
||||
* is delayed by `1ms` so the input's empty state is allowed to propagate.
|
||||
*
|
||||
* @param el - Search query element
|
||||
* @param transform - Transformation function
|
||||
*
|
||||
* @return Search query observable
|
||||
* @returns Search query observable
|
||||
*/
|
||||
export function watchSearchQuery(
|
||||
el: HTMLInputElement
|
||||
@@ -113,9 +112,8 @@ export function watchSearchQuery(
|
||||
*
|
||||
* @param el - Search query element
|
||||
* @param worker - Search worker
|
||||
* @param transform - Transformation function
|
||||
*
|
||||
* @return Search query component observable
|
||||
* @returns Search query component observable
|
||||
*/
|
||||
export function mountSearchQuery(
|
||||
el: HTMLInputElement, { tx$ }: SearchWorker
|
||||
|
||||
@@ -80,7 +80,7 @@ interface MountOptions {
|
||||
* @param worker - Search worker
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Search result list component observable
|
||||
* @returns Search result list component observable
|
||||
*/
|
||||
export function mountSearchResult(
|
||||
el: HTMLElement, { rx$ }: SearchWorker, { query$ }: MountOptions
|
||||
|
||||
@@ -95,7 +95,7 @@ interface MountOptions {
|
||||
* @param el - Sidebar element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Sidebar observable
|
||||
* @returns Sidebar observable
|
||||
*/
|
||||
export function watchSidebar(
|
||||
el: HTMLElement, { viewport$, main$ }: WatchOptions
|
||||
@@ -129,7 +129,7 @@ export function watchSidebar(
|
||||
* @param el - Sidebar element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Sidebar component observable
|
||||
* @returns Sidebar component observable
|
||||
*/
|
||||
export function mountSidebar(
|
||||
el: HTMLElement, { header$, ...options }: MountOptions
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, Subject, defer, of, NEVER } from "rxjs"
|
||||
import { NEVER, Observable, Subject, defer, of } from "rxjs"
|
||||
import {
|
||||
catchError,
|
||||
filter,
|
||||
@@ -35,10 +35,7 @@ import { renderSourceFacts } from "~/templates"
|
||||
import { hash } from "~/utilities"
|
||||
|
||||
import { Component } from "../../_"
|
||||
import {
|
||||
fetchSourceFacts,
|
||||
SourceFacts
|
||||
} from "../facts"
|
||||
import { SourceFacts, fetchSourceFacts } from "../facts"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Types
|
||||
@@ -69,7 +66,7 @@ let fetch$: Observable<Source>
|
||||
*
|
||||
* @param el - Repository information element
|
||||
*
|
||||
* @return Repository information observable
|
||||
* @returns Repository information observable
|
||||
*/
|
||||
export function watchSource(
|
||||
el: HTMLAnchorElement
|
||||
@@ -108,7 +105,7 @@ export function watchSource(
|
||||
*
|
||||
* @param el - Repository information element
|
||||
*
|
||||
* @return Repository information component observable
|
||||
* @returns Repository information component observable
|
||||
*/
|
||||
export function mountSource(
|
||||
el: HTMLAnchorElement
|
||||
|
||||
@@ -43,7 +43,7 @@ export type SourceFacts = string[]
|
||||
*
|
||||
* @param url - Repository URL
|
||||
*
|
||||
* @return Repository facts observable
|
||||
* @returns Repository facts observable
|
||||
*/
|
||||
export function fetchSourceFacts(
|
||||
url: string
|
||||
@@ -53,12 +53,12 @@ export function fetchSourceFacts(
|
||||
|
||||
/* GitHub repository */
|
||||
case "github":
|
||||
const [, user, repo] = url.match(/^.+github\.com\/([^\/]+)\/?([^\/]+)?/i)!
|
||||
const [, user, repo] = url.match(/^.+github\.com\/([^/]+)\/?([^/]+)?/i)!
|
||||
return fetchSourceFactsFromGitHub(user, repo)
|
||||
|
||||
/* GitLab repository */
|
||||
case "gitlab":
|
||||
const [, base, slug] = url.match(/^.+?([^\/]*gitlab[^\/]+)\/(.+?)\/?$/i)!
|
||||
const [, base, slug] = url.match(/^.+?([^/]*gitlab[^/]+)\/(.+?)\/?$/i)!
|
||||
return fetchSourceFactsFromGitLab(base, slug)
|
||||
|
||||
/* Everything else */
|
||||
|
||||
@@ -43,7 +43,7 @@ import { SourceFacts } from "../_"
|
||||
* @param user - GitHub user
|
||||
* @param repo - GitHub repository
|
||||
*
|
||||
* @return Repository facts observable
|
||||
* @returns Repository facts observable
|
||||
*/
|
||||
export function fetchSourceFactsFromGitHub(
|
||||
user: string, repo?: string
|
||||
|
||||
@@ -43,7 +43,7 @@ import { SourceFacts } from "../_"
|
||||
* @param base - GitLab base
|
||||
* @param project - GitLab project
|
||||
*
|
||||
* @return Repository facts observable
|
||||
* @returns Repository facts observable
|
||||
*/
|
||||
export function fetchSourceFactsFromGitLab(
|
||||
base: string, project: string
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, animationFrameScheduler, Subject } from "rxjs"
|
||||
import { Observable, Subject, animationFrameScheduler } from "rxjs"
|
||||
import {
|
||||
distinctUntilKeyChanged,
|
||||
finalize,
|
||||
@@ -76,7 +76,7 @@ interface MountOptions {
|
||||
* @param el - Navigation tabs element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Navigation tabs observable
|
||||
* @returns Navigation tabs observable
|
||||
*/
|
||||
export function watchTabs(
|
||||
el: HTMLElement, { viewport$, header$ }: WatchOptions
|
||||
@@ -98,7 +98,7 @@ export function watchTabs(
|
||||
* @param el - Navigation tabs element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Navigation tabs component observable
|
||||
* @returns Navigation tabs component observable
|
||||
*/
|
||||
export function mountTabs(
|
||||
el: HTMLElement, options: MountOptions
|
||||
|
||||
@@ -46,9 +46,9 @@ import {
|
||||
setAnchorState
|
||||
} from "~/actions"
|
||||
import {
|
||||
Viewport,
|
||||
getElement,
|
||||
getElements,
|
||||
Viewport,
|
||||
watchElementSize
|
||||
} from "~/browser"
|
||||
|
||||
@@ -109,7 +109,7 @@ interface MountOptions {
|
||||
* @param anchors - Anchor elements
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Table of contents observable
|
||||
* @returns Table of contents observable
|
||||
*/
|
||||
export function watchTableOfContents(
|
||||
anchors: HTMLAnchorElement[], { viewport$, header$ }: WatchOptions
|
||||
@@ -236,7 +236,7 @@ export function watchTableOfContents(
|
||||
* @param el - Anchor list element
|
||||
* @param options - Options
|
||||
*
|
||||
* @return Table of contents component observable
|
||||
* @returns Table of contents component observable
|
||||
*/
|
||||
export function mountTableOfContents(
|
||||
el: HTMLElement, options: MountOptions
|
||||
|
||||
Reference in New Issue
Block a user