Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const pageData = computed(() => page.value?.data)
const { health } = useModuleHealth()
// The health map loads on the client only: merge it once the modules section hydrated, or its server
// HTML (without the health badges) would not match.
// The features fade in once their section hydrates, which happens as it scrolls into view. CSS, not
// `<Motion>`: motion-v would be the homepage's largest preloaded dependency for this one effect.
const featuresRevealed = ref(false)
const modulesHydrated = ref(false)
const officialModulesWithHealth = computed(() =>
(officialModules.value || []).map(m => ({ ...m, health: (modulesHydrated.value && health.value[m.name]) || m.health || null }))
Expand Down Expand Up @@ -257,37 +260,32 @@ useNuxtBirthday()
root: 'bg-linear-to-b border-t border-default from-muted dark:from-muted/40 to-default',
features: 'xl:grid-cols-4 lg:gap-10'
}"
@hydrated="featuresRevealed = true"
>
<template #features>
<Motion
<li
v-for="(feature, index) in (pageData.features.features as any[])"
:key="feature.title"
as="li"
:initial="{ opacity: 0, transform: 'translateY(10px)' }"
:while-in-view="{ opacity: 1, transform: 'translateY(0)' }"
:transition="{ delay: 0.1 * index }"
:in-view-options="{ once: true }"
:class="featuresRevealed && 'feature-reveal'"
:style="{ animationDelay: `${index * 100}ms` }"
>
<UPageFeature
v-bind="pickFeature(feature)"
orientation="vertical"
/>
</Motion>
<Motion
as="li"
:initial="{ opacity: 0, transform: 'translateY(10px)' }"
:while-in-view="{ opacity: 1, transform: 'translateY(0)' }"
:transition="{ delay: 0.1 * pageData.features.features.length }"
:in-view-options="{ once: true }"
</li>
<li
class="flex flex-col justify-center gap-4 p-4 bg-muted/50 h-full"
:class="featuresRevealed && 'feature-reveal'"
:style="{ animationDelay: `${pageData.features.features.length * 100}ms` }"
>
<span class="text-lg font-semibold">
{{ pageData.features.cta.title }}
</span>
<div>
<UButton :to="pageData.features.cta.to" :label="pageData.features.cta.label" trailing :icon="pageData.features.cta.icon" />
</div>
</Motion>
</li>
</template>
</LazyUPageSection>

Expand Down Expand Up @@ -623,3 +621,22 @@ useNuxtBirthday()
</LazyUPageSection>
</div>
</template>

<style scoped>
.feature-reveal {
animation: feature-reveal 0.5s var(--ease-snappy) backwards;
}

@keyframes feature-reveal {
from {
opacity: 0;
transform: translateY(10px);
}
}

@media (prefers-reduced-motion: reduce) {
.feature-reveal {
animation: none;
}
}
</style>
14 changes: 14 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,20 @@ export default defineNuxtConfig({
component.global = false
}
}
},
'build:manifest': (manifest) => {
// `nuxt-workers` starts workers with `new Worker(new URL(…))`, which Vite lists as a script asset of
// the chunk that does it. The renderer then preloads it on every page: the 270 KB search worker,
// only needed once the palette opens, at a priority Lighthouse counts as render-blocking.
for (const chunk of Object.values(manifest)) {
for (const asset of chunk.assets ?? []) {
const resource = manifest[asset]
if (resource?.resourceType === 'script') {
resource.preload = false
resource.prefetch = false
}
}
}
}
},
agentDiscovery: {
Expand Down
Loading