diff options
author | 2023-09-06 15:25:56 +0000 | |
---|---|---|
committer | 2023-09-06 15:25:56 +0000 | |
commit | eb7615f25a88c25dc6db50b199877a8f79597a74 (patch) | |
tree | 74b5d3773ffb8fa7020e3d3cff2493ba4adc2ed6 | |
parent | c06b41a6b86a41ba4b1ffa4bdecafac9b7299768 (diff) | |
download | astro-eb7615f25a88c25dc6db50b199877a8f79597a74.tar.gz astro-eb7615f25a88c25dc6db50b199877a8f79597a74.tar.zst astro-eb7615f25a88c25dc6db50b199877a8f79597a74.zip |
[ci] format
19 files changed, 127 insertions, 74 deletions
diff --git a/examples/basics/src/layouts/Layout.astro b/examples/basics/src/layouts/Layout.astro index 3345b887c..7b552be19 100644 --- a/examples/basics/src/layouts/Layout.astro +++ b/examples/basics/src/layouts/Layout.astro @@ -1,4 +1,4 @@ ---- +--- interface Props { title: string; } @@ -6,11 +6,11 @@ interface Props { const { title } = Astro.props; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> - <meta name="description" content="Astro description"> + <meta name="description" content="Astro description" /> <meta name="viewport" content="width=device-width" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <meta name="generator" content={Astro.generator} /> @@ -25,15 +25,27 @@ const { title } = Astro.props; --accent: 136, 58, 234; --accent-light: 224, 204, 250; --accent-dark: 49, 10, 101; - --accent-gradient: linear-gradient(45deg, rgb(var(--accent)), rgb(var(--accent-light)) 30%, white 60%); + --accent-gradient: linear-gradient( + 45deg, + rgb(var(--accent)), + rgb(var(--accent-light)) 30%, + white 60% + ); } html { font-family: system-ui, sans-serif; - background: #13151A; + background: #13151a; background-size: 224px; } code { - font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, - Bitstream Vera Sans Mono, Courier New, monospace; + font-family: + Menlo, + Monaco, + Lucida Console, + Liberation Mono, + DejaVu Sans Mono, + Bitstream Vera Sans Mono, + Courier New, + monospace; } </style> diff --git a/examples/blog/src/pages/blog/index.astro b/examples/blog/src/pages/blog/index.astro index a5c329a87..ebbcd3042 100644 --- a/examples/blog/src/pages/blog/index.astro +++ b/examples/blog/src/pages/blog/index.astro @@ -11,7 +11,7 @@ const posts = (await getCollection('blog')).sort( ); --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> diff --git a/examples/blog/src/pages/index.astro b/examples/blog/src/pages/index.astro index 26f070da5..1c8be6135 100644 --- a/examples/blog/src/pages/index.astro +++ b/examples/blog/src/pages/index.astro @@ -5,7 +5,7 @@ import Footer from '../components/Footer.astro'; import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> @@ -16,14 +16,14 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; <h1>🧑🚀 Hello, Astronaut!</h1> <p> Welcome to the official <a href="https://astro.build/">Astro</a> blog starter template. This - template serves as a lightweight, minimally-styled starting point for anyone looking to build - a personal website, blog, or portfolio with Astro. + template serves as a lightweight, minimally-styled starting point for anyone looking to + build a personal website, blog, or portfolio with Astro. </p> <p> This template comes with a few integrations already configured in your <code>astro.config.mjs</code> file. You can customize your setup with - <a href="https://astro.build/integrations">Astro Integrations</a> to add tools like Tailwind, - React, or Vue to your project. + <a href="https://astro.build/integrations">Astro Integrations</a> to add tools like + Tailwind, React, or Vue to your project. </p> <p>Here are a few ideas on how to get started with the template:</p> <ul> diff --git a/examples/deno/src/components/Layout.astro b/examples/deno/src/components/Layout.astro index 7d329d0a4..7bcbd218c 100644 --- a/examples/deno/src/components/Layout.astro +++ b/examples/deno/src/components/Layout.astro @@ -6,7 +6,7 @@ interface Props { const { title } = Astro.props as Props; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> @@ -46,8 +46,15 @@ const { title } = Astro.props as Props; } :global(code) { - font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, - Bitstream Vera Sans Mono, Courier New, monospace; + font-family: + Menlo, + Monaco, + Lucida Console, + Liberation Mono, + DejaVu Sans Mono, + Bitstream Vera Sans Mono, + Courier New, + monospace; } </style> </body> diff --git a/examples/framework-lit/src/pages/index.astro b/examples/framework-lit/src/pages/index.astro index a351b8248..5ef314f6f 100644 --- a/examples/framework-lit/src/pages/index.astro +++ b/examples/framework-lit/src/pages/index.astro @@ -7,7 +7,7 @@ import { MyCounter } from '../components/my-counter.js'; // https://docs.astro.build/core-concepts/astro-components/ --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> diff --git a/examples/hackernews/src/pages/stories/[id].astro b/examples/hackernews/src/pages/stories/[id].astro index 84383aa9e..9cfad36fd 100644 --- a/examples/hackernews/src/pages/stories/[id].astro +++ b/examples/hackernews/src/pages/stories/[id].astro @@ -25,7 +25,7 @@ const story = (await fetchAPI(`item/${id}`)) as IStory; <a href={`/users/${story.user}`}> {story.user} </a> - {story.time_ago} + {story.time_ago} </p> </header> <main> diff --git a/examples/middleware/src/components/Card.astro b/examples/middleware/src/components/Card.astro index a1e0ccf6e..1ff16e5fb 100644 --- a/examples/middleware/src/components/Card.astro +++ b/examples/middleware/src/components/Card.astro @@ -30,7 +30,9 @@ const { href, title, body } = Astro.props; border-radius: 0.6rem; background-position: 100%; transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1); - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); + box-shadow: + 0 4px 6px -1px rgba(0, 0, 0, 0.1), + 0 2px 4px -2px rgba(0, 0, 0, 0.1); } .link-card > a { diff --git a/examples/middleware/src/layouts/Layout.astro b/examples/middleware/src/layouts/Layout.astro index b3def2637..90d2fb715 100644 --- a/examples/middleware/src/layouts/Layout.astro +++ b/examples/middleware/src/layouts/Layout.astro @@ -6,7 +6,7 @@ interface Props { const { title } = Astro.props; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> @@ -29,7 +29,14 @@ const { title } = Astro.props; background-color: #f6f6f6; } code { - font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, - Bitstream Vera Sans Mono, Courier New, monospace; + font-family: + Menlo, + Monaco, + Lucida Console, + Liberation Mono, + DejaVu Sans Mono, + Bitstream Vera Sans Mono, + Courier New, + monospace; } </style> diff --git a/examples/minimal/src/pages/index.astro b/examples/minimal/src/pages/index.astro index 7264ff502..2d1410736 100644 --- a/examples/minimal/src/pages/index.astro +++ b/examples/minimal/src/pages/index.astro @@ -1,4 +1,5 @@ --- + --- <html lang="en"> diff --git a/examples/portfolio/src/components/Nav.astro b/examples/portfolio/src/components/Nav.astro index bf9ac7869..d0a5857b1 100644 --- a/examples/portfolio/src/components/Nav.astro +++ b/examples/portfolio/src/components/Nav.astro @@ -25,7 +25,7 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[] <div class="menu-header"> <a href="/" class="site-title"> <Icon icon="terminal-window" color="var(--accent-regular)" size="1.6em" gradient /> - Jeanine White + Jeanine White </a> <menu-button> <template> @@ -321,7 +321,9 @@ const iconLinks: { label: string; href: string; icon: keyof typeof iconPaths }[] .link { padding: 0.5rem 1rem; border-radius: 999rem; - transition: color var(--theme-transition), background-color var(--theme-transition); + transition: + color var(--theme-transition), + background-color var(--theme-transition); } .link:hover, diff --git a/examples/portfolio/src/components/ThemeToggle.astro b/examples/portfolio/src/components/ThemeToggle.astro index d184e4eb3..88f7bf67c 100644 --- a/examples/portfolio/src/components/ThemeToggle.astro +++ b/examples/portfolio/src/components/ThemeToggle.astro @@ -54,7 +54,9 @@ import Icon from './Icon.astro'; @media (prefers-reduced-motion: no-preference) { .icon, .icon.light::before { - transition: transform var(--theme-transition), color var(--theme-transition); + transition: + transform var(--theme-transition), + color var(--theme-transition); } } diff --git a/examples/portfolio/src/layouts/BaseLayout.astro b/examples/portfolio/src/layouts/BaseLayout.astro index 1c7881961..235599abd 100644 --- a/examples/portfolio/src/layouts/BaseLayout.astro +++ b/examples/portfolio/src/layouts/BaseLayout.astro @@ -92,13 +92,18 @@ const { title, description } = Astro.props; min-height: 100%; isolation: isolate; background: - /*noise*/ url('/assets/backgrounds/noise.png') top center/220px repeat, + /*noise*/ + url('/assets/backgrounds/noise.png') top center/220px repeat, /*footer*/ var(--bg-image-footer) bottom center/var(--bg-gradient-size) no-repeat, /*header1*/ var(--bg-image-main-curves) top center/var(--bg-gradient-size) no-repeat, /*header2*/ var(--bg-image-main) top center/var(--bg-gradient-size) no-repeat, /*base*/ var(--gray-999); - background-blend-mode: /*noise*/ overlay, /*footer*/ var(--bg-blend-mode), - /*header1*/ var(--bg-svg-blend-mode), /*header2*/ normal, /*base*/ normal; + background-blend-mode: /*noise*/ + overlay, + /*footer*/ var(--bg-blend-mode), + /*header1*/ var(--bg-svg-blend-mode), + /*header2*/ normal, + /*base*/ normal; } @media (forced-colors: active) { /* Deactivate custom backgrounds for high contrast users. */ diff --git a/examples/portfolio/src/pages/about.astro b/examples/portfolio/src/pages/about.astro index 14e34ba81..f4fb02a72 100644 --- a/examples/portfolio/src/pages/about.astro +++ b/examples/portfolio/src/pages/about.astro @@ -25,9 +25,10 @@ import Hero from '../components/Hero.astro'; <div class="content"> <p> Lorem ipsum dolor sit amet, <a href="https://astro.build/">Astro</a> makes people happy. - Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Proin nibh nisl condimentum - id venenatis a condimentum vitae. Dapibus ultrices in iaculis nunc. Arcu odio ut sem nulla - pharetra diam sit amet. Diam quis enim lobortis scelerisque fermentum dui faucibus in ornare. + Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Proin nibh nisl + condimentum id venenatis a condimentum vitae. Dapibus ultrices in iaculis nunc. Arcu + odio ut sem nulla pharetra diam sit amet. Diam quis enim lobortis scelerisque fermentum + dui faucibus in ornare. </p> <p> Arcu dui vivamus arcu felis bibendum ut tristique et egestas. Eget gravida cum sociis diff --git a/examples/portfolio/src/pages/index.astro b/examples/portfolio/src/pages/index.astro index 2980f97d8..f7362284d 100644 --- a/examples/portfolio/src/pages/index.astro +++ b/examples/portfolio/src/pages/index.astro @@ -169,8 +169,10 @@ const projects = (await getCollection('work')) aspect-ratio: calc(2.25 / var(--bg-scale)); top: 0; transform: translateY(-75%) translateX(-50%); - background: url('/assets/backgrounds/noise.png') top center/220px repeat, - var(--hero-bg) center center / var(--bg-gradient-size) no-repeat, var(--gray-999); + background: + url('/assets/backgrounds/noise.png') top center/220px repeat, + var(--hero-bg) center center / var(--bg-gradient-size) no-repeat, + var(--gray-999); background-blend-mode: overlay, normal, normal, normal; mix-blend-mode: var(--bg-blend-mode); z-index: -1; diff --git a/examples/with-markdoc/src/layouts/Layout.astro b/examples/with-markdoc/src/layouts/Layout.astro index b1362340e..aaa6e0ce0 100644 --- a/examples/with-markdoc/src/layouts/Layout.astro +++ b/examples/with-markdoc/src/layouts/Layout.astro @@ -6,7 +6,7 @@ interface Props { const { title } = Astro.props; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> @@ -25,8 +25,15 @@ const { title } = Astro.props; background-color: #f6f6f6; } code { - font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, - Bitstream Vera Sans Mono, Courier New, monospace; + font-family: + Menlo, + Monaco, + Lucida Console, + Liberation Mono, + DejaVu Sans Mono, + Bitstream Vera Sans Mono, + Courier New, + monospace; } main { margin: auto; diff --git a/examples/with-nanostores/src/layouts/Layout.astro b/examples/with-nanostores/src/layouts/Layout.astro index 5927ebab9..86ba11a60 100644 --- a/examples/with-nanostores/src/layouts/Layout.astro +++ b/examples/with-nanostores/src/layouts/Layout.astro @@ -9,25 +9,27 @@ interface Props { const { title } = Astro.props; --- -<!DOCTYPE html> +<!doctype html> <html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width"> - <meta name="generator" content={Astro.generator} /> - <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> - <title>{title}</title> -</head> -<body> - <header> - <nav> - <a href="/" class="nav-header"><span style="color: var(--astro-blue)">Astro</span> storefront</a> - <CartFlyoutToggle client:load /> - </nav> - </header> - <slot /> - <CartFlyout client:load /> -</body> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width" /> + <meta name="generator" content={Astro.generator} /> + <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> + <title>{title}</title> + </head> + <body> + <header> + <nav> + <a href="/" class="nav-header" + ><span style="color: var(--astro-blue)">Astro</span> storefront</a + > + <CartFlyoutToggle client:load /> + </nav> + </header> + <slot /> + <CartFlyout client:load /> + </body> </html> <style is:global> @@ -35,14 +37,14 @@ const { title } = Astro.props; --font-family: system-ui, sans-serif; --font-size-base: clamp(1rem, 0.34vw + 0.91rem, 1.19rem); --font-size-lg: clamp(1.2rem, 0.7vw + 1.2rem, 1.5rem); - --font-size-xl: clamp(2.0rem, 1.75vw + 1.35rem, 2.75rem); + --font-size-xl: clamp(2rem, 1.75vw + 1.35rem, 2.75rem); --color-text: hsl(12, 5%, 4%); --color-bg: hsl(17, 20%, 97%); --color-bg-2: hsl(17, 20%, 94%); --color-bg-3: hsl(17, 20%, 88%); - --astro-blue: #4F39FA; - --astro-pink: #DA62C4; + --astro-blue: #4f39fa; + --astro-pink: #da62c4; --content-max-width: 90ch; --nav-height: clamp(2.44rem, 2.38vw + 1.85rem, 3.75rem); @@ -56,7 +58,9 @@ const { title } = Astro.props; border: none; color: var(--astro-blue); border: 2px solid var(--astro-blue); - transition: color 0.2s, background-color 0.2s; + transition: + color 0.2s, + background-color 0.2s; background-color: transparent; padding: 0.4rem 0.8rem; border-radius: 0.4rem; @@ -98,7 +102,8 @@ const { title } = Astro.props; align-items: center; } - .nav-header, .nav-header:visited { + .nav-header, + .nav-header:visited { font-size: var(--font-size-base); font-weight: bold; color: inherit; diff --git a/examples/with-vite-plugin-pwa/src/pages/index.astro b/examples/with-vite-plugin-pwa/src/pages/index.astro index 28af70e3b..19956b3d2 100644 --- a/examples/with-vite-plugin-pwa/src/pages/index.astro +++ b/examples/with-vite-plugin-pwa/src/pages/index.astro @@ -1,4 +1,5 @@ --- + --- <html lang="en"> diff --git a/examples/with-vitest/src/pages/index.astro b/examples/with-vitest/src/pages/index.astro index 7264ff502..2d1410736 100644 --- a/examples/with-vitest/src/pages/index.astro +++ b/examples/with-vitest/src/pages/index.astro @@ -1,4 +1,5 @@ --- + --- <html lang="en"> diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro index c0735c330..74c338333 100644 --- a/packages/astro/components/ViewTransitions.astro +++ b/packages/astro/components/ViewTransitions.astro @@ -102,14 +102,10 @@ const { fallback = 'animate' } = Astro.props as Props; function isInfinite(animation: Animation) { const effect = animation.effect; - if( - !effect || - !(effect instanceof KeyframeEffect) || - !effect.target - ) return false; - const style = window.getComputedStyle(effect.target, effect.pseudoElement); - return style.animationIterationCount === "infinite"; -} + if (!effect || !(effect instanceof KeyframeEffect) || !effect.target) return false; + const style = window.getComputedStyle(effect.target, effect.pseudoElement); + return style.animationIterationCount === 'infinite'; + } const parser = new DOMParser(); @@ -236,8 +232,10 @@ const { fallback = 'animate' } = Astro.props as Props; // Trigger the animations const currentAnimations = document.getAnimations(); document.documentElement.dataset.astroTransitionFallback = 'old'; - const newAnimations = document.getAnimations().filter(a => !currentAnimations.includes(a) && !isInfinite(a)); - const finished = Promise.all(newAnimations.map(a => a.finished)); + const newAnimations = document + .getAnimations() + .filter((a) => !currentAnimations.includes(a) && !isInfinite(a)); + const finished = Promise.all(newAnimations.map((a) => a.finished)); const fallbackSwap = () => { swap(); document.documentElement.dataset.astroTransitionFallback = 'new'; @@ -354,7 +352,7 @@ const { fallback = 'animate' } = Astro.props as Props; // The current page doesn't haven't View Transitions, // respect that with a full page reload // -- but only for transition managed by us (ev.state is set) - history.scrollRestoration && (history.scrollRestoration = "manual") + history.scrollRestoration && (history.scrollRestoration = 'manual'); location.reload(); return; } @@ -365,7 +363,7 @@ const { fallback = 'animate' } = Astro.props as Props; // The browser will handle navigation fine without our help if (ev.state === null) { if (history.scrollRestoration) { - history.scrollRestoration = "auto"; + history.scrollRestoration = 'auto'; } return; } @@ -373,7 +371,7 @@ const { fallback = 'animate' } = Astro.props as Props; // With the default "auto", the browser will jump to the old scroll position // before the ViewTransition is complete. if (history.scrollRestoration) { - history.scrollRestoration = "manual"; + history.scrollRestoration = 'manual'; } const state: State | undefined = history.state; @@ -404,13 +402,13 @@ const { fallback = 'animate' } = Astro.props as Props; addEventListener('load', onPageLoad); // There's not a good way to record scroll position before a back button. // So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position. - const updateState = () => { + const updateState = () => { // only update history entries that are managed by us // leave other entries alone and do not accidently add state. if (history.state) { persistState({ ...history.state, scrollY }); } - } + }; if ('onscrollend' in window) addEventListener('scrollend', updateState); else addEventListener('scroll', throttle(updateState, 300)); } |