mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-04-05 08:53:57 -04:00
Merged features tied to Carolina Reaper funding goal
This commit is contained in:
20
typings/_/index.d.ts
vendored
20
typings/_/index.d.ts
vendored
@@ -24,33 +24,13 @@ import { Observable, Subject } from "rxjs"
|
||||
|
||||
import { Keyboard, Viewport } from "~/browser"
|
||||
import { Component } from "~/components"
|
||||
import {
|
||||
SearchIndex,
|
||||
SearchTransformFn
|
||||
} from "~/integrations"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Global types
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Global search configuration
|
||||
*/
|
||||
export interface GlobalSearchConfig {
|
||||
transform?: SearchTransformFn /* Transformation function */
|
||||
index?: Promise<SearchIndex> /* Alternate index */
|
||||
worker?: string /* Alternate worker URL */
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
declare global {
|
||||
|
||||
/**
|
||||
* Global search configuration
|
||||
*/
|
||||
const __search: GlobalSearchConfig | undefined
|
||||
|
||||
/**
|
||||
* Compute hash from the given string
|
||||
*
|
||||
|
||||
114
typings/lunr/index.d.ts
vendored
114
typings/lunr/index.d.ts
vendored
@@ -27,5 +27,117 @@ import lunr from "lunr"
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
declare global {
|
||||
const lunr: typeof lunr /* Global Lunr.js namespace */
|
||||
namespace lunr {
|
||||
|
||||
/**
|
||||
* Index - expose inverted index
|
||||
*/
|
||||
interface Index {
|
||||
invertedIndex: Record<string, unknown>
|
||||
fields: string[] // @todo: make typing generic?
|
||||
}
|
||||
|
||||
interface Builder {
|
||||
field(
|
||||
fieldName: string,
|
||||
attributes?: {
|
||||
boost?: number | undefined,
|
||||
extractor?: Function
|
||||
}): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query parser
|
||||
*/
|
||||
class QueryParser {
|
||||
constructor(value: string, query: Query)
|
||||
public parse(): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Query clause - add missing field definitions
|
||||
*/
|
||||
namespace Query {
|
||||
interface Clause {
|
||||
presence: Query.presence
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenizer
|
||||
*/
|
||||
namespace tokenizer {
|
||||
let table: number[][]
|
||||
}
|
||||
|
||||
/**
|
||||
* Lexeme type
|
||||
*/
|
||||
const enum LexemeType {
|
||||
FIELD = "FIELD",
|
||||
TERM = "TERM",
|
||||
PRESENCE = "PRESENCE"
|
||||
}
|
||||
|
||||
/**
|
||||
* Lexeme
|
||||
*/
|
||||
interface Lexeme {
|
||||
type: LexemeType
|
||||
str: string
|
||||
start: number
|
||||
end: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Query lexer - add missing class definitions
|
||||
*/
|
||||
class QueryLexer {
|
||||
|
||||
/**
|
||||
* Create query lexer
|
||||
*
|
||||
* @param query - Query
|
||||
*/
|
||||
constructor(query: string)
|
||||
|
||||
/**
|
||||
* Query lexemes
|
||||
*/
|
||||
public lexemes: Lexeme[]
|
||||
|
||||
/**
|
||||
* Lex query
|
||||
*/
|
||||
public run(): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable multi-language support
|
||||
*
|
||||
* @param lang - Languages
|
||||
*
|
||||
* @returns Plugin
|
||||
*/
|
||||
function multiLanguage(...lang: string[]): Builder.Plugin
|
||||
|
||||
/**
|
||||
* Stopword filter
|
||||
*
|
||||
* @template T - Token type
|
||||
*
|
||||
* @param token - Token or string
|
||||
*
|
||||
* @returns Token or nothing
|
||||
*/
|
||||
function stopWordFilter<T>(token: T): T | undefined;
|
||||
|
||||
/**
|
||||
* Segmenter for Japanese
|
||||
*/
|
||||
class TinySegmenter {
|
||||
public ctype_(value: string): string
|
||||
public segment(value: string): string[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user