astro-accelerator 4.0.18 → 4.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.
|
|
2
|
+
"version": "4.0.20",
|
|
3
3
|
"author": "Steve Fenton",
|
|
4
4
|
"name": "astro-accelerator",
|
|
5
5
|
"description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@astrojs/mdx": "^2.1.1",
|
|
35
|
-
"astro": "^4.4.
|
|
35
|
+
"astro": "^4.4.3",
|
|
36
36
|
"astro-accelerator-utils": "^0.3.7",
|
|
37
|
-
"cspell": "^8.
|
|
37
|
+
"cspell": "^8.4.1",
|
|
38
38
|
"csv": "^6.3.6",
|
|
39
39
|
"hast-util-from-selector": "^3.0.0",
|
|
40
40
|
"html-to-text": "^9.0.5",
|
package/public/css/main.css
CHANGED
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
* This javascript file comes from Astro Accelerator
|
|
3
3
|
* Edits will be overwritten if you change the file locally
|
|
4
4
|
*/
|
|
5
|
-
import { qs, qsa } from
|
|
5
|
+
import { qs, qsa } from "./query.js";
|
|
6
6
|
|
|
7
|
-
const activeClass =
|
|
7
|
+
const activeClass = "magnify-icon";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
10
|
* Enables opening image in new tab
|
|
11
|
-
*/
|
|
11
|
+
*/
|
|
12
12
|
function enhanceFigures() {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
qsa(`figure > p > img, [data-image] > .image__img`).forEach((node) => {
|
|
14
|
+
const src = node.src;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const magnify = document.createElement("button");
|
|
17
|
+
magnify.classList.add(activeClass);
|
|
18
|
+
magnify.title = "Enlarge";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const magnifyContainer = document.createElement("div");
|
|
21
|
+
magnifyContainer.className = "magnify-container";
|
|
22
|
+
magnifyContainer.appendChild(magnify);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
node.insertAdjacentElement("beforebegin", magnifyContainer);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
26
|
+
magnify.addEventListener("click", async () => {
|
|
27
|
+
window.open(src);
|
|
29
28
|
});
|
|
29
|
+
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export { enhanceFigures }
|
|
32
|
+
export { enhanceFigures };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Edits will be overwritten if you change the file locally
|
|
6
6
|
*/
|
|
7
7
|
import { qs, qsa } from './query.js';
|
|
8
|
+
import { removeScroll, resetScroll } from './scrollbar.js';
|
|
8
9
|
import { getFocusableElement, trapFocusForward, trapReverseFocus } from './focus.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -80,11 +81,7 @@ function addMobileNav(resizedEventName) {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
function openMobileMenu(){
|
|
83
|
-
|
|
84
|
-
document.body.style.overflow = 'hidden';
|
|
85
|
-
const w2 = document.body.getBoundingClientRect().width;
|
|
86
|
-
document.documentElement.style.color = 'red';
|
|
87
|
-
document.documentElement.style.paddingInlineEnd = (w2 - w1) + 'px';
|
|
84
|
+
removeScroll();
|
|
88
85
|
|
|
89
86
|
const menuElement = qs('#' + navigationSelector);
|
|
90
87
|
|
|
@@ -132,8 +129,7 @@ function addMobileNav(resizedEventName) {
|
|
|
132
129
|
function closeMobileMenu() {
|
|
133
130
|
const menuElement = qs('#' + navigationSelector);
|
|
134
131
|
menuElement.style.display = '';
|
|
135
|
-
|
|
136
|
-
document.documentElement.style.paddingInlineEnd = '0';
|
|
132
|
+
resetScroll();
|
|
137
133
|
|
|
138
134
|
if (icon.getAttribute(dataOpen) === dataOpen) {
|
|
139
135
|
overlay.innerHTML = '';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function removeScroll() {
|
|
2
|
+
const w1 = document.body.getBoundingClientRect().width;
|
|
3
|
+
document.body.style.overflow = 'hidden';
|
|
4
|
+
const w2 = document.body.getBoundingClientRect().width;
|
|
5
|
+
document.documentElement.style.paddingInlineEnd = (w2 - w1) + 'px';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function resetScroll() {
|
|
9
|
+
document.body.style.overflow = 'auto';
|
|
10
|
+
document.documentElement.style.paddingInlineEnd = '0';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { removeScroll, resetScroll }
|
package/public/js/search.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { qs } from "./modules/query.js";
|
|
4
4
|
import { raiseEvent } from "./modules/events.js";
|
|
5
|
+
import { removeScroll, resetScroll } from './modules/scrollbar.js';
|
|
5
6
|
import { contains, sanitise, explode, highlight } from "./modules/string.js";
|
|
6
7
|
import { stemmer } from "./modules/stemmer.js";
|
|
7
8
|
|
|
@@ -120,14 +121,14 @@ function initializeSearch() {
|
|
|
120
121
|
function activateInput() {
|
|
121
122
|
if (siteSearchWrapper.classList.contains("is-active")) return;
|
|
122
123
|
siteSearchWrapper.classList.add("is-active");
|
|
123
|
-
|
|
124
|
+
removeScroll();
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
function deactivateInput() {
|
|
127
128
|
if (!siteSearchWrapper.classList.contains("is-active")) return;
|
|
128
129
|
siteSearchWrapper.classList.remove("is-active");
|
|
129
130
|
siteSearchInput.blur();
|
|
130
|
-
|
|
131
|
+
resetScroll();
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
function openDropdown() {
|