mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved rendering performance by combining upstream observables
This commit is contained in:
2
material/assets/javascripts/bundle.1696ff1a.min.js
vendored
Normal file
2
material/assets/javascripts/bundle.1696ff1a.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.1696ff1a.min.js.map
Normal file
1
material/assets/javascripts/bundle.1696ff1a.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
24
material/assets/javascripts/vendor.0c35f0aa.min.js
vendored
Normal file
24
material/assets/javascripts/vendor.0c35f0aa.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/vendor.0c35f0aa.min.js.map
Normal file
1
material/assets/javascripts/vendor.0c35f0aa.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.7b9051f7.min.js",
|
"assets/javascripts/bundle.js": "assets/javascripts/bundle.1696ff1a.min.js",
|
||||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.7b9051f7.min.js.map",
|
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.1696ff1a.min.js.map",
|
||||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.aad0415a.min.js",
|
"assets/javascripts/vendor.js": "assets/javascripts/vendor.0c35f0aa.min.js",
|
||||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.aad0415a.min.js.map",
|
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.0c35f0aa.min.js.map",
|
||||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.2613054f.min.js",
|
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.2613054f.min.js",
|
||||||
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.2613054f.min.js.map",
|
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.2613054f.min.js.map",
|
||||||
"assets/stylesheets/main.css": "assets/stylesheets/main.822f5098.min.css",
|
"assets/stylesheets/main.css": "assets/stylesheets/main.e81a0042.min.css",
|
||||||
"assets/stylesheets/palette.css": "assets/stylesheets/palette.31180ff2.min.css"
|
"assets/stylesheets/palette.css": "assets/stylesheets/palette.31180ff2.min.css"
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
1
material/assets/stylesheets/main.e81a0042.min.css
vendored
Normal file
1
material/assets/stylesheets/main.e81a0042.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -41,7 +41,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.822f5098.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.e81a0042.min.css' | url }}">
|
||||||
{% if palette.primary or palette.accent %}
|
{% if palette.primary or palette.accent %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.31180ff2.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.31180ff2.min.css' | url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -177,8 +177,8 @@
|
|||||||
<script>var __config={}</script>
|
<script>var __config={}</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/vendor.aad0415a.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/vendor.0c35f0aa.min.js' | url }}"></script>
|
||||||
<script src="{{ 'assets/javascripts/bundle.7b9051f7.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.1696ff1a.min.js' | url }}"></script>
|
||||||
{%- set translations = {} -%}
|
{%- set translations = {} -%}
|
||||||
{%- for key in [
|
{%- for key in [
|
||||||
"clipboard.copy",
|
"clipboard.copy",
|
||||||
|
|||||||
@@ -93,10 +93,13 @@ export function watchViewport(): Observable<Viewport> {
|
|||||||
export function watchViewportAt(
|
export function watchViewportAt(
|
||||||
el: HTMLElement, { header$, viewport$ }: WatchAtOptions
|
el: HTMLElement, { header$, viewport$ }: WatchAtOptions
|
||||||
): Observable<Viewport> {
|
): Observable<Viewport> {
|
||||||
const offset$ = combineLatest([
|
const size$ = viewport$
|
||||||
viewport$.pipe(distinctUntilKeyChanged("size")),
|
.pipe(
|
||||||
header$
|
distinctUntilKeyChanged("size")
|
||||||
])
|
)
|
||||||
|
|
||||||
|
/* Compute element offset */
|
||||||
|
const offset$ = combineLatest([size$, header$])
|
||||||
.pipe(
|
.pipe(
|
||||||
map((): ViewportOffset => ({
|
map((): ViewportOffset => ({
|
||||||
x: el.offsetLeft,
|
x: el.offsetLeft,
|
||||||
|
|||||||
@@ -103,33 +103,25 @@ export function watchMain(
|
|||||||
shareReplay(1)
|
shareReplay(1)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* Compute the main area's visible height */
|
/* Compute the main area's offset, visible height and if we scrolled past */
|
||||||
const height$ = combineLatest([adjust$, marker$, viewport$])
|
return combineLatest([adjust$, marker$, viewport$])
|
||||||
.pipe(
|
.pipe(
|
||||||
map(([header, { top, bottom }, { offset: { y }, size: { height } }]) => {
|
map(([header, { top, bottom }, { offset: { y }, size: { height } }]) => {
|
||||||
return height
|
height = Math.max(0, height
|
||||||
- Math.max(0, top - y, header)
|
- Math.max(0, top - y, header)
|
||||||
- Math.max(0, height + y - bottom)
|
- Math.max(0, height + y - bottom)
|
||||||
}),
|
|
||||||
map(height => Math.max(0, height)),
|
|
||||||
distinctUntilChanged()
|
|
||||||
)
|
)
|
||||||
|
return {
|
||||||
/* Compute whether the viewport offset is past the main area's top */
|
|
||||||
const active$ = combineLatest([adjust$, marker$, viewport$])
|
|
||||||
.pipe(
|
|
||||||
map(([header, { top }, { offset: { y } }]) => y >= top - header),
|
|
||||||
distinctUntilChanged()
|
|
||||||
)
|
|
||||||
|
|
||||||
/* Combine into a single observable */
|
|
||||||
return combineLatest([adjust$, marker$, height$, active$])
|
|
||||||
.pipe(
|
|
||||||
map(([header, { top }, height, active]) => ({
|
|
||||||
offset: top - header,
|
offset: top - header,
|
||||||
height,
|
height,
|
||||||
active
|
active: y >= top - header
|
||||||
}))
|
}
|
||||||
|
}),
|
||||||
|
distinctUntilChanged<Main>((a, b) => {
|
||||||
|
return a.offset === b.offset
|
||||||
|
&& a.height === b.height
|
||||||
|
&& a.active === b.active
|
||||||
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,28 +92,22 @@ export function watchSidebar(
|
|||||||
const adjust = el.parentElement!.offsetTop
|
const adjust = el.parentElement!.offsetTop
|
||||||
- el.parentElement!.parentElement!.offsetTop
|
- el.parentElement!.parentElement!.offsetTop
|
||||||
|
|
||||||
/* Compute the sidebar's available height */
|
/* Compute the sidebar's available height and if it should be locked */
|
||||||
const height$ = combineLatest([main$, viewport$])
|
return combineLatest([main$, viewport$])
|
||||||
.pipe(
|
.pipe(
|
||||||
map(([{ offset, height }, { offset: { y } }]) => (
|
map(([{ offset, height }, { offset: { y } }]) => {
|
||||||
height
|
height = height
|
||||||
+ Math.min(adjust, Math.max(0, y - offset))
|
+ Math.min(adjust, Math.max(0, y - offset))
|
||||||
- adjust
|
- adjust
|
||||||
)),
|
return {
|
||||||
distinctUntilChanged()
|
height,
|
||||||
)
|
lock: y >= offset + adjust
|
||||||
|
}
|
||||||
/* Compute whether the sidebar should be locked */
|
}),
|
||||||
const lock$ = combineLatest([main$, viewport$])
|
distinctUntilChanged<Sidebar>((a, b) => {
|
||||||
.pipe(
|
return a.height === b.height
|
||||||
map(([{ offset }, { offset: { y } }]) => y >= offset + adjust),
|
&& a.lock === b.lock
|
||||||
distinctUntilChanged()
|
})
|
||||||
)
|
|
||||||
|
|
||||||
/* Combine into single observable */
|
|
||||||
return combineLatest([height$, lock$])
|
|
||||||
.pipe(
|
|
||||||
map(([height, lock]) => ({ height, lock }))
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ hr {
|
|||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove gaps in underlined links in iOS >= 8 and Safari >= 8
|
|
||||||
a {
|
|
||||||
-webkit-text-decoration-skip: objects; // stylelint-disable-line
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset tap outlines on iOS and Android
|
// Reset tap outlines on iOS and Android
|
||||||
a,
|
a,
|
||||||
button,
|
button,
|
||||||
@@ -115,7 +110,7 @@ th {
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset (native) button styles
|
// Reset button styles
|
||||||
button {
|
button {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -124,7 +119,7 @@ button {
|
|||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset (native) input styles
|
// Reset input styles
|
||||||
input {
|
input {
|
||||||
border: 0;
|
border: 0;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ kbd {
|
|||||||
.md-typeset {
|
.md-typeset {
|
||||||
font-size: ms(0);
|
font-size: ms(0);
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
|
|
||||||
// Colors should be kept when printing
|
// Colors should be kept when printing
|
||||||
-webkit-print-color-adjust: exact; // stylelint-disable-line
|
-webkit-print-color-adjust: exact; // stylelint-disable-line
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ kbd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inline code blocks, correct relative ems for smaller font size
|
// Inline code blocks
|
||||||
code {
|
code {
|
||||||
margin: 0 px2em(4px, 13.6px);
|
margin: 0 px2em(4px, 13.6px);
|
||||||
padding: px2em(1px, 13.6px) 0;
|
padding: px2em(1px, 13.6px) 0;
|
||||||
@@ -194,17 +193,18 @@ kbd {
|
|||||||
h4 code,
|
h4 code,
|
||||||
h5 code,
|
h5 code,
|
||||||
h6 code {
|
h6 code {
|
||||||
margin: 0;
|
margin: initial;
|
||||||
|
padding: initial;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset code if it's inside a link
|
// Reset code if it's inside a link
|
||||||
a > code {
|
a > code {
|
||||||
margin: inherit;
|
margin: initial;
|
||||||
padding: inherit;
|
padding: initial;
|
||||||
color: inherit;
|
color: initial;
|
||||||
background-color: inherit;
|
background-color: transparent;
|
||||||
border-radius: initial;
|
border-radius: initial;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,10 +116,10 @@
|
|||||||
|
|
||||||
// Reset code inside Admonition titles
|
// Reset code inside Admonition titles
|
||||||
> code {
|
> code {
|
||||||
margin: inherit;
|
margin: initial;
|
||||||
padding: inherit;
|
padding: initial;
|
||||||
color: inherit;
|
color: initial;
|
||||||
background-color: inherit;
|
background-color: transparent;
|
||||||
border-radius: initial;
|
border-radius: initial;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user