astro-accelerator 0.0.45 → 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.45",
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
  }
@@ -597,7 +597,7 @@ form.site-search {
597
597
 
598
598
  form.site-search div {
599
599
  display: grid;
600
- grid-template-columns: repeat(3, auto);
600
+ grid-template-columns: fit-content(400px) auto 30px;
601
601
  gap: 1em;
602
602
  }
603
603
 
@@ -733,13 +733,13 @@ form.site-search button {
733
733
 
734
734
  .post-meta {
735
735
  display: flex;
736
- align-items: center;
736
+ align-items: top;
737
737
  }
738
738
 
739
739
  .post-meta .author-image {
740
- width: 50px;
740
+ width: 80px;
741
+ height: 80px;
741
742
  margin-right: 1rem;
742
- aspect-ratio: 1/1;
743
743
  object-fit: cover;
744
744
  }
745
745
 
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',
@@ -49,6 +49,8 @@ const authorImage = authorList?.image?.src
49
49
  <br /><time datetime={ frontmatter.modDate.toString() } itemprop="dateModified">
50
50
  { _(Translations.post.last_modified) } { accelerator.dateFormatter.formatDate(frontmatter.modDate, lang) }
51
51
  </time>
52
+ }{authorList.mainAuthor &&
53
+ <p>{ authorList.mainAuthor.frontmatter.description }</p>
52
54
  }
53
55
  </span>
54
56
  </div>
@@ -51,8 +51,8 @@ const site_features = SITE.featureFlags;
51
51
  </header>
52
52
  <div class="page-content anim-show-parent" itemprop="articleBody">
53
53
  <TableOfContents frontmatter={ frontmatter } headings={ headings } lang={ lang } />
54
- <Authors frontmatter={ frontmatter } lang={ lang } />
55
54
  <slot />
55
+ <Authors frontmatter={ frontmatter } lang={ lang } />
56
56
  <Taxonomy frontmatter={ frontmatter } lang={ lang } />
57
57
  <Related frontmatter={ frontmatter } headings={ headings } lang={ lang } />
58
58
  </div>