Fixed visibility of exports

This commit is contained in:
squidfunk
2021-02-21 11:59:38 +01:00
parent a2d9eb7aee
commit 4957bb467d
49 changed files with 4707 additions and 192 deletions

View File

@@ -52,7 +52,7 @@ export function watchMedia(query: string): Observable<boolean> {
/**
* Watch print mode, cross-browser
*
* @returns Print observable
* @returns Print mode observable
*/
export function watchPrint(): Observable<void> {
return merge(

View File

@@ -51,7 +51,7 @@ export type Content =
interface MountOptions {
target$: Observable<HTMLElement> /* Location target observable */
viewport$: Observable<Viewport> /* Viewport observable */
print$: Observable<void> /* Print observable */
print$: Observable<void> /* Print mode observable */
}
/* ----------------------------------------------------------------------------

View File

@@ -50,7 +50,7 @@ export interface Details {}
*/
interface WatchOptions {
target$: Observable<HTMLElement> /* Location target observable */
print$: Observable<void> /* Print observable */
print$: Observable<void> /* Print mode observable */
}
/**
@@ -58,7 +58,7 @@ interface WatchOptions {
*/
interface MountOptions {
target$: Observable<HTMLElement> /* Location target observable */
print$: Observable<void> /* Print observable */
print$: Observable<void> /* Print mode observable */
}
/* ----------------------------------------------------------------------------

View File

@@ -75,7 +75,7 @@ import {
document.documentElement.classList.remove("no-js")
document.documentElement.classList.add("js")
/* Set up navigation observables */
/* Set up navigation observables and subjects */
const document$ = watchDocument()
const location$ = watchLocation()
const target$ = watchLocationTarget()
@@ -196,15 +196,16 @@ const component$ = document$
/* Subscribe to all components */
component$.subscribe()
/* Export to window */
export {
document$,
location$,
target$,
keyboard$,
viewport$,
tablet$,
screen$,
print$,
component$
}
/* ----------------------------------------------------------------------------
* Exports
* ------------------------------------------------------------------------- */
window.document$ = document$ /* Document observable */
window.location$ = location$ /* Location subject */
window.target$ = target$ /* Location target observable */
window.keyboard$ = keyboard$ /* Keyboard observable */
window.viewport$ = viewport$ /* Viewport observable */
window.tablet$ = tablet$ /* Tablet observable */
window.screen$ = screen$ /* Screen observable */
window.print$ = print$ /* Print mode observable */
window.component$ = component$ /* Component observable */

View File

@@ -128,9 +128,6 @@ function difference(a: string[], b: string[]): string[] {
/**
* Search index
*
* Note that `lunr` is injected via Webpack, as it will otherwise also be
* bundled in the application bundle.
*/
export class Search {
@@ -139,8 +136,8 @@ export class Search {
*
* A mapping of URLs (including hash fragments) to the actual articles and
* sections of the documentation. The search document mapping must be created
* regardless of whether the index was prebuilt or not, as `lunr` itself will
* only store the actual index.
* regardless of whether the index was prebuilt or not, as Lunr.js itself
* only stores the actual index.
*/
protected documents: SearchDocumentMap
@@ -150,7 +147,7 @@ export class Search {
protected highlight: SearchHighlightFactoryFn
/**
* The underlying `lunr` search index
* The underlying Lunr.js search index
*/
protected index: lunr.Index

View File

@@ -44,7 +44,7 @@ export type SearchTransformFn = (value: string) => string
* that the resulting document must contain all terms, converting the query
* to an `AND` query (as opposed to the default `OR` behavior). While users
* may expect terms enclosed in quotation marks to map to span queries, i.e.
* for which order is important, `lunr` doesn't support them, so the best
* for which order is important, Lunr.js doesn't support them, so the best
* we can do is to convert the terms to an `AND` query.
*
* 2. Replace control characters which are not located at the beginning of the

View File

@@ -85,7 +85,7 @@ function setupSearchIndex(
* Set up search worker
*
* This function will create a web worker to set up and query the search index
* which is done using `lunr`. The index must be passed as an observable to
* which is done using Lunr.js. The index must be passed as an observable to
* enable hacks like _localsearch_ via search index embedding as JSON.
*
* @param url - Worker URL

View File

@@ -20,7 +20,7 @@
* IN THE SOFTWARE.
*/
import "lunr"
import lunr from "lunr"
import { Search, SearchIndexConfig } from "../../_"
import {
@@ -148,6 +148,10 @@ export async function handler(
* Worker
* ------------------------------------------------------------------------- */
/* @ts-ignore - expose Lunr.js in global scope, or stemmers will not work */
self.lunr = lunr
/* Handle messages */
addEventListener("message", async ev => {
postMessage(await handler(ev.data))
})