Skip to content

Commit

Permalink
chore(template): merge template changes 🆙
Browse files Browse the repository at this point in the history
Signed-off-by: joriswitstok <[email protected]>
  • Loading branch information
joriswitstok committed Nov 1, 2024
1 parent 71b33fe commit 3bfff4a
Show file tree
Hide file tree
Showing 22 changed files with 1,213 additions and 1,251 deletions.
2,115 changes: 940 additions & 1,175 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onwidget/astrowind",
"version": "1.0.0-beta.46",
"version": "1.0.0-beta.48",
"description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.",
"type": "module",
"private": true,
Expand All @@ -22,48 +22,48 @@
"fix:prettier": "prettier -w ."
},
"dependencies": {
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"@astrolib/analytics": "^0.5.0",
"@astrolib/seo": "^1.0.0-beta.6",
"@astrojs/rss": "^4.0.8",
"@astrojs/sitemap": "^3.2.0",
"@astrolib/analytics": "^0.6.1",
"@astrolib/seo": "^1.0.0-beta.8",
"@fontsource-variable/inter": "^5.1.0",
"astro": "^4.15.5",
"astro-embed": "^0.7.2",
"astro": "^4.16.2",
"astro-embed": "^0.7.4",
"astro-icon": "^1.1.1",
"limax": "4.1.0",
"lodash.merge": "^4.6.2",
"unpic": "^3.18.0"
},
"devDependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/mdx": "^3.1.6",
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^3.1.8",
"@astrojs/partytown": "^2.1.2",
"@astrojs/tailwind": "5.1.0",
"@eslint/js": "^9.10.0",
"@astrojs/tailwind": "5.1.2",
"@eslint/js": "^9.12.0",
"@iconify-json/flat-color-icons": "^1.2.0",
"@iconify-json/tabler": "^1.2.3",
"@iconify-json/tabler": "^1.2.5",
"@tailwindcss/typography": "^0.5.15",
"@types/eslint__js": "^8.42.3",
"@types/js-yaml": "^4.0.9",
"@types/lodash.merge": "^4.6.9",
"@types/mdx": "^2.0.13",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"astro-compress": "2.3.1",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"astro-compress": "2.3.3",
"astro-eslint-parser": "^1.0.3",
"eslint": "^9.10.0",
"eslint": "^9.12.0",
"eslint-plugin-astro": "^1.2.4",
"globals": "^15.9.0",
"globals": "^15.11.0",
"js-yaml": "^4.1.0",
"mdast-util-to-string": "^4.0.0",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"reading-time": "^1.5.0",
"sharp": "0.33.5",
"tailwind-merge": "^2.5.2",
"tailwindcss": "^3.4.11",
"typescript": "^5.6.2",
"typescript-eslint": "^8.6.0",
"tailwind-merge": "^2.5.3",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.3",
"typescript-eslint": "^8.8.1",
"unist-util-visit": "^5.0.0"
}
}
4 changes: 3 additions & 1 deletion src/components/blog/GridItem.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const image = await findImage(post.image);
const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : '';
---

<article class="mb-6 transition">
<article
class="mb-6 transition intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade"
>
<div class="relative md:h-64 bg-gray-400 dark:bg-slate-700 rounded shadow-lg mb-6">
{
image &&
Expand Down
4 changes: 3 additions & 1 deletion src/components/blog/ListItem.astro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const image = (await findImage(post.image)) as ImageMetadata | undefined;
const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : '';
---

<article class={`max-w-md mx-auto md:max-w-none grid gap-6 md:gap-8 ${image ? 'md:grid-cols-2' : ''}`}>
<article
class={`max-w-md mx-auto md:max-w-none grid gap-6 md:gap-8 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade ${image ? 'md:grid-cols-2' : ''}`}
>
{
image &&
(link ? (
Expand Down
5 changes: 4 additions & 1 deletion src/components/blog/RelatedPosts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ const relatedPosts = post.tags ? await getRelatedPosts(post, 4) : [];
{
APP_BLOG.isRelatedPostsEnabled ? (
<BlogHighlightedPosts
classes={{ container: 'pt-0 lg:pt-0 md:pt-0' }}
classes={{
container:
'pt-0 lg:pt-0 md:pt-0 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade',
}}
title="Related Posts"
linkText="View All Posts"
linkUrl={getBlogPermalink()}
Expand Down
6 changes: 5 additions & 1 deletion src/components/blog/SinglePost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const { post, url } = Astro.props;

<section class="py-8 sm:py-16 lg:py-20 mx-auto">
<article>
<header class={post.image ? '' : ''}>
<header
class={post.image
? 'intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade'
: 'intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade'}
>
<div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center">
<p>
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
Expand Down
93 changes: 93 additions & 0 deletions src/components/common/BasicScripts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,96 @@ import { UI } from 'astrowind:config';
onPageShow();
});
</script>

<script is:inline>
/* Inspired by: https://github.com/heidkaemper/tailwindcss-intersect */
const Observer = {
observer: null,
delayBetweenAnimations: 100,
animationCounter: 0,

start() {
const selectors = [
'[class*=" intersect:"]',
'[class*=":intersect:"]',
'[class^="intersect:"]',
'[class="intersect"]',
'[class*=" intersect "]',
'[class^="intersect "]',
'[class$=" intersect"]',
];

const elements = Array.from(document.querySelectorAll(selectors.join(',')));

const getThreshold = (element) => {
if (element.classList.contains('intersect-full')) return 0.99;
if (element.classList.contains('intersect-half')) return 0.5;
if (element.classList.contains('intersect-quarter')) return 0.25;
return 0;
};

elements.forEach((el) => {
el.setAttribute('no-intersect', '');
el._intersectionThreshold = getThreshold(el);
});

const callback = (entries) => {
entries.forEach((entry) => {
requestAnimationFrame(() => {
const target = entry.target;
const intersectionRatio = entry.intersectionRatio;
const threshold = target._intersectionThreshold;

if (target.classList.contains('intersect-no-queue')) {
if (entry.isIntersecting) {
target.removeAttribute('no-intersect');
if (target.classList.contains('intersect-once')) {
this.observer.unobserve(target);
}
} else {
target.setAttribute('no-intersect', '');
}
return;
}

if (intersectionRatio >= threshold) {
if (!target.hasAttribute('data-animated')) {
target.removeAttribute('no-intersect');
target.setAttribute('data-animated', 'true');

const delay = this.animationCounter * this.delayBetweenAnimations;
this.animationCounter++;

target.style.transitionDelay = `${delay}ms`;
target.style.animationDelay = `${delay}ms`;

if (target.classList.contains('intersect-once')) {
this.observer.unobserve(target);
}
}
} else {
target.setAttribute('no-intersect', '');
target.removeAttribute('data-animated');
target.style.transitionDelay = '';
target.style.animationDelay = '';

this.animationCounter = 0;
}
});
});
};

this.observer = new IntersectionObserver(callback.bind(this), { threshold: [0, 0.25, 0.5, 0.99] });

elements.forEach((el) => {
this.observer.observe(el);
});
},
};

Observer.start();

document.addEventListener('astro:after-swap', () => {
Observer.start();
});
</script>
15 changes: 6 additions & 9 deletions src/components/common/Image.astro
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ const _image = await findImage(props.src);
let image: ImageType | undefined = undefined;
if (typeof _image === 'string') {
if ((_image.startsWith('http://') || _image.startsWith('https://')) && isUnpicCompatible(_image)) {
image = await getImagesOptimized(_image, props, unpicOptimizer);
} else {
image = {
src: _image,
attributes: { ...props, src: undefined },
};
}
if (
typeof _image === 'string' &&
(_image.startsWith('http://') || _image.startsWith('https://')) &&
isUnpicCompatible(_image)
) {
image = await getImagesOptimized(_image, props, unpicOptimizer);
} else if (_image) {
image = await getImagesOptimized(_image, props, astroAsseetsOptimizer);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/ItemGrid.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const {
)}
>
{items.map(({ title, description, icon, callToAction, classes: itemClasses = {} }) => (
<div>
<div class="intersect-once motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade">
<div class={twMerge('flex flex-row max-w-md', panelClass, itemClasses?.panel)}>
<div class="flex justify-center">
{(icon || defaultIcon) && (
Expand Down
8 changes: 7 additions & 1 deletion src/components/ui/ItemGrid2.astro
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ const {
)}
>
{items.map(({ title, description, icon, callToAction, classes: itemClasses = {} }) => (
<div class={twMerge('relative flex flex-col', panelClass, itemClasses?.panel)}>
<div
class={twMerge(
'relative flex flex-col intersect-once intersect-quarter intercept-no-queue motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade',
panelClass,
itemClasses?.panel
)}
>
{(icon || defaultIcon) && (
<Icon name={icon || defaultIcon} class={twMerge('mb-2 w-10 h-10', defaultIconClass, itemClasses?.icon)} />
)}
Expand Down
8 changes: 7 additions & 1 deletion src/components/ui/Timeline.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ const {
items && items.length && (
<div class={containerClass}>
{items.map(({ title, description, icon, classes: itemClasses = {} }, index = 0) => (
<div class={twMerge('flex', panelClass, itemClasses?.panel)}>
<div
class={twMerge(
'flex intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade',
panelClass,
itemClasses?.panel
)}
>
<div class="flex flex-col items-center mr-4 rtl:mr-0 rtl:ml-4">
<div>
<div class="flex items-center justify-center">
Expand Down
5 changes: 4 additions & 1 deletion src/components/ui/WidgetWrapper.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ const WrapperTag = as;
</div>
<div
class:list={[
twMerge('relative mx-auto max-w-7xl px-4 md:px-6 py-12 md:py-16 lg:py-20 text-default', containerClass),
twMerge(
'relative mx-auto max-w-7xl px-4 md:px-6 py-12 md:py-16 lg:py-20 text-default intersect-once intersect-quarter intercept-no-queue motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade',
containerClass
),
{ dark: isDark },
]}
>
Expand Down
19 changes: 14 additions & 5 deletions src/components/widgets/Hero.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,31 @@ const {
{
tagline && (
<p
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase"
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade"
set:html={tagline}
/>
)
}
{
title && (
<h1
class="text-5xl md:text-6xl font-bold leading-tighter tracking-tighter mb-4 font-heading dark:text-gray-200"
class="text-5xl md:text-6xl font-bold leading-tighter tracking-tighter mb-4 font-heading dark:text-gray-200 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade"
set:html={title}
/>
)
}
<div class="max-w-3xl mx-auto">
{subtitle && <p class="text-xl text-muted mb-6 dark:text-slate-300" set:html={subtitle} />}
{
subtitle && (
<p
class="text-xl text-muted mb-6 dark:text-slate-300 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade"
set:html={subtitle}
/>
)
}
{
actions && (
<div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4">
<div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4 intersect-once intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade">
{Array.isArray(actions) ? (
actions.map((action) => (
<div class="flex w-full sm:w-auto">
Expand All @@ -64,7 +71,9 @@ const {
</div>
{content && <Fragment set:html={content} />}
</div>
<div>
<div
class="intersect-once intercept-no-queue intersect-quarter motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade"
>
{
image && (
<div class="relative m-auto max-w-5xl">
Expand Down
17 changes: 12 additions & 5 deletions src/components/widgets/Hero2.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,32 @@ const {
{
tagline && (
<p
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase"
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase intersect-once motion-safe:md:intersect:animate-fade motion-safe:md:opacity-0 intersect-quarter"
set:html={tagline}
/>
)
}
{
title && (
<h1
class="text-5xl md:text-6xl font-bold leading-tighter tracking-tighter mb-4 font-heading dark:text-gray-200"
class="text-5xl md:text-6xl font-bold leading-tighter tracking-tighter mb-4 font-heading dark:text-gray-200 intersect-once motion-safe:md:intersect:animate-fade motion-safe:md:opacity-0 intersect-quarter"
set:html={title}
/>
)
}
<div class="max-w-3xl mx-auto lg:max-w-none">
{subtitle && <p class="text-xl text-muted mb-6 dark:text-slate-300" set:html={subtitle} />}
{
subtitle && (
<p
class="text-xl text-muted mb-6 dark:text-slate-300 intersect-once motion-safe:md:intersect:animate-fade motion-safe:md:opacity-0 intersect-quarter"
set:html={subtitle}
/>
)
}

{
actions && (
<div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4 lg:justify-start lg:m-0 lg:max-w-7xl">
<div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4 lg:justify-start lg:m-0 lg:max-w-7xl intersect-once motion-safe:md:intersect:animate-fade motion-safe:md:opacity-0 intersect-quarter">
{Array.isArray(actions) ? (
actions.map((action) => (
<div class="flex w-full sm:w-auto">
Expand All @@ -68,7 +75,7 @@ const {
<div class="basis-1/2">
{
image && (
<div class="relative m-auto max-w-5xl">
<div class="relative m-auto max-w-5xl intersect-once intercept-no-queue motion-safe:md:intersect:animate-fade motion-safe:md:opacity-0 intersect-quarter">
{typeof image === 'string' ? (
<Fragment set:html={image} />
) : (
Expand Down
Loading

0 comments on commit 3bfff4a

Please sign in to comment.