astro-accelerator 0.0.46 → 0.0.47

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": "0.0.46",
2
+ "version": "0.0.47",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@squoosh/lib": "^0.4.0",
28
- "astro": "^1.6.13",
29
- "astro-accelerator-utils": "^0.2.10",
28
+ "astro": "^1.6.14",
29
+ "astro-accelerator-utils": "^0.2.12",
30
30
  "hast-util-from-selector": "^2.0.0",
31
31
  "remark-directive": "^2.0.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@playwright/test": "^1.27.1"
34
+ "@playwright/test": "^1.28.1"
35
35
  },
36
36
  "engines": {
37
37
  "node": "*"
@@ -44,7 +44,7 @@ summary:focus {
44
44
  background-color: var(--aft-link-alt);
45
45
  }
46
46
 
47
- :focus {
47
+ .input-keyboard :focus {
48
48
  outline: 2px dashed var(--fore-link-alt);
49
49
  border-radius: 5px;
50
50
  }
package/public/js/main.js CHANGED
@@ -5,6 +5,7 @@ import { addStickyNavigation } from './modules/nav-sticky.js';
5
5
  import { addMobileNav } from './modules/nav-mobile.js';
6
6
  import { setClickableBlocks } from './modules/click-blocks.js';
7
7
  import { setExternalLinkAttributes } from './modules/external-links.js';
8
+ import { monitorInputType } from './modules/input-type.js';
8
9
 
9
10
  const resizedEventName = addResizedEvent();
10
11
 
@@ -14,6 +15,7 @@ addStickyNavigation('.site-header', '#site-nav', '#site-nav > ul', resizedEventN
14
15
  addMobileNav(resizedEventName);
15
16
  addIntersectionObserver('.anim-show-parent img, .anim-show-parent > *:not(h1, h2, h3, h4, h5, h6)');
16
17
  addListImageIntersectionObserver('.post-list img');
18
+ monitorInputType();
17
19
 
18
20
  // @ts-ignore
19
21
  const f = site_features ?? {};
@@ -0,0 +1,53 @@
1
+ // @ts-check
2
+
3
+ let inputType = 'unknown';
4
+
5
+ /**
6
+ * Sets the user input mode as a class
7
+ */
8
+ function monitorInputType() {
9
+ window.addEventListener('keydown', event => {
10
+ const eventType = 'input-keyboard';
11
+ processInput(eventType);
12
+ });
13
+
14
+ window.addEventListener('mousemove', event => {
15
+ const eventType = 'input-mouse';
16
+ processInput(eventType);
17
+ });
18
+
19
+ window.addEventListener('touchstart', event => {
20
+ const eventType = 'input-touch';
21
+ processInput(eventType);
22
+ });
23
+ }
24
+
25
+ /**
26
+ * Processes the keyboard, mouse, or touch event
27
+ * @param {string} eventType
28
+ */
29
+ function processInput(eventType) {
30
+ if (inputType !== eventType) {
31
+ removeClass(inputType);
32
+ inputType = eventType;
33
+ addClass(inputType);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Removes an input type class from the body
39
+ * @param {string} inputType
40
+ */
41
+ function removeClass(inputType) {
42
+ document.body.classList.remove(inputType);
43
+ }
44
+
45
+ /**
46
+ * Adds an input type class to the body
47
+ * @param {string} inputType
48
+ */
49
+ function addClass(inputType) {
50
+ document.body.classList.add(inputType);
51
+ }
52
+
53
+ export { monitorInputType };
package/src/config.ts CHANGED
@@ -35,6 +35,9 @@ const SITE: Site = {
35
35
  figures: ['enlarge'],
36
36
  youTubeLinks: ['embed'],
37
37
  },
38
+ layouts: {
39
+ default: 'src/layouts/Default.astro'
40
+ },
38
41
  images: {
39
42
  contentSize: '(max-width: 860px) 100vw, 620px',
40
43
  listerSize: '(max-width: 860px) 90vw, 350px',