Removed ramda dependency to save another 2-3kb

This commit is contained in:
squidfunk 2020-09-27 20:36:18 +02:00
parent 0de55b3cf8
commit 588813e67b
24 changed files with 65 additions and 91 deletions

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

@ -1,14 +1,14 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.02a83bbe.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.02a83bbe.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.186f2b9b.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.186f2b9b.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.68692be8.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.68692be8.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.bdf98b33.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.bdf98b33.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.e0a2b82c.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.e0a2b82c.min.js.map",
"assets/stylesheets/main.css": "assets/stylesheets/main.3d7ab713.min.css",
"assets/stylesheets/main.css.map": "assets/stylesheets/main.3d7ab713.min.css.map",
"assets/stylesheets/overrides.css": "assets/stylesheets/overrides.41a1bb10.min.css",
"assets/stylesheets/overrides.css.map": "assets/stylesheets/overrides.41a1bb10.min.css.map",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.17bd0b03.min.css",
"assets/stylesheets/palette.css.map": "assets/stylesheets/palette.17bd0b03.min.css.map"
"assets/stylesheets/main.css": "assets/stylesheets/main.40703c20.min.css",
"assets/stylesheets/main.css.map": "assets/stylesheets/main.40703c20.min.css.map",
"assets/stylesheets/overrides.css": "assets/stylesheets/overrides.082f5519.min.css",
"assets/stylesheets/overrides.css.map": "assets/stylesheets/overrides.082f5519.min.css.map",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.0eb3995c.min.css",
"assets/stylesheets/palette.css.map": "assets/stylesheets/palette.0eb3995c.min.css.map"
}

View File

@ -1,3 +1,3 @@
.md-typeset .tx-insiders{color:#e91e63}.md-typeset .tx-switch button{cursor:pointer;transition:opacity 250ms}.md-typeset .tx-switch button:hover{opacity:.75}.md-typeset .tx-switch button>code{display:block;color:var(--md-primary-bg-color);background-color:var(--md-primary-fg-color)}.md-typeset .tx-columns{-moz-columns:2;columns:2}.md-typeset .tx-columns>*{-moz-column-break-inside:avoid;break-inside:avoid}.md-announce a,.md-announce a:focus,.md-announce a:hover{color:currentColor}.md-announce strong{white-space:nowrap}.md-announce .twitter{margin-left:.2em;color:#00acee}.tx-container{padding-top:1rem;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1123 258'><path d='M1124,2c0,0 0,256 0,256l-1125,0l0,-48c0,0 16,5 55,5c116,0 197,-92 325,-92c121,0 114,46 254,46c140,0 214,-167 572,-166Z' style='fill: hsla(0, 0%, 100%, 1)' /></svg>") no-repeat bottom,linear-gradient(to bottom, var(--md-primary-fg-color), #a63fd9 99%, var(--md-default-bg-color) 99%)}[data-md-color-scheme=slate] .tx-container{background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1123 258'><path d='M1124,2c0,0 0,256 0,256l-1125,0l0,-48c0,0 16,5 55,5c116,0 197,-92 325,-92c121,0 114,46 254,46c140,0 214,-167 572,-166Z' style='fill: hsla(232, 15%, 21%, 1)' /></svg>") no-repeat bottom,linear-gradient(to bottom, var(--md-primary-fg-color), #a63fd9 99%, var(--md-default-bg-color) 99%)}@-webkit-keyframes tx-heart{0%,40%,80%,100%{transform:scale(1)}20%,60%{transform:scale(1.15)}}@keyframes tx-heart{0%,40%,80%,100%{transform:scale(1)}20%,60%{transform:scale(1.15)}}.tx-content__footer{margin-top:1rem;text-align:center}.tx-content__footer a{display:inline-block;color:#e91e63;transition:transform 250ms cubic-bezier(0.1, 0.7, 0.1, 1),color 125ms}.tx-content__footer a:focus,.tx-content__footer a:hover{transform:scale(1.2)}.tx-content__footer hr{display:inline-block;width:2rem;margin:1em;vertical-align:middle;background-color:currentColor;border:none}.tx-heart{-webkit-animation:tx-heart 1000ms infinite;animation:tx-heart 1000ms infinite}.tx-hero{margin:0 .8rem;color:var(--md-primary-bg-color)}.tx-hero h1{margin-bottom:1rem;color:currentColor;font-weight:700}@media screen and (max-width: 29.9375em){.tx-hero h1{font-size:1.4rem}}.tx-hero__content{padding-bottom:6rem}@media screen and (min-width: 60em){.tx-hero{display:flex;align-items:stretch}.tx-hero__content{max-width:19rem;margin-top:3.5rem;padding-bottom:14vw}.tx-hero__image{order:1;width:38rem;transform:translateX(4rem)}}@media screen and (min-width: 76.25em){.tx-hero__image{transform:translateX(8rem)}}.tx-hero .md-button{margin-top:.5rem;margin-right:.5rem;color:var(--md-primary-bg-color)}.tx-hero .md-button:hover,.tx-hero .md-button:focus{color:var(--md-default-bg-color);background-color:var(--md-accent-fg-color);border-color:var(--md-accent-fg-color)}.tx-hero .md-button--primary{color:#894da8;background-color:var(--md-primary-bg-color);border-color:var(--md-primary-bg-color)}
/*# sourceMappingURL=overrides.41a1bb10.min.css.map*/
/*# sourceMappingURL=overrides.082f5519.min.css.map*/

View File

@ -34,10 +34,10 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.3d7ab713.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.40703c20.min.css' | url }}">
{% if config.theme.palette %}
{% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.17bd0b03.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.0eb3995c.min.css' | url }}">
{% if palette.primary %}
{% import "partials/palette.html" as map %}
{% set primary = map.primary(
@ -172,8 +172,8 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.186f2b9b.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.02a83bbe.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/vendor.bdf98b33.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.68692be8.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",

View File

@ -22,7 +22,7 @@
<meta name="twitter:title" content="{{ title }}">
<meta name="twitter:description" content="{{ config.site_description }}">
<meta name="twitter:image" content="{{ image }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/overrides.41a1bb10.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/overrides.082f5519.min.css' | url }}">
{% endblock %}
{% block announce %}
<a href="https://twitter.com/squidfunk">

20
package-lock.json generated
View File

@ -528,15 +528,6 @@
"integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==",
"dev": true
},
"@types/ramda": {
"version": "0.27.17",
"resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.27.17.tgz",
"integrity": "sha512-AHVwr1YdFdxeabfC1g34ZuJ61dKOcfdXlG+sqGUweD+5VrD6A9emwmc2OZY+N8CdEKdwl29hwvtTMSJ6ZVVsiQ==",
"dev": true,
"requires": {
"ts-toolbelt": "^6.3.3"
}
},
"@types/relateurl": {
"version": "0.2.28",
"resolved": "https://registry.npmjs.org/@types/relateurl/-/relateurl-0.2.28.tgz",
@ -7951,11 +7942,6 @@
"integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==",
"dev": true
},
"ramda": {
"version": "0.27.1",
"resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz",
"integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw=="
},
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@ -10547,12 +10533,6 @@
"yn": "3.1.1"
}
},
"ts-toolbelt": {
"version": "6.15.5",
"resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-6.15.5.tgz",
"integrity": "sha512-FZIXf1ksVyLcfr7M317jbB67XFJhOO1YqdTcuGaq9q5jLUoTikukZ+98TPjKiP2jC5CgmYdWWYs0s2nLSU0/1A==",
"dev": true
},
"tsconfig-paths": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",

View File

@ -37,7 +37,6 @@
"focus-visible": "^5.1.0",
"lunr": "^2.3.9",
"lunr-languages": "^1.4.0",
"ramda": "^0.27.1",
"resize-observer-polyfill": "^1.5.1",
"rxjs": "^7.0.0-beta.7"
},
@ -53,7 +52,6 @@
"@types/lunr": "^2.3.3",
"@types/mini-css-extract-plugin": "^0.9.1",
"@types/node": "^14.11.1",
"@types/ramda": "^0.27.17",
"@types/resize-observer-browser": "^0.1.3",
"@types/webpack": "^4.41.22",
"@types/webpack-assets-manifest": "^3.0.1",

View File

@ -20,7 +20,6 @@
* IN THE SOFTWARE.
*/
import { identity } from "ramda"
import { Observable, OperatorFunction, pipe } from "rxjs"
import {
distinctUntilChanged,
@ -87,7 +86,7 @@ export function mountSearchResult(
return y >= container.scrollHeight - container.offsetHeight - 16
}),
distinctUntilChanged(),
filter(identity)
filter(Boolean)
)
/* Apply search results */

View File

@ -20,7 +20,6 @@
* IN THE SOFTWARE.
*/
import { reverse } from "ramda"
import {
MonoTypeOperatorFunction,
Observable,
@ -132,7 +131,7 @@ export function watchAnchorList(
/* Map reversed anchor path to vertical offset */
return index.set(
reverse(path = [...path, anchor]),
[...path = [...path, anchor]].reverse(),
offset
)
}, new Map<HTMLAnchorElement[], number>())

View File

@ -26,7 +26,6 @@
import "focus-visible"
import { sortBy, prop, values, identity } from "ramda"
import {
merge,
combineLatest,
@ -84,7 +83,8 @@ import {
setupKeyboard,
setupInstantLoading,
setupSearchWorker,
SearchIndex, SearchIndexPipeline
SearchIndex,
SearchIndexPipeline
} from "integrations"
import {
patchCodeBlocks,
@ -160,7 +160,7 @@ function setupSearchIndex(
/* Set pipeline from translation */
const pipeline = translate("search.config.pipeline")
.split(/\s*,\s*/)
.filter(identity) as SearchIndexPipeline
.filter(Boolean) as SearchIndexPipeline
/* Return search index after defaulting */
return { config, docs, index, pipeline }
@ -421,7 +421,7 @@ export function initialize(config: unknown) {
// domain. If there're no two domains, we just leave it as-is, as
// there isn't anything to be loaded anway.
if (urls.length > 1) {
const [a, b] = sortBy(prop("length"), urls)
const [a, b] = urls.sort((a, b) => a.length - b.length)
/* Determine common prefix */
let index = 0
@ -480,7 +480,7 @@ export function initialize(config: unknown) {
}
/* Subscribe to all observables */
merge(...values(state))
merge(...Object.values(state))
.subscribe()
return state
}

View File

@ -20,7 +20,6 @@
* IN THE SOFTWARE.
*/
import { identity } from "ramda"
import { Observable, fromEvent, merge } from "rxjs"
import {
filter,
@ -69,7 +68,7 @@ export function patchDetails(
/* Open all details before printing */
merge(
watchMedia("print").pipe(filter(identity)), /* Webkit */
watchMedia("print").pipe(filter(Boolean)), /* Webkit */
fromEvent(window, "beforeprint") /* IE, FF */
)
.pipe(

View File

@ -23,7 +23,6 @@
// tslint:disable no-null-keyword
import { JSX as JSXInternal } from "preact"
import { keys } from "ramda"
/* ----------------------------------------------------------------------------
* Helper types
@ -150,7 +149,7 @@ export function h(
/* Set attributes, if any */
if (attributes)
for (const attr of keys(attributes))
for (const attr of Object.keys(attributes))
setAttribute(el, attr, attributes[attr])
/* Append child nodes */