From 364183f9891a07ef71dbdd049bca7aa4f7fd00dd Mon Sep 17 00:00:00 2001 From: Steven Zimmerman Date: Fri, 2 May 2025 03:20:48 -0400 Subject: [PATCH 1/5] git commit -m "style: fix formatting issues in README, saas template and image utils Fix the failing CI "check" action by applying Prettier formatting to: - README.md - src/pages/homes/saas.astro - src/utils/images.ts This resolves the "prettier --check" errors without changing functionality." --- README.md | 1 - src/pages/homes/saas.astro | 5 ++--- src/utils/images.ts | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 32ed8ffe1d..d25b127b66 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ We're embarking on an exciting journey with **AstroWind 2.0**, and we want you t
- ## TL;DR ```shell diff --git a/src/pages/homes/saas.astro b/src/pages/homes/saas.astro index 14ca2038f9..8291b461c6 100644 --- a/src/pages/homes/saas.astro +++ b/src/pages/homes/saas.astro @@ -51,9 +51,8 @@ const metadata = { }} > - Simplify web design with Astrowind:
your ultimate SaaS companion
+ Simplify web design with Astrowind:
your ultimate SaaS companion
diff --git a/src/utils/images.ts b/src/utils/images.ts index d6f14f0573..a33584e574 100644 --- a/src/utils/images.ts +++ b/src/utils/images.ts @@ -84,9 +84,7 @@ export const adaptOpenGraphImages = async ( typeof resolvedImage !== 'string' && resolvedImage?.width <= defaultWidth ? [resolvedImage?.width, resolvedImage?.height] : [defaultWidth, defaultHeight]; - _image = ( - await astroAssetsOptimizer(resolvedImage, [dimensions[0]], dimensions[0], dimensions[1], 'jpg') - )[0]; + _image = (await astroAssetsOptimizer(resolvedImage, [dimensions[0]], dimensions[0], dimensions[1], 'jpg'))[0]; } if (typeof _image === 'object') { From c6ae31f58b50b95b72f7505d36f53900d5cdc3e6 Mon Sep 17 00:00:00 2001 From: Steven Zimmerman Date: Fri, 2 May 2025 03:40:08 -0400 Subject: [PATCH 2/5] fix(types): annotate optimized image type in adaptOpenGraphImages Import ImagesOptimizer, define OptimizedImage alias, and annotate the `_image` variable to remove an implicit-any hint (ts7043) in `src/utils/images.ts`. No functional changes. --- src/utils/images.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/images.ts b/src/utils/images.ts index d6f14f0573..28b2e0c664 100644 --- a/src/utils/images.ts +++ b/src/utils/images.ts @@ -1,6 +1,9 @@ import { isUnpicCompatible, unpicOptimizer, astroAssetsOptimizer } from './images-optimization'; import type { ImageMetadata } from 'astro'; import type { OpenGraph } from '@astrolib/seo'; +import type { ImagesOptimizer } from './images-optimization'; +/** The optimized image shape returned by our ImagesOptimizer */ +type OptimizedImage = Awaited>[0]; const load = async function () { let images: Record Promise> | undefined = undefined; @@ -71,7 +74,7 @@ export const adaptOpenGraphImages = async ( }; } - let _image; + let _image: OptimizedImage | undefined; if ( typeof resolvedImage === 'string' && From c63cf4371f93b3c1c188e1f986915c8ef14e4b68 Mon Sep 17 00:00:00 2001 From: Robert P Date: Sat, 2 Aug 2025 22:30:12 +0300 Subject: [PATCH 3/5] Fix flickering when toggling theme #643 * More here: https://github.com/onwidget/astrowind/issues/643#issuecomment-3146678129 --- src/components/common/BasicScripts.astro | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/common/BasicScripts.astro b/src/components/common/BasicScripts.astro index c7290b23c2..8492b0009f 100644 --- a/src/components/common/BasicScripts.astro +++ b/src/components/common/BasicScripts.astro @@ -68,6 +68,9 @@ import { UI } from 'astrowind:config'; if (defaultTheme.endsWith(':only')) { return; } + + Observer.removeAnimationDelay(); + document.documentElement.classList.toggle('dark'); localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; }); @@ -167,6 +170,7 @@ import { UI } from 'astrowind:config'; observer: null, delayBetweenAnimations: 100, animationCounter: 0, + elements: null, start() { const selectors = [ @@ -179,7 +183,7 @@ import { UI } from 'astrowind:config'; '[class$=" intersect"]', ]; - const elements = Array.from(document.querySelectorAll(selectors.join(','))); + this.elements = Array.from(document.querySelectorAll(selectors.join(','))); const getThreshold = (element) => { if (element.classList.contains('intersect-full')) return 0.99; @@ -188,7 +192,7 @@ import { UI } from 'astrowind:config'; return 0; }; - elements.forEach((el) => { + this.elements.forEach((el) => { el.setAttribute('no-intersect', ''); el._intersectionThreshold = getThreshold(el); }); @@ -241,10 +245,25 @@ import { UI } from 'astrowind:config'; this.observer = new IntersectionObserver(callback.bind(this), { threshold: [0, 0.25, 0.5, 0.99] }); - elements.forEach((el) => { + this.elements.forEach((el) => { this.observer.observe(el); }); }, + + /* + REF: #643; + We need to remove the delay to fix flickering/delay + when toggling the theme. Observer only removes them + after data-animated is gone (out of view). + */ + removeAnimationDelay() { + this.elements.forEach((el) => { + if (el.getAttribute('data-animated') === 'true') { + el.style.transitionDelay = ''; + el.style.animationDelay = ''; + } + }); + }, }; Observer.start(); From 2381a12d649cad055b1fb84881dd395d13c5e41b Mon Sep 17 00:00:00 2001 From: prototypa Date: Mon, 18 Aug 2025 23:50:18 -0400 Subject: [PATCH 4/5] Replace onwidget with arthelokyo --- src/components/widgets/Announcement.astro | 2 +- src/data/post/astrowind-template-in-depth.mdx | 194 +----------------- src/layouts/LandingLayout.astro | 2 +- src/pages/homes/mobile-app.astro | 6 +- src/pages/homes/personal.astro | 2 +- src/pages/homes/saas.astro | 2 +- src/pages/homes/startup.astro | 4 +- src/pages/index.astro | 4 +- src/pages/landing/click-through.astro | 2 +- src/pages/landing/lead-generation.astro | 2 +- src/pages/landing/pre-launch.astro | 2 +- src/pages/landing/product.astro | 2 +- src/pages/landing/sales.astro | 2 +- src/pages/landing/subscription.astro | 2 +- src/pages/services.astro | 2 +- 15 files changed, 29 insertions(+), 201 deletions(-) diff --git a/src/components/widgets/Announcement.astro b/src/components/widgets/Announcement.astro index 540a223c9c..6071a64adc 100644 --- a/src/components/widgets/Announcement.astro +++ b/src/components/widgets/Announcement.astro @@ -15,7 +15,7 @@ diff --git a/src/data/post/astrowind-template-in-depth.mdx b/src/data/post/astrowind-template-in-depth.mdx index 17e828fd40..81f8ce9de5 100644 --- a/src/data/post/astrowind-template-in-depth.mdx +++ b/src/data/post/astrowind-template-in-depth.mdx @@ -12,196 +12,24 @@ metadata: canonical: https://astrowind.vercel.app/astrowind-template-in-depth --- -import DListItem from '~/components/ui/DListItem.astro'; -import ToggleTheme from '~/components/common/ToggleTheme.astro'; +## Mauris velit laoreet vitae cursus augue -## Overview +Lorem ipsum dolor sit amet, consectetur adipiscing elit. **Pellentesque** euismod, nibh ac aliquam aliquam, dui nulla ultrices erat, sit amet dictum nisl ex id nunc. Sed malesuada, orci vitae tempus euismod, nunc erat semper nisi, in aliquet nibh nisl eget nulla. Donec eget ipsum vitae nibh blandit consequat. Donec facilisis, nibh id aliquam fermentum, mi lorem molestie nisl, id posuere nisi nisi at nulla. -It can be a somewhat daunting task trying to get a handle on _AstroWind_ internals, and particularly various points of usage. +Duis euismod, nulla sit amet mattis euismod, nibh nunc rhoncus nibh, id interdum nunc nisl id lorem. Donec id nunc quis nulla aliquam cursus. Integer vitae nunc nunc. Sed sed nulla vitae nibh interdum gravida. Sed a nunc nibh. -This page outlines and clarifies some of the techniques found in _AstroWind_. Use it as a guide for further modification, or an instructional for techniques to use in your own endeavors. +Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer euismod, nunc eu lobortis mattis, lectus sem sagittis nunc, id laoreet nunc metus id lectus. Sed consectetur, urna at euismod consectetur, nunc nisi bibendum nibh, ut rhoncus nibh nunc vel mi. -## Styling +Nam eget nunc massa. Nulla facilisi. Sed a ligula vel nunc porta sollicitudin. **Pellentesque** vel mauris vitae nibh varius feugiat. Fusce eget nunc id ligula bibendum venenatis. -As the name suggests, _AstroWind_ relies on _TailWind_ for styling. Furthermore, _AstroWind_ defines custom low level style settings which are incorporated into _TailWind_ seamlessly, and which provides consistency for higher level styling constructs, as well as enabling dark mode. +### Nisi rutrum eros euismod -The styling mechanism consists of the following files (all paths are prefixed with `/src/` ): +Maecenas eget justo sed nibh consequat vulputate. Sed euismod neque vel nunc rhoncus, nec tincidunt nisl laoreet. Sed euismod justo id nulla varius, id cursus nibh tincidunt. Sed euismod est et nunc consectetur, id tempus nibh euismod. - - This file is essentially an extension of _TailWind's_ base.css. High-level component styles are defined here. Note - also styling on elements selected by 'attribute' selectors at the bottom of the files, particularly those selected by - 'data' attributes. - - - Defines custom colors and fonts. For these to take effect in the 'base.css' file, they need to be loaded in the html - header section. See next. - - - This layout is used for all of the pages rendered by _AstroWind_. The contents of _tailwind.css_ and - _CustomStyles.astro_ component, described above, is injected into the html header. - +In hac habitasse platea dictumst. Integer euismod, nunc eu lobortis mattis, lectus sem sagittis nunc, id laoreet nunc metus id lectus. Aenean sagittis, ligula vel blandit aliquam, nisl nunc euismod elit, nec tincidunt lectus nunc vitae nunc. Sed euismod justo id nulla varius, id cursus nibh tincidunt. Sed euismod est et nunc consectetur, id tempus nibh euismod. -### Dark Mode +### Nisi rutrum eros euismod -_Dark Mode_ is triggered by the little 'sunlight' icon:in the page header. It is defined in the _components/common/ToggleTheme.astro_, but the event is attached and the action defined in _components/common/BasicScripts.astro_ in the following snippet: +Quisque euismod lectus ac nunc dictum, id eleifend nunc euismod. Sed euismod, nunc eu lobortis mattis, lectus sem sagittis nunc, id laoreet nunc metus id lectus. Sed consectetur, urna at euismod consectetur, nunc nisi bibendum nibh, ut rhoncus nibh nunc vel mi. -```javascript -attachEvent('[data-aw-toggle-color-scheme]', 'click', function () { - if (defaultTheme.endsWith(':only')) { - return; - } - document.documentElement.classList.toggle('dark'); - localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; -}); -``` - -Note that this is a client event. _BasicScripts.astro_ defines several other client-side functionality as well as this one. - -## Advanced Slot Usage - -_slots_ are part of the component implementation, which is a common concept among many frameworks, including _Astrojs_. The typical slot definition in a component looks like this: - -```astro ---- -// (file: MyComponent.astro) -const { title } = Astro.props; -export interface Props { - title: string; -} ---- - -
-

{title}

- - -
-
-``` - -And in usage elsewhere: - -```astro -import MyComponent from "~/components/MyComponent"; ... - -

This content will be displayed in the slot

-
-``` - -### Alternate usage - -There's another way we can use slots, useful particularly when a component can have markdown content is as follows (study carefully...): - -```astro ---- -// (file: MyComponent.astro) - -const { title } = Astro.props; -export interface Props { - title: string; -} -const content: string = await Astro.props.render('default'); ---- - -// renders the html to the 'content' variable -
-

{title}

-
- -
-
-``` - -Whoa!! What's going on here? - -Notice there is no slot definition in the html portion of the component. Instead, what we do is have _Astro_ render the slot content (here, the 'default' content, but you can also render named slots) into a variable, and then use that content in a _div_ (for instance). - -So, if the usage is in a markdown file, like so: - -```mdx -import MyComponent from '../../components/MyComponent'; - -# Using the above component in a .mdx file (that can take components) - -{' '} - -### Here is some markdown content - With a bullet item. -``` - -_MyComponent_ renders the markdown to html and then injects it into the div. - -This actually has a big advantage -- consider that with the normal usage you don't have access to the slot contents: _Astro_ just plops the content into the _<slot/>_ tag. Using this method, however, allows you to access the content and further manipulate it before it gets inserted into the html. - -This allows a great deal of flexibility in component design. - -### Yet Another Step - -Now, we get to the techniques used in _AstroWind_, we'll use the _pages/index.astro_ file to illustrate. - -You'll note that the index file imports a lot of components, each one roughly analogous to a panel in the index page. Each of these components, in turn, is instantiated sequentially throughout the page. But, you'll notice that some of them use this kind of construct (we'll use the last section, _CallToAction_, as it is most illustrative of the technique): - -```astro - - - Astro +
Tailwind CSS -
- - - Be very surprised by these huge fake numbers you are seeing on this page. Don't waste - more time! :P - -
-``` - -Some things to note, here: - - - This argument is actually being passed a javascript object -- not a string. (However, in the TS definition, it could - be a string...) - - - Furthermore, these <Fragment/> elements each have a _slot="(value)"_ specifier. - - -The latter seems odd, because <Fragment/> is a built-in component over which you have no control, and doesn't have a provision for rendering slots, per se. - -The answer lies in a paragraph in the _Astro_ docs, slots section, which states: - -> Use a `slot="my-slot"` attribute on the child element that you want to pass through to a matching slot `name="my-slot" />` placeholder in your component. - -That's pretty concise and a bit of a head-scratcher to read, but basically what it says is that: - -1. Given a component that defines a slot: -1. you can reference a slot from a child element of that component and, -1. provide content to the parent component's slot from the child by naming the slot in the child with a `slot=""` property assignment, where the _slot-name_ is the parent's slot. - -So, in the example above, the _CallToAction_ component defines the _subtitle_ slot, and the following _<Fragment slot="subtitle">_ populates the slot with the following content: - -```astro - - Be very surprised by these huge fake numbers you are seeing on this page. Don't waste - more time! :P - -``` - -And, the _CallToAction_ component defines and renders it thusly: - -```astro ---- -//... -const { subtitle = await Astro.slots.render('subtitle') } = Astro.props; ---- - -//... -{subtitle &&

} -//... -``` - -There's a lot to wrap your head around, here. - -Notice first that _subtitle_ is defined as a prop/argument, but it's being processed as a slot. Interestingly, prop args and slots seem to be somewhat interchangeable: if the subtitle was just a string, it would simply take that assignment. The main difference is that if you render them independently, you have to call the render with an _await_ modifier. +Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed euismod est et nunc consectetur, id tempus nibh euismod. diff --git a/src/layouts/LandingLayout.astro b/src/layouts/LandingLayout.astro index 0554afa44a..4bafcf7970 100644 --- a/src/layouts/LandingLayout.astro +++ b/src/layouts/LandingLayout.astro @@ -23,7 +23,7 @@ const { metadata } = Astro.props; actions={[ { text: 'Download', - href: 'https://github.com/onwidget/astrowind', + href: 'https://github.com/arthelokyo/astrowind', }, ]} showToggleTheme diff --git a/src/pages/homes/mobile-app.astro b/src/pages/homes/mobile-app.astro index 510a321359..3791e88da6 100644 --- a/src/pages/homes/mobile-app.astro +++ b/src/pages/homes/mobile-app.astro @@ -15,10 +15,10 @@ import Button from '~/components/ui/Button.astro'; import Image from '~/components/common/Image.astro'; const appStoreImg = '~/assets/images/app-store.png'; -const appStoreDownloadLink = 'https://github.com/onwidget/astrowind'; +const appStoreDownloadLink = 'https://github.com/arthelokyo/astrowind'; const googlePlayImg = '~/assets/images/google-play.png'; -const googlePlayDownloadLink = 'https://github.com/onwidget/astrowind'; +const googlePlayDownloadLink = 'https://github.com/arthelokyo/astrowind'; const metadata = { title: 'Mobile App Homepage', @@ -240,7 +240,7 @@ const metadata = { callToAction={{ target: '_blank', text: 'Read more testimonials', - href: 'https://github.com/onwidget/astrowind', + href: 'https://github.com/arthelokyo/astrowind', icon: 'tabler:chevron-right', }} /> diff --git a/src/pages/homes/personal.astro b/src/pages/homes/personal.astro index 092053d7ac..499a95aa75 100644 --- a/src/pages/homes/personal.astro +++ b/src/pages/homes/personal.astro @@ -26,7 +26,7 @@ const metadata = { { text: 'Resume', href: '#resume' }, { text: 'Porfolio', href: '#porfolio' }, { text: 'Blog', href: '#blog' }, - { text: 'Github', href: 'https://github.com/onwidget' }, + { text: 'Github', href: 'https://github.com/arthelokyo' }, ]} actions={[ { diff --git a/src/pages/homes/saas.astro b/src/pages/homes/saas.astro index 14ca2038f9..05bf6b834b 100644 --- a/src/pages/homes/saas.astro +++ b/src/pages/homes/saas.astro @@ -42,7 +42,7 @@ const metadata = { From 59b7e373d87503686b81bcfb6c7d8f3923eaf698 Mon Sep 17 00:00:00 2001 From: prototypa Date: Tue, 19 Aug 2025 00:00:01 -0400 Subject: [PATCH 5/5] Fix format --- src/components/common/BasicScripts.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/BasicScripts.astro b/src/components/common/BasicScripts.astro index 8492b0009f..e84c79b67e 100644 --- a/src/components/common/BasicScripts.astro +++ b/src/components/common/BasicScripts.astro @@ -70,7 +70,7 @@ import { UI } from 'astrowind:config'; } Observer.removeAnimationDelay(); - + document.documentElement.classList.toggle('dark'); localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; }); @@ -262,7 +262,7 @@ import { UI } from 'astrowind:config'; el.style.transitionDelay = ''; el.style.animationDelay = ''; } - }); + }); }, };