1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +01:00

Added polyfills for unfetch, URL, Object.entries and Element.scrollTo

This commit is contained in:
squidfunk 2022-01-06 20:57:06 +01:00
parent 0a25f757f4
commit 0bd5ff2741
22 changed files with 126 additions and 60 deletions

View File

@ -1 +1 @@
last 2 years
last 4 years

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

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.43b2f457.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.9d8e7b00.min.css' | url }}">
{% if config.theme.palette %}
{% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.e6a45f82.min.css' | url }}">
@ -213,7 +213,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.9e2e17ab.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.98f77802.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":["src/overrides/assets/stylesheets/main/_typeset.scss","../../../../src/overrides/assets/stylesheets/main.scss","src/assets/stylesheets/utilities/_break.scss","src/overrides/assets/stylesheets/main/layout/_banner.scss","src/overrides/assets/stylesheets/main/layout/_hero.scss","src/overrides/assets/stylesheets/main/layout/_iconsearch.scss","src/overrides/assets/stylesheets/main/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,6BACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CDoBA,qBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qB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A,CACA,8BAAA,CAHA,iBAAA,CAIA,2BJgIJ,CI7HI,2EAEE,8BJ8HN,CI1HI,sCACE,qCAAA,CACA,eJ4HN,CIzHM,mEACE,kCJ2HR,CIrHE,mCAIE,kCAAA,CAAA,0BAAA,CAHA,eAAA,CACA,eAAA,CAKA,+DAAA,CADA,oBAAA,CADA,kBJwHJ,CInHI,sDAEE,YAAA,CADA,WJsHN,CIjHI,4DACE,oDJmHN,CIhHM,kEACE,0CJkHR,CI7GI,yCAIE,yCAAA,CACA,gBAAA,CAJA,iBAAA,CAEA,WAAA,CADA,SJkHN,CI3GI,yCAGE,eAAA,CAFA,QAAA,CACA,SJ8GN,CIzGI,yCAGE,+DAAA,CAFA,QAAA,CACA,mBJ4GN,CIxGM,oDACE,kBJ0GR,CItGM,2CACE,kBJwGR,CIpGM,6CAEE,YAAA,CADA,WJuGR,CInGQ,0FACE,gBJsGV,CK7LI,2BACE,YAAA,CACA,iBLgMN,CK5LI,6BACE,cL8LN,CK1LI,sCACE,YAAA,CACA,cAAA,CACA,sBL4LN,CKzLM,wCACE,aAAA,CACA,aL2LR,CKlLI,mCACE,YLoLN,CKjLM,yCAEE,UAAA,CACA,UAAA,CAFA,aLqLR,CK9KI,mCAOE,kBAAA,CANA,aAAA,CACA,UAAA,CAEA,aAAA,CACA,YAAA,CACA,eAAA,CAEA,kBAAA,CACA,sCACE,CAPF,YLsLN,CK3KM,kFAEE,oBL4KR,CKzKQ,0FACE,mBL2KV,CKtKM,4CAME,+CAAA,CALA,yCAAA,CAEA,eAAA,CADA,eAAA,CAEA,kBAAA,CACA,iBLyKR,CKpKM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,ULyKR,CKhKE,oCACE,eLkKJ,CK9JE,sEAEE,eLgKJ","file":"main.css"}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"version":3,"sources":["src/overrides/assets/stylesheets/main/_typeset.scss","../../../../src/overrides/assets/stylesheets/main.scss","src/assets/stylesheets/utilities/_break.scss","src/overrides/assets/stylesheets/main/layout/_banner.scss","src/overrides/assets/stylesheets/main/layout/_hero.scss","src/overrides/assets/stylesheets/main/layout/_iconsearch.scss","src/overrides/assets/stylesheets/main/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,6BACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CDoBA,qBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qBACE,aCxCJ,CD4CE,uBACE,UC1CJ,CD6CI,8BAGE,QAAA,CACA,sBAAA,CAHA,iBAAA,CACA,UCzCN,CD+CI,8BAOE,WAAA,CAFA,WAAA,CAFA,MAAA,CAGA,eAAA,CALA,iBAAA,CACA,KAAA,CAEA,UC1CN,CDkDE,uBACE,uCAAA,CAAA,+BChDJ,CDoDE,0BACE,aClDJ,CDsDE,+BACE,cAAA,CACA,uBCpDJ,CDuDI,0EAEE,WCtDN,CD0DI,oCAGE,2CAAA,CADA,gCAAA,CADA,aCtDN,CD6DE,4BACE,UAAA,CACA,uBC3DJ,CD8DI,2EAEE,SC7DN,CDqEI,wDAEE,cAAA,CAAA,cCnEN,CC2JI,wCF1FA,wDAMI,oBAAA,CAAA,eClEN,CACF,CDsEI,4BACE,8BAAA,CAAA,kBCpEN,CDyEE,wBACE,YAAA,CACA,gBCvEJ,CD0EI,4BAEE,kBAAA,CADA,WCvEN,CD+EM,sCACE,aAAA,CACA,kBC7ER,CDiFM,+BACE,aC/ER,CEnDE,mDAGE,kBFsDJ,CElDE,kBACE,kBFoDJ,CEhDE,8BACE,gBFkDJ,CEnDE,8BACE,iBFkDJ,CGlEA,eAEE,uYACE,CAFF,gBHsEF,CG3DE,4CACE,yYH6DJ,CGjDA,UAEE,gCAAA,CADA,cHqDF,CGjDE,aAEE,kBAAA,CACA,eAAA,CAFA,kBHqDJ,CCqGI,wCE3JF,aAOI,gBHmDJ,CACF,CG/CE,mBACE,mBHiDJ,CC0EI,mCE7IJ,UAwB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,mBL2KV,CKtKM,4CAME,+CAAA,CALA,yCAAA,CAEA,eAAA,CADA,eAAA,CAEA,kBAAA,CACA,iBLyKR,CKpKM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,ULyKR,CKhKE,oCACE,eLkKJ,CK9JE,sEAEE,eLgKJ","file":"main.css"}

View File

@ -3,7 +3,7 @@
-#}
{% extends "base.html" %}
{% block extrahead %}
<link rel="stylesheet" href="{{ 'overrides/assets/stylesheets/main.d8956580.min.css' | url }}">
<link rel="stylesheet" href="{{ 'overrides/assets/stylesheets/main.de86b20e.min.css' | url }}">
{% endblock %}
{% block announce %}
<a href="https://twitter.com/squidfunk">

View File

@ -1,4 +1,4 @@
{#-
This file was automatically generated - do not edit
-#}
<script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)</script>
<script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>

10
package-lock.json generated
View File

@ -9492,6 +9492,11 @@
"which-boxed-primitive": "^1.0.2"
}
},
"unfetch": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz",
"integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA=="
},
"unherit": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.3.tgz",
@ -9740,6 +9745,11 @@
"prepend-http": "^2.0.0"
}
},
"url-polyfill": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/url-polyfill/-/url-polyfill-1.1.12.tgz",
"integrity": "sha512-mYFmBHCapZjtcNHW0MDq9967t+z4Dmg5CJ0KqysK3+ZbyoNOWQHksGCTWwDhxGXllkWlOc10Xfko6v4a3ucM6A=="
},
"use": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",

View File

@ -45,7 +45,9 @@
"lunr": "^2.3.9",
"lunr-languages": "^1.9.0",
"resize-observer-polyfill": "^1.5.1",
"rxjs": "^7.5.1"
"rxjs": "^7.5.1",
"unfetch": "^4.2.0",
"url-polyfill": "^1.1.12"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",

View File

@ -20,7 +20,6 @@
* IN THE SOFTWARE.
*/
import "focus-visible"
import {
EMPTY,
NEVER,
@ -78,6 +77,7 @@ import {
patchScrollfix,
patchScrolllock
} from "./patches"
import "./polyfills"
/* ----------------------------------------------------------------------------
* Application

View File

@ -117,7 +117,6 @@ export function mountPalette(
/* Set color palette */
for (const [key, value] of Object.entries(palette.color))
if (typeof value === "string")
document.body.setAttribute(`data-md-color-${key}`, value)
/* Toggle visibility */

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2016-2021 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import "focus-visible"
import "unfetch/polyfill"
import "url-polyfill"
/* ----------------------------------------------------------------------------
* Custom polyfills
* ------------------------------------------------------------------------- */
/* Polyfill for `Object.entries` */
if (!Object.entries)
Object.entries = function (obj: object) {
const data: [string, string][] = []
for (const key of Object.keys(obj))
// @ts-expect-error - ignore property access warning
data.push([key, obj[key]])
/* Return entries */
return data
}
/* Polyfill for `Element.scrollTo` */
if (!Element.prototype.scrollTo)
Element.prototype.scrollTo = function (
x?: ScrollToOptions | number, y?: number
): void {
if (typeof x === "object") {
this.scrollLeft = x.left!
this.scrollTop = x.top!
} else {
this.scrollLeft = x!
this.scrollTop = y!
}
}

View File

@ -24,6 +24,6 @@
<script>
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object")
for (var [key, value] of Object.entries(palette.color))
document.body.setAttribute("data-md-color-" + key, value)
for (var key of Object.keys(palette.color))
document.body.setAttribute("data-md-color-" + key, palette.color[key])
</script>