mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-22 22:03:35 -04:00
Refactored project structure
This commit is contained in:
@@ -37,7 +37,7 @@ import {
|
||||
import { configuration, feature } from "./_"
|
||||
import {
|
||||
at,
|
||||
getElement,
|
||||
getOptionalElement,
|
||||
requestJSON,
|
||||
setToggle,
|
||||
watchDocument,
|
||||
@@ -96,6 +96,7 @@ const keyboard$ = watchKeyboard()
|
||||
const viewport$ = watchViewport()
|
||||
const tablet$ = watchMedia("(min-width: 960px)")
|
||||
const screen$ = watchMedia("(min-width: 1220px)")
|
||||
const hover$ = watchMedia("(hover)")
|
||||
const print$ = watchPrint()
|
||||
|
||||
/* Retrieve search index, if search is enabled */
|
||||
@@ -139,7 +140,7 @@ keyboard$
|
||||
/* Go to previous page */
|
||||
case "p":
|
||||
case ",":
|
||||
const prev = getElement("[href][rel=prev]")
|
||||
const prev = getOptionalElement("[href][rel=prev]")
|
||||
if (typeof prev !== "undefined")
|
||||
prev.click()
|
||||
break
|
||||
@@ -147,7 +148,7 @@ keyboard$
|
||||
/* Go to next page */
|
||||
case "n":
|
||||
case ".":
|
||||
const next = getElement("[href][rel=next]")
|
||||
const next = getOptionalElement("[href][rel=next]")
|
||||
if (typeof next !== "undefined")
|
||||
next.click()
|
||||
break
|
||||
@@ -197,7 +198,7 @@ const content$ = defer(() => merge(
|
||||
|
||||
/* Content */
|
||||
...getComponentElements("content")
|
||||
.map(el => mountContent(el, { target$, viewport$, print$ })),
|
||||
.map(el => mountContent(el, { target$, viewport$, hover$, print$ })),
|
||||
|
||||
/* Search highlighting */
|
||||
...getComponentElements("content")
|
||||
@@ -250,8 +251,9 @@ 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 observable */
|
||||
window.tablet$ = tablet$ /* Media tablet observable */
|
||||
window.screen$ = screen$ /* Media screen observable */
|
||||
window.hover$ = hover$ /* Media hover observable */
|
||||
window.print$ = print$ /* Media print observable */
|
||||
window.alert$ = alert$ /* Alert subject */
|
||||
window.component$ = component$ /* Component observable */
|
||||
|
||||
Reference in New Issue
Block a user