astro-accelerator 0.0.48 → 0.0.50

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.48",
2
+ "version": "0.0.50",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -959,6 +959,19 @@ figure:focus .magnify-icon {
959
959
  }
960
960
  }
961
961
 
962
+ button[data-share] {
963
+ background-color: unset;
964
+ cursor: pointer;
965
+ color: var(--fore-link);
966
+ stroke: var(--fore-link);
967
+ }
968
+
969
+ button[data-share]:hover,
970
+ button[data-share]:focus {
971
+ color: var(--fore-link-alt);
972
+ stroke: var(--fore-link-alt);
973
+ }
974
+
962
975
  /* Animation */
963
976
 
964
977
  @media (prefers-reduced-motion: no-preference) {
@@ -972,10 +985,14 @@ figure:focus .magnify-icon {
972
985
 
973
986
  .magnify-icon,
974
987
  .copy-button,
975
- .anim-show-parent > *,
988
+ .anim-show-parent .list-item,
976
989
  .anim-show-parent img {
977
- transition: all 0.3s ease-in;
990
+ transition: all 0.2s ease-in;
978
991
  transition-delay: 0.1s;
979
- opacity: var(--shown, 1);
992
+ scale: calc(0.75 + (var(--shown, 1) * 0.25));
993
+ }
994
+
995
+ .anim-show-parent .list-item img {
996
+ scale: 1;
980
997
  }
981
998
  }
package/public/js/main.js CHANGED
@@ -6,6 +6,7 @@ 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
8
  import { monitorInputType } from './modules/input-type.js';
9
+ import { enableSharing } from './modules/share.js';
9
10
 
10
11
  const resizedEventName = addResizedEvent();
11
12
 
@@ -13,9 +14,10 @@ setClickableBlocks();
13
14
  setExternalLinkAttributes();
14
15
  addStickyNavigation('.site-header', '#site-nav', '#site-nav > ul', resizedEventName);
15
16
  addMobileNav(resizedEventName);
16
- addIntersectionObserver('.anim-show-parent img, .anim-show-parent > *:not(h1, h2, h3, h4, h5, h6)');
17
+ addIntersectionObserver('.anim-show-parent img, .anim-show-parent .list-item');
17
18
  addListImageIntersectionObserver('.post-list img');
18
19
  monitorInputType();
20
+ enableSharing();
19
21
 
20
22
  // @ts-ignore
21
23
  const f = site_features ?? {};
@@ -0,0 +1,24 @@
1
+ import { qs, qsa } from './query.js';
2
+
3
+ function handleClick() {
4
+
5
+ const title = this.dataset.sharetitle ?? qs('meta[property="og:title"]').content;
6
+ const text = this.dataset.sharetext ?? qs('meta[property="og:description"]').content;
7
+ const url = this.dataset.shareurl ?? document.location;
8
+
9
+ const share = {
10
+ title: title,
11
+ text: text,
12
+ url: url
13
+ };
14
+
15
+ navigator.share(share);
16
+ }
17
+
18
+ function enableSharing() {
19
+ qsa('[data-share]').forEach((elem) => {
20
+ elem.addEventListener('click', handleClick);
21
+ });
22
+ }
23
+
24
+ export { enableSharing }
package/src/config.ts CHANGED
@@ -35,9 +35,6 @@ const SITE: Site = {
35
35
  figures: ['enlarge'],
36
36
  youTubeLinks: ['embed'],
37
37
  },
38
- layouts: {
39
- default: 'src/layouts/Default.astro'
40
- },
41
38
  images: {
42
39
  contentSize: '(max-width: 860px) 100vw, 620px',
43
40
  listerSize: '(max-width: 860px) 90vw, 350px',
@@ -15,10 +15,16 @@ async function getData() {
15
15
  const article: any = await allPages[path]();
16
16
  const addToSitemap = PostFiltering.showInSitemap(article);
17
17
 
18
+ let url = accelerator.urlFormatter.addSlashToAddress(article.url);
19
+
20
+ if (article.frontmatter.layout == 'src/layouts/Author.astro') {
21
+ url += '1/';
22
+ }
23
+
18
24
  if (addToSitemap) {
19
25
  pages.push(`
20
26
  <url>
21
- <loc>${ SITE.url + accelerator.urlFormatter.addSlashToAddress(article.url) }</loc>
27
+ <loc>${ SITE.url + url }</loc>
22
28
  <lastmod>${ article.frontmatter.pubDate }</lastmod>
23
29
  </url>`);
24
30
  }
@@ -33,7 +33,10 @@ const authorImage = authorList?.image?.src
33
33
  sizes={ authorImage.sizes }
34
34
  src={ authorImage.src }
35
35
  alt={ authorList?.image?.alt }
36
- class={ authorImage.class } />
36
+ class={ authorImage.class }
37
+ width={ authorImage.metadata?.width }
38
+ height={ authorImage.metadata?.height }
39
+ />
37
40
  }
38
41
  <div class="author-info">
39
42
  <span class="author-list">{ _(Translations.post.written_by) }
@@ -65,6 +65,8 @@ const articles = relatedPosts.map(p => {
65
65
  src={ post.img.src }
66
66
  alt={ post.frontmatter.bannerImage.alt }
67
67
  class={ post.img.class }
68
+ width={ post.img.metadata?.width }
69
+ height={ post.img.metadata?.height }
68
70
  loading="lazy" />
69
71
  )}
70
72
  </div>