An open source design system that's fully customizable and agent ready
TypeScript
docsite(landing): theme-swapping hero reel (#2738)
rubyycheung39df278c4bc1
diff --git a/apps/docsite/src/app/(site)/_landing/hero/AstryxWordmark.tsx b/apps/docsite/src/app/(site)/_landing/hero/AstryxWordmark.tsxnew file mode 100644index 0000000000..f079cc0b3d--- /dev/null+++ b/apps/docsite/src/app/(site)/_landing/hero/AstryxWordmark.tsx@@ -0,0 +1,48 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file AstryxWordmark.tsx+ * @input optional className/title for the rendered <svg>+ * @output The Astryx wordmark as an inline SVG that paints with `currentColor`+ * @position Home hero — theme-reactive brand wordmark.+ *+ * The shipped /astryx-logo.svg has the brand blue (#225BFF) baked into every+ * <path fill>, so it can't recolor with the active theme. This component is a+ * verbatim copy of that artwork with the fills swapped for `currentColor`, so+ * the wordmark inherits whatever text color its container sets — which lets the+ * hero tint it to each theme's accent as the showcase cycles.+ *+ * Kept as a hand-authored component (not an <img>) specifically so the glyph+ * geometry stays identical to the brand asset while the color becomes a+ * single inherited property. @xds/core has no general-purpose image/logo+ * primitive (XDSThumbnail is attachment chrome; XDSIcon is a glyph registry),+ * so an inline SVG is the right tool here.+ */++const VIEWBOX = '0 0 217 33';++export function AstryxWordmark({+ className,+ title = 'Astryx',+}: {+ className?: string;+ title?: string;+}) {+ return (+ <svg+ className={className}+ viewBox={VIEWBOX}+ fill="currentColor"+ role="img"+ aria-label={title}+ xmlns="http://www.w3.org/2000/svg">+ <title>{title}</title>+ <path d="M49.1872 31.0024C46.0231 30.1429 43.0415 28.8536 40.248 27.1345C40.06 27.0163 40.0117 26.7638 40.1406 26.5865L45.6846 19.0387C45.8028 18.8776 46.0284 18.84 46.195 18.9528C47.8872 20.1078 49.9017 21.021 52.244 21.6872C54.7205 22.3909 56.8532 22.7455 58.6475 22.7455C60.4418 22.7455 61.6827 22.5091 62.6175 22.031C63.5522 21.5529 64.0196 20.9351 64.0196 20.1722C64.0196 19.5652 63.7886 19.0871 63.332 18.7433C62.8753 18.3994 62.2468 18.2275 61.4464 18.2275C60.9521 18.2275 60.3881 18.249 59.7595 18.2866C59.131 18.3242 58.626 18.3618 58.2446 18.3994C56.2623 18.6251 54.2263 18.7433 52.1311 18.7433C48.7413 18.7433 45.9855 18.104 43.8742 16.8308C41.7576 15.5522 40.7047 13.4679 40.7047 10.5723C40.7047 7.22011 42.2841 4.62001 45.4482 2.77201C48.6124 0.924003 53.2593 0 59.3942 0C62.4026 0 65.4432 0.429768 68.5107 1.28393C71.4224 2.09512 74.0117 3.29847 76.2895 4.88324C76.4829 5.01754 76.5044 5.29689 76.3378 5.46343L70.2781 11.5769C70.1599 11.6951 69.9826 11.7219 69.8376 11.6413C67.7586 10.5669 65.8139 9.79871 63.9981 9.34208C62.1125 8.86397 60.2161 8.62759 58.3091 8.62759C56.9768 8.62759 55.8325 8.8962 54.8817 9.42804C53.9308 9.96525 53.4527 10.5723 53.4527 11.2599C53.4527 11.7918 53.6514 12.2108 54.0543 12.517C54.4519 12.8232 54.9784 12.9736 55.6284 12.9736C56.2784 12.9736 57.1702 12.9145 58.3144 12.8017C61.0972 12.6137 63.1708 12.517 64.5461 12.517C68.5107 12.517 71.5781 13.1831 73.7485 14.5154C75.9188 15.8477 77.004 17.8891 77.004 20.6289C77.004 24.7439 75.4031 27.7254 72.2013 29.5734C68.9995 31.4214 64.5783 32.3454 58.943 32.3454C55.7412 32.3454 52.4964 31.8995 49.198 31.0024H49.1872Z" />+ <path d="M38.5609 25.8618C38.3138 25.6899 38.1258 25.4857 37.9969 25.2547C37.6907 24.7175 37.5349 23.7935 37.5349 22.4881V15.6279C37.5349 10.3257 37.1158 4.70107 34.2579 2.14395C34.1182 2.0204 33.9785 1.90221 33.8335 1.78402C32.1628 0.435626 29.9871 -0.155307 27.9618 0.295949C26.7047 0.586043 25.6357 1.37574 25.0394 1.89683C23.8468 3.01423 22.3157 4.68496 21.2252 4.60975C20.0003 4.52379 19.0226 3.444 18.6627 2.26751C18.6627 2.26214 18.6627 2.2514 18.6573 2.24602C18.2651 0.945976 17.1316 0.00585938 15.7725 0.00585938H2.97614C1.33228 0.00585938 0 1.33814 0 2.982V7.17761C0 8.82147 1.33228 10.1538 2.97614 10.1538H21.2735C22.3103 10.1538 23.1162 10.3203 23.6963 10.6426C24.2712 10.9703 24.5612 11.3625 24.5612 11.8245C24.5612 12.3617 24.2712 12.8022 23.6963 13.1514C23.1215 13.4952 22.1223 13.6725 20.6987 13.6725C17.2391 13.6725 14.3543 13.8068 12.0496 14.0754L10.1479 14.3655C6.68827 14.9027 4.13115 15.8858 2.48191 17.304C0.827303 18.7276 0 20.6884 0 23.1865C0 26.2217 0.972349 28.5102 2.91168 30.0467C4.85101 31.5831 7.74657 32.3513 11.5876 32.3513C14.8915 32.3513 17.6151 31.5831 19.7478 30.0467C20.371 29.5954 20.9458 29.0689 21.483 28.4834V28.4995C21.483 28.4995 24.0294 25.3675 25.3295 28.4995V28.4887C25.5712 29.085 25.872 29.633 26.232 30.1326C27.3064 31.6153 29.4982 32.3513 32.8074 32.3513C34.3062 32.3513 35.5096 32.3137 36.4121 32.2385C36.6216 32.2224 36.8419 32.2009 37.0675 32.174C38.5287 32.0182 39.6515 30.8095 39.7159 29.3375L39.7536 28.5102C39.7965 27.4895 39.3936 26.4581 38.5609 25.8672V25.8618ZM24.6203 18.8028C23.8092 20.4682 22.3372 21.8058 20.1991 22.8319C18.061 23.8526 15.6597 24.363 13.0005 24.363C10.5293 24.363 9.29374 23.6753 9.29374 22.2947C9.29374 21.0108 10.6206 20.1083 13.2852 19.5872L15.8531 19.1574C17.8031 18.8727 19.4631 18.5772 20.8438 18.2656C22.219 17.9594 23.4815 17.5189 24.6203 16.9495V18.8028Z" />+ <path d="M177.884 0H169.315C167.349 0 165.754 0.854163 165.754 1.91247V12.474C165.754 13.1187 164.776 13.6451 163.573 13.6451C162.369 13.6451 161.392 13.1187 161.392 12.474V1.91247C161.392 0.859535 159.796 0 157.83 0H149.261C147.295 0 145.7 0.854163 145.7 1.91247V9.41193C145.7 13.7794 151.142 17.4593 158.582 18.6197H158.571C159.452 18.7057 159.237 19.5491 159.237 19.5491L156.97 30.0515C156.675 31.2173 157.556 32.3508 158.759 32.3508H168.375C169.579 32.3508 170.46 31.2173 170.164 30.0515L167.897 19.5491C167.897 19.5491 167.682 18.7057 168.563 18.6251H168.558C175.998 17.4647 181.44 13.7794 181.44 9.41193V1.91247C181.44 0.859535 179.845 0 177.879 0H177.884Z" />+ <path d="M144.797 31.6047L144.4 31.4166C144.324 31.379 144.265 31.3253 144.228 31.2555L137.958 20.0117C145.716 17.1913 144.163 10.1431 144.163 10.1431C142.826 -0.0800041 127.88 0.0596691 127.88 0.0596691H115.39C114.96 0.0596691 114.848 0.655977 115.245 0.811768L115.933 1.08574C116.083 1.14484 116.18 1.28988 116.18 1.45104V31.148C116.18 31.3199 116.072 31.465 115.911 31.5187L115.707 31.5832C115.283 31.7228 115.385 32.346 115.825 32.346H126.5C126.951 32.346 127.042 31.7014 126.607 31.5778C126.441 31.5294 126.328 31.3844 126.322 31.2125L126.048 20.0815C126.967 20.5757 128.869 20.8551 128.869 20.8551L133.908 30.4443C133.994 30.6054 133.956 30.8096 133.811 30.9278L132.941 31.653C132.662 31.8894 132.828 32.346 133.193 32.346H144.636C145.05 32.346 145.179 31.7819 144.802 31.6047H144.797ZM126.913 18.024V2.18165C126.913 2.18165 132.624 1.37584 133.757 10.7072C133.757 10.7072 135.036 20.9518 126.913 18.024Z" />+ <path d="M79 0.262695V9.80568H86.0628C88.2323 9.80568 89.9956 11.6463 89.9956 13.922V32.2627H102.004V13.922C102.004 11.6513 103.763 9.80568 105.937 9.80568H113V0.262695H79Z" />+ <path d="M211.409 15.351C214.496 15.351 217 12.8469 217 9.76046V3.72734C217 1.78812 215.428 0.209961 213.483 0.209961H207.449C204.363 0.209961 201.859 2.71406 201.859 5.8005V7.07584C201.638 7.97265 200.362 7.97265 200.141 7.07584V5.8005C200.141 2.71406 197.637 0.209961 194.55 0.209961H188.517C186.572 0.209961 185 1.7823 185 3.72734V9.76046C185 12.8469 187.504 15.351 190.591 15.351H191.866C192.763 15.5723 192.763 16.8476 191.866 17.0689H190.591C187.504 17.0689 185 19.573 185 22.6595V28.6926C185 30.6318 186.572 32.21 188.517 32.21H194.55C197.637 32.21 200.141 29.7059 200.141 26.6194V25.3441C200.362 24.4473 201.638 24.4473 201.859 25.3441V26.6194C201.859 29.7059 204.363 32.21 207.449 32.21H213.483C215.422 32.21 217 30.6376 217 28.6926V22.6595C217 19.573 214.496 17.0689 211.409 17.0689H208.142V15.351H211.409Z" />+ </svg>+ );+}diff --git a/apps/docsite/src/app/(site)/_landing/hero/HeroFloatingCards.tsx b/apps/docsite/src/app/(site)/_landing/hero/HeroFloatingCards.tsxnew file mode 100644index 0000000000..1eaff5bea0--- /dev/null+++ b/apps/docsite/src/app/(site)/_landing/hero/HeroFloatingCards.tsx@@ -0,0 +1,551 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++'use client';++/**+ * @file HeroFloatingCards.tsx+ * @input HeroThemeContent for the active theme + a `mounted` flag for entrance+ * @output The decorative themed UI cards that flank the hero wordmark+ * @position Home hero — themed "mini storefront" surfaces that re-skin per theme.+ *+ * Cards are real @xds/core components, so wrapping the set in <XDSTheme> re-skins+ * them per theme. The whole layer is decorative: aria-hidden + inert + no pointer+ * events. layout="overlap" is the desktop art composition; layout="stack" is the+ * narrow-screen grid collage.+ */++import * as stylex from '@stylexjs/stylex';+import {Plus, Sparkles} from 'lucide-react';+import {XDSCard} from '@xds/core/Card';+import {XDSBadge} from '@xds/core/Badge';+import {XDSButton} from '@xds/core/Button';+import {XDSText, XDSHeading} from '@xds/core/Text';+import {XDSVStack, XDSHStack} from '@xds/core/Layout';+import {XDSChatComposer, XDSChatSendButton} from '@xds/core/Chat';+import {XDSProgressBar} from '@xds/core/ProgressBar';+import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';+import {XDSAvatar} from '@xds/core/Avatar';+import {XDSAspectRatio} from '@xds/core/AspectRatio';+import type {HeroThemeContent} from './heroThemeContent';++const styles = stylex.create({+ // Desktop overlap stage: fixed, viewport-centered 1200px box (shared with the+ // aurora blobs) so cards track the blobs on resize. Capped to 100vw to avoid+ // horizontal scroll. Hidden <1024px, where the collage takes over.+ stage: {+ position: 'fixed',+ top: 'var(--appshell-header-height, 0px)',+ left: '50%',+ transform: 'translateX(-50%)',+ width: 'min(1200px, 100vw)',+ height: 1050,+ pointerEvents: 'none',+ display: {+ default: 'none',+ '@media (min-width: 1024px)': 'block',+ },+ },+ // Narrow-screen collage grid. <768px: 2 columns (product|reward, side below).+ // 768–1024px: 3 columns (product | reward | side group). In flow inside the+ // fixed hero content, so it's pinned and sits --hero-gap below the text.+ collage: {+ display: {+ default: 'grid',+ '@media (min-width: 1024px)': 'none',+ },+ gridTemplateColumns: {+ default: '1fr 1fr',+ '@media (min-width: 768px)': '1fr 1fr minmax(0, 240px)',+ },+ gridTemplateAreas: {+ default: '"product reward" "side side"',+ '@media (min-width: 768px)': '"product reward side"',+ },+ // Stretch so product/reward match the (taller) side column's height.+ alignItems: 'stretch',+ justifyContent: 'center',+ textAlign: 'start',+ columnGap: 'var(--spacing-4)',+ rowGap: 'var(--spacing-4)',+ width: '100%',+ maxWidth: {+ default: 520,+ '@media (min-width: 768px)': 1200,+ },+ marginInline: 'auto',+ paddingInline: 'var(--spacing-6)',+ boxSizing: 'border-box',+ zIndex: 0,+ pointerEvents: 'none',+ },+ // Breaks the collage out of the 800px hero text column to span the viewport so+ // the inner grid can center at the shared 1200px content width.+ collageBleed: {+ display: {+ default: 'block',+ '@media (min-width: 1024px)': 'none',+ },+ width: '100vw',+ marginInline: 'calc(50% - 50vw)',+ marginBlockStart: 'var(--hero-gap)',+ },+ gaProduct: {+ gridArea: 'product',+ display: 'flex',+ minWidth: 0,+ minHeight: 0,+ textAlign: 'start',+ },+ gaReward: {+ gridArea: 'reward',+ display: 'flex',+ minWidth: 0,+ minHeight: 0,+ textAlign: 'start',+ },+ // Side group: flex column of the small items with a uniform gap. alignSelf+ // start so it keeps its natural height (it's the row-height ruler).+ gaSide: {+ gridArea: 'side',+ display: 'flex',+ flexDirection: 'column',+ alignSelf: 'start',+ gap: 'var(--spacing-3)',+ minWidth: 0,+ textAlign: 'start',+ },+ // Radio + badge on one row, shrink to content.+ collagePillRow: {+ display: 'flex',+ flexDirection: 'row',+ alignItems: 'center',+ justifyContent: 'flex-start',+ flexWrap: 'wrap',+ gap: 'var(--spacing-2)',+ },+ // Per-card reset in the collage: drop the overlap positioning + scaled pose.+ stackCard: {+ position: 'static',+ width: '100%',+ transform: 'none',+ opacity: 1,+ },+ collageProductBody: {+ height: '100%',+ },+ // Image fills the card height without adding intrinsic height (flexBasis:0 ++ // absolutely-filled img), so the side group stays the row-height ruler. minH+ // gives a real height in 2-col (own row, nothing to stretch it); 0 in 3-col.+ collageImageFill: {+ position: 'relative',+ flexGrow: 1,+ flexBasis: 0,+ minHeight: {+ default: 180,+ '@media (min-width: 768px)': 0,+ },+ overflow: 'hidden',+ borderRadius: 'var(--radius-element)',+ },+ collageImageAbs: {+ position: 'absolute',+ inset: 0,+ width: '100%',+ height: '100%',+ objectFit: 'cover',+ },+ collageRewardCard: {+ display: 'flex',+ flexDirection: 'column',+ height: '100%',+ },+ // See collageImageFill.+ collageRewardImage: {+ position: 'relative',+ flexGrow: 1,+ flexBasis: 0,+ minHeight: {+ default: 180,+ '@media (min-width: 768px)': 0,+ },+ overflow: 'hidden',+ },+ // Shared base for the overlap-layout floating cards.+ floater: {+ position: 'absolute',+ transitionProperty: 'transform, opacity',+ transitionDuration: 'var(--duration-slow, 600ms)',+ transitionTimingFunction: 'var(--ease-standard, ease)',+ willChange: 'transform, opacity',+ },+ // Overlap cards render at 0.85x (baked into the pose transforms).+ hiddenPose: {+ opacity: 0,+ transform: 'translateY(14px) scale(0.82)',+ },+ shownPose: {+ opacity: 1,+ transform: 'translateY(0) scale(0.85)',+ },+ // Cards scale from their top-left anchor so they don't drift on scale.+ originTopLeft: {+ transformOrigin: 'top left',+ },++ // Shared image helpers.+ imageFrame: {+ overflow: 'hidden',+ borderRadius: 'var(--radius-element)',+ },+ image: {+ width: '100%',+ height: '100%',+ objectFit: 'cover',+ display: 'block',+ },+ // Description capped at two lines (truncates with an ellipsis).+ productDescription: {+ display: '-webkit-box',+ WebkitBoxOrient: 'vertical',+ WebkitLineClamp: 2,+ overflow: 'hidden',+ },++ // ── Overlap-layout positions (desktop). left % sits each card over its aurora+ // blob; the px tops/widths are art-directed. ──────────────────────────────+ productCard: {+ left: '-8%',+ top: 340,+ width: 312,+ boxShadow: 'var(--shadow-high)',+ borderWidth: 0,+ // overflow visible so the chat bubble can break past the card edge.+ overflow: 'visible',+ },+ // Relative so the chat bubble can anchor to the image.+ productImageWrap: {+ position: 'relative',+ },+ // Positions the composer breaking out past the product card's right edge.+ chatBubble: {+ position: 'absolute',+ left: '5%',+ right: 'calc(-1 * var(--spacing-12))',+ bottom: 'var(--spacing-5)',+ transform: 'translateX(var(--spacing-12))',+ pointerEvents: 'none',+ cursor: 'default',+ },+ // Neutral card surface so the composer doesn't pick up the theme's tinted+ // --color-background-popover (e.g. pink on Y2K).+ composerSurface: {+ backgroundColor: 'var(--color-background-card)',+ },+ featureCard: {+ left: '88%',+ top: 380,+ width: 304,+ boxShadow: 'var(--shadow-high)',+ borderWidth: 0,+ overflow: 'hidden',+ },+ // padding for the reward footer (the feature card is padding={0}).+ rewardFooter: {+ padding: 'var(--spacing-4)',+ },+ profileRow: {+ marginBlockStart: 'var(--spacing-2)',+ },+ pillLeading: {+ left: '-11%',+ top: 304,+ },+ pillTrailing: {+ left: '104%',+ top: 326,+ },+ // Bare radio + label — no surface.+ radioPillCard: {+ backgroundColor: 'transparent',+ borderWidth: 0,+ boxShadow: 'none',+ whiteSpace: 'nowrap',+ },+ buyCard: {+ left: '80%',+ top: 480,+ width: 248,+ boxShadow: 'var(--shadow-high)',+ borderWidth: 0,+ },+ buyThumbFrame: {+ width: 'var(--spacing-12)',+ height: 'var(--spacing-12)',+ flexShrink: 0,+ overflow: 'hidden',+ borderRadius: 'var(--radius-element)',+ },+ fullWidth: {+ width: '100%',+ },+ buyDescription: {+ display: '-webkit-box',+ WebkitBoxOrient: 'vertical',+ WebkitLineClamp: 1,+ overflow: 'hidden',+ },+});++export function HeroFloatingCards({+ content,+ mounted,+ layout = 'overlap',+}: {+ content: HeroThemeContent;+ mounted: boolean;+ /** 'overlap' = desktop fixed art layout; 'stack' = mobile flow column. */+ layout?: 'overlap' | 'stack';+}) {+ const stack = layout === 'stack';+ // In the stacked layout cards render full-size in flow (no entrance pose).+ const pose = stack+ ? styles.stackCard+ : mounted+ ? styles.shownPose+ : styles.hiddenPose;++ // ── Card bodies (shared by both layouts) ──────────────────────────────+ const badgeEl = (+ <XDSBadge+ variant="green"+ label={content.pills.leading}+ icon={<Sparkles size={12} />}+ />+ );++ const radioEl = (+ <XDSCard padding={2} xstyle={styles.radioPillCard}>+ <XDSRadioList+ label={content.pills.trailing}+ isLabelHidden+ value="selected"+ onChange={() => {}}+ size="sm">+ <XDSRadioListItem label={content.pills.trailing} value="selected" />+ </XDSRadioList>+ </XDSCard>+ );++ const composerEl = (+ <XDSChatComposer+ value=""+ onChange={() => {}}+ onSubmit={() => {}}+ placeholder={content.chatPrompt}+ xstyle={styles.composerSurface}+ footerActions={+ <XDSButton+ variant="secondary"+ size="md"+ isIconOnly+ icon={<Plus size={16} />}+ label="Add attachment"+ />+ }+ sendButton={<XDSChatSendButton isDisabled={false} />}+ />+ );++ // Product card body. In overlap mode the composer breaks out over the image;+ // in collage mode the composer is a separate column item, so it's omitted.+ const productCardEl = (+ <XDSCard+ padding={4}+ xstyle={+ stack+ ? [styles.stackCard]+ : [styles.floater, styles.productCard, styles.originTopLeft, pose]+ }>+ <XDSVStack gap={4} xstyle={stack ? styles.collageProductBody : undefined}>+ <XDSVStack gap={1}>+ <XDSHeading level={2}>{content.product.title}</XDSHeading>+ <XDSText+ type="body"+ color="secondary"+ xstyle={styles.productDescription}>+ {content.product.description}+ </XDSText>+ </XDSVStack>+ {stack ? (+ // Collage: image grows to fill the card's stretched height.+ <div {...stylex.props(styles.collageImageFill)}>+ <img+ src={content.product.image}+ alt=""+ {...stylex.props(styles.collageImageAbs)}+ />+ </div>+ ) : (+ <div {...stylex.props(styles.productImageWrap)}>+ <div {...stylex.props(styles.imageFrame)}>+ <XDSAspectRatio ratio={1}>+ <img+ src={content.product.image}+ alt=""+ {...stylex.props(styles.image)}+ />+ </XDSAspectRatio>+ </div>+ {/* Overlap-only: composer breaks out past the card edge over the+ photo. In collage mode the composer is its own column item. */}+ <div {...stylex.props(styles.chatBubble)}>{composerEl}</div>+ </div>+ )}+ </XDSVStack>+ </XDSCard>+ );++ const rewardCardEl = (+ <XDSCard+ padding={0}+ xstyle={+ stack+ ? [styles.stackCard, styles.collageRewardCard]+ : [styles.floater, styles.featureCard, styles.originTopLeft, pose]+ }>+ {stack ? (+ // Collage: image grows to fill the card's stretched height.+ <div {...stylex.props(styles.collageRewardImage)}>+ <img+ src={content.feature.image}+ alt=""+ {...stylex.props(styles.collageImageAbs)}+ />+ </div>+ ) : (+ <XDSAspectRatio ratio={1}>+ <img+ src={content.feature.image}+ alt=""+ {...stylex.props(styles.image)}+ />+ </XDSAspectRatio>+ )}+ <div {...stylex.props(styles.rewardFooter)}>+ <XDSVStack gap={2}>+ <XDSHStack gap={2} hAlign="between" vAlign="center">+ <XDSText type="body" weight="semibold">+ {content.reward.label}+ </XDSText>+ <XDSText type="supporting" color="secondary">+ {content.reward.value}/{content.reward.total}+ </XDSText>+ </XDSHStack>+ <XDSProgressBar+ label={content.reward.label}+ isLabelHidden+ value={content.reward.value}+ max={content.reward.total}+ variant="accent"+ />+ <XDSHStack gap={2} vAlign="center" xstyle={styles.profileRow}>+ <XDSAvatar name={content.reward.member} size="xsmall" />+ <XDSText type="supporting" color="secondary">+ {content.reward.member}+ </XDSText>+ </XDSHStack>+ </XDSVStack>+ </div>+ </XDSCard>+ );++ const buyCardEl = (+ <XDSCard+ padding={3}+ xstyle={+ stack+ ? [styles.stackCard]+ : [styles.floater, styles.buyCard, styles.originTopLeft, pose]+ }>+ <XDSVStack gap={3}>+ <XDSHStack gap={3} vAlign="center">+ <div {...stylex.props(styles.buyThumbFrame)}>+ <img+ src={content.mini.image}+ alt=""+ {...stylex.props(styles.image)}+ />+ </div>+ <XDSVStack gap={1} xstyle={styles.fullWidth}>+ <XDSHeading level={3}>{content.mini.title}</XDSHeading>+ <XDSText+ type="supporting"+ color="secondary"+ xstyle={styles.buyDescription}>+ {content.mini.description}+ </XDSText>+ </XDSVStack>+ </XDSHStack>+ <XDSButton+ variant="secondary"+ size="md"+ label="Add to cart"+ xstyle={styles.fullWidth}+ />+ </XDSVStack>+ </XDSCard>+ );++ // ── Collage layout (narrow screens): CSS grid ─────────────────────────+ // Three areas reflow per tier: 560–1024px → product | reward | side (the+ // small items stacked in col 3); <768px → product | reward on top, side full+ // width below. The side group is one flex column so its items keep a uniform+ // gap (separate grid rows would stretch to the tall cards and look uneven).+ if (stack) {+ return (+ <div {...stylex.props(styles.collageBleed)} aria-hidden="true" inert>+ <div {...stylex.props(styles.collage)}>+ <div {...stylex.props(styles.gaProduct)}>{productCardEl}</div>+ <div {...stylex.props(styles.gaReward)}>{rewardCardEl}</div>+ <div {...stylex.props(styles.gaSide)}>+ {buyCardEl}+ {composerEl}+ <div {...stylex.props(styles.collagePillRow)}>+ {radioEl}+ {badgeEl}+ </div>+ </div>+ </div>+ </div>+ );+ }++ // ── Overlap layout (desktop): fixed art composition ───────────────────+ return (+ <div {...stylex.props(styles.stage)} aria-hidden="true" inert>+ {/* Leading pill */}+ <div+ {...stylex.props(+ styles.floater,+ styles.pillLeading,+ styles.originTopLeft,+ pose,+ )}>+ {badgeEl}+ </div>+ {/* Trailing pill — a selected radio option wrapped in a pill card */}+ <div+ {...stylex.props(+ styles.floater,+ styles.pillTrailing,+ styles.originTopLeft,+ pose,+ )}>+ {radioEl}+ </div>+ {productCardEl}+ {rewardCardEl}+ {buyCardEl}+ </div>+ );+}diff --git a/apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsx b/apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsxnew file mode 100644index 0000000000..a7de7a6224--- /dev/null+++ b/apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsx@@ -0,0 +1,355 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++'use client';++/**+ * @file HeroThemeReel.tsx+ * @input none (reads the generated theme registry via heroThemeContent)+ * @output Provider + placed pieces (wordmark, cards, dots) consumed by page.tsx+ * @position Home hero — orchestrates the per-theme reel behind the headline.+ *+ * The cycling state (active index + auto-advance clock) lives in HeroReelProvider+ * so the wordmark, cards, and dots — placed in different parts of the DOM by+ * page.tsx — re-skin together. Auto-advance pauses on hover/focus and when the+ * tab is hidden, and respects prefers-reduced-motion.+ */++import {+ createContext,+ useCallback,+ useContext,+ useEffect,+ useMemo,+ useState,+ type ReactNode,+} from 'react';+import * as stylex from '@stylexjs/stylex';+import {XDSTheme} from '@xds/core/theme';+import {XDSText} from '@xds/core/Text';+import {XDSPagination} from '@xds/core/Pagination';+import {useMediaQuery} from '@xds/core/hooks';+import {HERO_THEME_SLIDES, type HeroThemeSlide} from './heroThemeContent';+import {AstryxWordmark} from './AstryxWordmark';+import {HeroFloatingCards} from './HeroFloatingCards';++// How long each theme stays on screen before auto-advancing (ms).+const ADVANCE_INTERVAL_MS = 4500;++// Auto-advance carousel master switch.+const AUTOPLAY_ENABLED = true;++interface HeroReelState {+ slides: ReadonlyArray<HeroThemeSlide>;+ index: number;+ goTo: (i: number) => void;+ /** Whether entrance/cycle animation should run (false under reduced-motion). */+ animate: boolean;+ setPaused: (paused: boolean) => void;+}++const HeroReelContext = createContext<HeroReelState | null>(null);++function useHeroReel(): HeroReelState | null {+ return useContext(HeroReelContext);+}++/**+ * Whether the active reel slide is a dark-first theme. The hero text + nav use+ * this to switch to light colors on dark slides (e.g. Gothic) so they stay+ * readable on the dark per-slide background.+ */+export function useHeroReelIsDark(): boolean {+ const reel = useContext(HeroReelContext);+ if (!reel || reel.slides.length === 0) {+ return false;+ }+ return reel.slides[reel.index]?.isDark ?? false;+}++const styles = stylex.create({+ // Centers the wordmark SVG; it paints with currentColor (set per-slide).+ wordmarkWrap: {+ position: 'relative',+ zIndex: 1,+ display: 'flex',+ justifyContent: 'center',+ transitionProperty: 'color',+ transitionDuration: 'var(--duration-medium, 300ms)',+ transitionTimingFunction: 'var(--ease-standard, ease)',+ },+ // Hero-scale wordmark, smaller on narrow screens.+ wordmark: {+ width: {+ default: 'min(360px, 70%)',+ '@media (min-width: 768px)': 'min(440px, 70%)',+ '@media (min-width: 1024px)': 'min(520px, 70%)',+ },+ height: 'auto',+ },+ // Sticky, zero-height layer hosting the overlap cards so they pin with the+ // hero and don't intercept clicks.+ cardsLayer: {+ position: 'sticky',+ top: 'var(--appshell-header-height, 0px)',+ height: 0,+ width: '100%',+ pointerEvents: 'none',+ zIndex: 0,+ },+ // Per-slide body fill behind the hero (resolves to the active theme's body+ // color). Covers the band + a page-radius extra so the color sits behind the+ // showcase's rounded top corners (no cream notch on dark themes like Gothic).+ themeFill: {+ position: 'absolute',+ top: 0,+ left: 0,+ right: 0,+ height: {+ default:+ 'calc(var(--hero-content-height, 760px) + var(--radius-page, 24px))',+ '@media (min-width: 1024px)': 'calc(760px + var(--radius-page, 24px))',+ },+ backgroundColor: 'var(--color-background-body)',+ pointerEvents: 'none',+ transition: 'background-color 600ms ease',+ },+ // Per-slide band behind the transparent top nav so it retints too.+ navBackdrop: {+ position: 'fixed',+ top: 0,+ left: 0,+ right: 0,+ height: 'var(--appshell-header-height, 64px)',+ backgroundColor: 'var(--color-background-body)',+ pointerEvents: 'none',+ transition: 'background-color 600ms ease',+ zIndex: 0,+ },+ // Blurred aurora glow — fixed, in the same 1200px box as the cards so blobs+ // and cards stay aligned. Capped to 100vw to avoid horizontal scroll. Blob+ // centers sit under the card clusters; colors come from --aurora-* per slide.+ backdropGlow: {+ position: 'fixed',+ top: 'var(--appshell-header-height, 0px)',+ left: '50%',+ transform: 'translateX(-50%)',+ width: 'min(1200px, 100vw)',+ height: 1050,+ pointerEvents: 'none',+ opacity: 0.5,+ transition: 'background-image 800ms ease',+ filter: 'blur(60px)',+ backgroundImage:+ 'radial-gradient(circle 220px at 5% 75%, var(--aurora-left), var(--aurora-left) 90%, transparent 100%), ' ++ 'radial-gradient(circle 200px at 72% 85%, var(--aurora-center), var(--aurora-center) 90%, transparent 100%), ' ++ 'radial-gradient(circle 260px at 92% 65%, var(--aurora-right), var(--aurora-right) 90%, transparent 100%)',+ // Visible at all widths (behind the collage on narrow + overlap on desktop).+ display: 'block',+ },+ // Centers the pagination dots with breathing room above.+ dots: {+ display: 'flex',+ justifyContent: 'center',+ marginBlockStart: 'var(--spacing-6)',+ },+ srOnly: {+ position: 'absolute',+ width: 1,+ height: 1,+ padding: 0,+ margin: -1,+ overflow: 'hidden',+ clip: 'rect(0, 0, 0, 0)',+ whiteSpace: 'nowrap',+ borderWidth: 0,+ },+});++// Dynamic per-theme values via stylex.create functions (no inline styles).+const dynamic = stylex.create({+ wordmarkColor: (color: string) => ({color}),+ aurora: (left: string, center: string, right: string) => ({+ '--aurora-left': left,+ '--aurora-center': center,+ '--aurora-right': right,+ }),+});++/**+ * Owns the cycling state + auto-advance clock and exposes them via context.+ * Renders no DOM of its own beyond the provider + a hover/focus wrapper so the+ * hero can pause cycling while the user interacts with it.+ */+export function HeroReelProvider({children}: {children: ReactNode}) {+ const slides = HERO_THEME_SLIDES;+ const [index, setIndex] = useState(0);+ const [paused, setPaused] = useState(false);+ const reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');++ const goTo = useCallback(+ (next: number) => {+ const count = slides.length;+ if (count === 0) {+ return;+ }+ setIndex(((next % count) + count) % count);+ },+ [slides.length],+ );++ useEffect(() => {+ if (!AUTOPLAY_ENABLED || reduceMotion || paused || slides.length <= 1) {+ return;+ }+ const id = window.setInterval(() => {+ setIndex(i => (i + 1) % slides.length);+ }, ADVANCE_INTERVAL_MS);+ return () => window.clearInterval(id);+ }, [reduceMotion, paused, slides.length]);++ useEffect(() => {+ const onVisibility = () => setPaused(document.hidden);+ document.addEventListener('visibilitychange', onVisibility);+ return () => document.removeEventListener('visibilitychange', onVisibility);+ }, []);++ const value = useMemo<HeroReelState>(+ () => ({slides, index, goTo, animate: !reduceMotion, setPaused}),+ [slides, index, goTo, reduceMotion],+ );++ return (+ <HeroReelContext value={value}>+ <div+ onMouseEnter={() => setPaused(true)}+ onMouseLeave={() => setPaused(false)}+ onFocusCapture={() => setPaused(true)}+ onBlurCapture={() => setPaused(false)}>+ {children}+ </div>+ </HeroReelContext>+ );+}++/** Themed, recolorable Astryx wordmark for the centered content column. */+export function HeroReelWordmark() {+ const reel = useHeroReel();++ if (!reel || reel.slides.length === 0) {+ // Fallback: render the static brand wordmark in the default accent so the+ // hero still has a brand mark even if no themes are registered.+ return (+ <div+ {...stylex.props(+ styles.wordmarkWrap,+ dynamic.wordmarkColor('var(--color-text-accent)'),+ )}>+ <AstryxWordmark className={stylex.props(styles.wordmark).className} />+ </div>+ );+ }++ const active = reel.slides[reel.index];+ return (+ <XDSTheme theme={active.theme} mode={active.mode}>+ <div+ {...stylex.props(+ styles.wordmarkWrap,+ dynamic.wordmarkColor(active.wordmarkColor),+ )}>+ <AstryxWordmark className={stylex.props(styles.wordmark).className} />+ </div>+ </XDSTheme>+ );+}++/** Full-bleed floating cards layer for the hero gutters. */+export function HeroReelCards() {+ const reel = useHeroReel();+ const [mounted, setMounted] = useState(false);+ useEffect(() => {+ setMounted(true);+ }, []);++ if (!reel || reel.slides.length === 0) {+ return null;+ }++ const active = reel.slides[reel.index];+ // Entrance animation only runs when motion is allowed; otherwise cards are+ // shown in their resting pose immediately.+ const shown = reel.animate ? mounted : true;++ return (+ <XDSTheme theme={active.theme} mode={active.mode}>+ <div {...stylex.props(styles.themeFill)} aria-hidden="true" />+ <div {...stylex.props(styles.navBackdrop)} aria-hidden="true" />+ <div+ aria-hidden="true"+ {...stylex.props(+ styles.backdropGlow,+ dynamic.aurora(+ active.aurora.left,+ active.aurora.center,+ active.aurora.right,+ ),+ )}+ />+ {/* Floating cards layer */}+ <div {...stylex.props(styles.cardsLayer)}>+ <HeroFloatingCards content={active.content} mounted={shown} />+ </div>+ </XDSTheme>+ );+}++/**+ * Narrow-screen (collage) variant of the hero cards, placed after the hero text+ * in page.tsx. Self-hides at ≥1024px, where HeroReelCards (overlap) takes over.+ */+export function HeroReelStack() {+ const reel = useHeroReel();+ if (!reel || reel.slides.length === 0) {+ return null;+ }+ const active = reel.slides[reel.index];+ return (+ <XDSTheme theme={active.theme} mode={active.mode}>+ <HeroFloatingCards content={active.content} mounted layout="stack" />+ </XDSTheme>+ );+}++/** Dot controls + a polite live region announcing the active theme. */+export function HeroReelDots() {+ const reel = useHeroReel();+ if (!reel || reel.slides.length <= 1) {+ return null;+ }+ const {slides, index, goTo} = reel;+ const active = slides[index];++ return (+ <>+ {/* Real XDSPagination (dots variant). It's 1-indexed, so page = index+1.+ The prev/next chevrons it ships with are hidden on the home page via+ a [data-home-page] CSS rule in globals.css, leaving just the dots. */}+ <div {...stylex.props(styles.dots)}>+ <XDSPagination+ variant="dots"+ label="Preview Astryx themes"+ page={index + 1}+ totalPages={slides.length}+ onChange={p => goTo(p - 1)}+ />+ </div>+ <XDSText+ as="span"+ type="supporting"+ aria-live="polite"+ xstyle={styles.srOnly}>+ {active.label} theme+ </XDSText>+ </>+ );+}diff --git a/apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts b/apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.tsnew file mode 100644index 0000000000..cd8c9d06f6--- /dev/null+++ b/apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts@@ -0,0 +1,369 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file heroThemeContent.ts+ * @input the docsite theme package registry (generated) + the local Astryx theme+ * @output an ordered list of {theme, label, content} slides the hero cycles+ * @position Home hero — single source of truth for the theming showcase reel.+ *+ * Per-theme content (copy + product photos) for the reel's cards, plus the+ * curated theme list/order (REEL_THEMES) and per-theme aurora/wordmark/mode.+ */++import type {XDSDefinedTheme} from '@xds/core/theme';+import {packages} from '../../../../generated/packageRegistry';+import {themeObjects} from '../../../../generated/themeRegistry';+import {astryxTheme} from '../../../../themes/astryxTheme';++// Sentinel for the docsite's local brand theme (not an @xds/theme-* package).+const ASTRYX = 'astryx';++export interface HeroThemeContent {+ /** Product card (image + title/description + price). */+ product: {+ image: string;+ title: string;+ description: string;+ price: string;+ };+ /** Feature/reward card image + title/price. */+ feature: {+ image: string;+ title: string;+ price: string;+ };+ /** The buy card (thumbnail + title/description + cart). */+ mini: {+ image: string;+ title: string;+ description: string;+ };+ /** Floating pill callouts (leading badge, trailing radio). */+ pills: {+ leading: string;+ trailing: string;+ };+ /** Chat composer placeholder. */+ chatPrompt: string;+ /** Reward-progress card copy. */+ reward: {+ label: string;+ value: number;+ total: number;+ member: string;+ };+}++/** The three aurora blob colors (left, center, right). */+export interface HeroAuroraPalette {+ left: string;+ center: string;+ right: string;+}++export interface HeroThemeSlide {+ /** Theme package name, e.g. '@xds/theme-matcha'. */+ name: string;+ /** Human-readable label, e.g. 'Matcha'. */+ label: string;+ /** Resolved theme object passed to <XDSTheme>. */+ theme: XDSDefinedTheme;+ /** Per-theme content for the floating cards. */+ content: HeroThemeContent;+ /** Soft pastel palette feeding the blurred aurora background blobs. */+ aurora: HeroAuroraPalette;+ /** CSS color the wordmark paints in (must read on the slide's hero fill). */+ wordmarkColor: string;+ /**+ * Dark-first theme. On dark slides the hero text/links/nav switch to light,+ * and the theme renders in dark mode (fill, cards, blobs use its dark palette).+ */+ isDark: boolean;+ /** Color mode the slide's theme renders in. Dark-first themes use 'dark'. */+ mode: 'light' | 'dark';+}++// The curated reel — these themes, in this order. Edit here to add/remove.+const REEL_THEMES: ReadonlyArray<string> = [+ ASTRYX,+ '@xds/theme-neutral',+ '@xds/theme-butter',+ '@xds/theme-matcha',+ '@xds/theme-gothic',+ '@xds/theme-y2k',+];++// Per-theme card content, keyed by theme name (or the ASTRYX sentinel).+const CONTENT_BY_THEME: Record<string, HeroThemeContent> = {+ [ASTRYX]: {+ product: {+ image: '/neutral/preview-headphones.png',+ title: 'Studio headphones',+ description: 'Quiet, considered sound for deep focus.',+ price: '$180',+ },+ feature: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/light-product-1.png',+ title: 'Ceramic mug',+ price: '$32',+ },+ mini: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/light-product-1.png',+ title: 'Speckled mug',+ description: 'Hand-thrown stoneware.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {+ label: 'Setup progress',+ value: 7,+ total: 8,+ member: 'Astryx team',+ },+ },+ '@xds/theme-neutral': {+ product: {+ image: '/neutral/preview-watch.png',+ title: 'Minimalist watch',+ description: 'Clean design, everyday durability.',+ price: '$240',+ },+ feature: {+ image: '/neutral/preview-headphones.png',+ title: 'Wireless headphones',+ price: '$180',+ },+ mini: {+ image: '/neutral/preview-backpack.png',+ title: 'Canvas backpack',+ description: 'Water-resistant.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {+ label: 'Member rewards',+ value: 6,+ total: 10,+ member: 'Alex Rivera',+ },+ },+ '@xds/theme-butter': {+ product: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/light-product-1.png',+ title: 'Speckled mug',+ description: 'Warm stoneware for slow mornings.',+ price: '$32',+ },+ feature: {+ image: '/theme-butter-preview.png',+ title: 'Buttermilk waffles',+ price: '$14',+ },+ mini: {+ image: '/theme-butter-preview.png',+ title: 'Maple waffles',+ description: 'Served warm.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {label: 'Loyalty perks', value: 5, total: 9, member: 'Noa Bright'},+ },+ '@xds/theme-matcha': {+ product: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/matcha-product-1.png',+ title: 'Sweet vanilla matcha',+ description: 'Vanilla matcha with whole milk or oat milk.',+ price: '$6',+ },+ feature: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/matcha-product-4.png',+ title: 'Ube matcha',+ price: '$7',+ },+ mini: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/matcha-product-4.png',+ title: 'Ube matcha',+ description: 'Ube and cream matcha.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {+ label: 'Reward progress',+ value: 7,+ total: 8,+ member: 'Lottie Wang',+ },+ },+ '@xds/theme-gothic': {+ product: {+ image: '/theme-gothic-preview.png',+ title: 'Onyx pendant',+ description: 'Blackened silver with a matte finish.',+ price: '$96',+ },+ feature: {+ image: '/theme-gothic-preview.png',+ title: 'Midnight cuff',+ price: '$120',+ },+ mini: {+ image: '/theme-gothic-preview.png',+ title: 'Raven ring',+ description: 'Hand-forged band.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {label: 'Member rewards', value: 7, total: 8, member: 'Mara Vale'},+ },+ '@xds/theme-y2k': {+ product: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/colorful-product-2.png',+ title: 'Bubbly charm',+ description: 'A glossy little throwback keepsake.',+ price: '$18',+ },+ feature: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/colorful-product-1.png',+ title: 'Puppy keychain',+ price: '$12',+ },+ mini: {+ image:+ 'https://lookaside.facebook.com/assets/xds_oss/colorful-product-1.png',+ title: 'Puppy keychain',+ description: 'Plush + chrome ring.',+ },+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {label: 'Sparkle points', value: 6, total: 8, member: 'Bella Cruz'},+ },+};++// Fallback content for any theme without a bespoke entry (uses its preview img).+function fallbackContent(name: string): HeroThemeContent {+ const slug = name.replace('@xds/theme-', '');+ const image = `/theme-${slug}-preview.png`;+ return {+ product: {+ image,+ title: 'Featured product',+ description: 'A polished surface, styled by this theme.',+ price: '$40',+ },+ feature: {image, title: 'Featured product', price: '$40'},+ mini: {image, title: 'Featured', description: 'In stock now.'},+ pills: {leading: 'Limited time', trailing: 'Free shipping'},+ chatPrompt: 'How can I help?',+ reward: {label: 'Member rewards', value: 6, total: 10, member: 'Sam Lee'},+ };+}++// Properly-cased dot labels (package displayNames are sometimes lowercased).+const LABEL_BY_THEME: Record<string, string> = {+ [ASTRYX]: 'Astryx',+ '@xds/theme-neutral': 'Neutral',+ '@xds/theme-butter': 'Butter',+ '@xds/theme-matcha': 'Matcha',+ '@xds/theme-gothic': 'Gothic',+ '@xds/theme-y2k': 'Y2K',+};++function labelFor(name: string): string {+ if (LABEL_BY_THEME[name]) {+ return LABEL_BY_THEME[name];+ }+ const pkg = packages.find(p => p.name === name);+ const raw = pkg?.displayName ?? name.replace('@xds/theme-', '');+ return raw.replace(/^Theme:\s*/, '').replace(/\s*Theme$/, '');+}++// Resolve a slide's theme object (Astryx is local; others from the registry).+// Returns null for an uninstalled package so the reel skips it.+function themeFor(name: string): XDSDefinedTheme | null {+ if (name === ASTRYX) {+ return astryxTheme;+ }+ return themeObjects[name] ?? null;+}++// Default wordmark color (theme accent — a dark ink on light themes).+const DEFAULT_WORDMARK_COLOR = 'var(--color-text-accent)';++// Per-theme wordmark overrides (dark themes need a light ink on their dark fill).+const WORDMARK_COLOR_BY_THEME: Record<string, string> = {+ '@xds/theme-gothic': 'var(--color-text-primary)',+};++// Dark-first themes (rendered in dark mode; hero text/nav go light).+const DARK_THEMES: ReadonlySet<string> = new Set<string>(['@xds/theme-gothic']);++// Per-theme aurora blob palettes (categorical background tokens, on-brand hues).+const AURORA_BY_THEME: Record<string, HeroAuroraPalette> = {+ [ASTRYX]: {+ left: 'var(--color-background-yellow)',+ center: 'var(--color-background-yellow)',+ right: 'var(--color-background-pink)',+ },+ '@xds/theme-neutral': {+ left: 'var(--color-background-blue)',+ center: 'var(--color-background-gray)',+ right: 'var(--color-background-cyan)',+ },+ '@xds/theme-butter': {+ left: 'var(--color-background-yellow)',+ center: 'var(--color-background-yellow)',+ right: 'var(--color-background-orange)',+ },+ '@xds/theme-matcha': {+ left: 'var(--color-background-green)',+ center: 'var(--color-background-cyan)',+ right: 'var(--color-background-yellow)',+ },+ // Gothic (dark mode): use saturated --color-border-* tokens so the blobs glow+ // instead of washing out white (the 20%-alpha background tints would).+ '@xds/theme-gothic': {+ left: 'var(--color-border-purple)',+ center: 'var(--color-border-blue)',+ right: 'var(--color-border-teal)',+ },+ '@xds/theme-y2k': {+ left: 'var(--color-background-pink)',+ center: 'var(--color-background-purple)',+ right: 'var(--color-background-blue)',+ },+};++// Fallback aurora for any theme without a bespoke palette above.+const DEFAULT_AURORA: HeroAuroraPalette = {+ left: 'var(--color-background-blue)',+ center: 'var(--color-background-purple)',+ right: 'var(--color-background-pink)',+};++// Ordered slides from REEL_THEMES; unresolved (uninstalled) themes are skipped.+export const HERO_THEME_SLIDES: ReadonlyArray<HeroThemeSlide> = REEL_THEMES.map(+ name => {+ const theme = themeFor(name);+ return theme+ ? {+ name,+ label: labelFor(name),+ theme,+ content: CONTENT_BY_THEME[name] ?? fallbackContent(name),+ aurora: AURORA_BY_THEME[name] ?? DEFAULT_AURORA,+ wordmarkColor:+ WORDMARK_COLOR_BY_THEME[name] ?? DEFAULT_WORDMARK_COLOR,+ isDark: DARK_THEMES.has(name),+ mode: DARK_THEMES.has(name) ? 'dark' : 'light',+ }+ : null;+ },+).filter((s): s is HeroThemeSlide => s !== null);diff --git a/apps/docsite/src/app/(site)/page.tsx b/apps/docsite/src/app/(site)/page.tsxindex 593c0510b0..13e9cae3fb 100644--- a/apps/docsite/src/app/(site)/page.tsx+++ b/apps/docsite/src/app/(site)/page.tsx@@ -2,126 +2,110 @@'use client';-import {useEffect, useRef} from 'react';+import {useEffect, useRef, type Ref, type ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import {XDSHeading, XDSText} from '@xds/core/Text';import {XDSLink} from '@xds/core/Link';-import {XDSBadge} from '@xds/core/Badge';import {XDSVStack} from '@xds/core/Layout';import {XDSGrid} from '@xds/core/Grid';import {XDSButton} from '@xds/core/Button';+import {XDSTheme} from '@xds/core/theme';import {spacingVars} from '@xds/core/theme/tokens.stylex';+import {astryxTheme} from '../../themes/astryxTheme';+import {+ HeroReelProvider,+ HeroReelCards,+ HeroReelStack,+ HeroReelWordmark,+ HeroReelDots,+ useHeroReelIsDark,+} from './_landing/hero/HeroThemeReel';import {FeaturesShowcase} from './_landing/FeaturesShowcase';import {AboutShowcase} from './_landing/AboutShowcase';import {DiscoverShowcase} from './_landing/DiscoverShowcase';+// Hero band height (reserved by heroSpacer). Desktop is fixed; narrow screens+// fall back to these per-tier values until the measured height is applied.+const HERO_BAND_HEIGHT = 760;+const HERO_BAND_HEIGHT_NARROW = 940; // 768–1024px: 3-column collage+const HERO_BAND_HEIGHT_2COL = 1200; // <768px: 2-column collage+const styles = stylex.create({- // Wraps hero + showcase together so the sticky hero (position: sticky)- // bounds its sticky range to this container. Without the wrapper, the- // hero would stay pinned through the footer (a sibling further down- // the AppShell main content), which on mobile shows up as the hero- // bleeding underneath the footer at the bottom of the page.+ // Wraps hero + showcase so the pin-and-cover stays bounded to this container+ // (not pinned through the footer).heroScope: {position: 'relative',backgroundColor: 'var(--color-background-body)',+ // Shared by the nav→wordmark gap and the text→cards gap so they match.+ '--hero-gap': 'calc(var(--spacing-12) * 2)',},- // Hero content column. maxWidth: 800 is an editorial reading-- // measure cap (≈ display-1 + body at a comfortable line length);- // not derivable from the spacing scale, kept as a literal- // because it's a marketing-section measure, not a system primitive.- // paddingBlock = --spacing-12 * 3 → 144px top/bottom; expressed- // as a calc() over the spacing token so the rhythm scales with- // any future spacing-scale theme override.+ // Hero content column. position:fixed (like the aurora glow) so it stays put+ // while the showcase scrolls up and covers it (pin-and-cover). Pulled out of+ // flow; heroSpacer reserves its height. Capped at 800 (reading measure).heroContent: {- position: 'sticky',+ position: 'fixed',top: 'var(--appshell-header-height, 0px)',+ left: 0,+ right: 0,+ // Desktop: fixed band, centered (cards are a separate overlap layer).+ // Narrow: auto height (sizes to text + collage); a ResizeObserver applies it+ // to heroSpacer so the showcase starts right after the cards.+ height: {+ default: 'auto',+ '@media (min-width: 1024px)': `calc(${HERO_BAND_HEIGHT}px - var(--appshell-header-height, 0px))`,+ },+ // Desktop centers the content; narrow anchors it to the top so the collage+ // below has room.+ justifyContent: {+ default: 'flex-start',+ '@media (min-width: 1024px)': 'center',+ },+ // Narrow: --hero-gap below the nav (matches the text→cards gap). Desktop+ // centers, so no top padding.+ paddingBlockStart: {+ default: 'var(--hero-gap)',+ '@media (min-width: 1024px)': 0,+ },+ paddingBlockEnd: spacingVars['--spacing-12'],maxWidth: 800,marginInline: 'auto',- paddingBlock: `calc(${spacingVars['--spacing-12']} * 3)`,paddingInline: spacingVars['--spacing-6'],textAlign: 'center',gap: spacingVars['--spacing-6'],- // Lock the hero block to a fixed minimum height so the showcase- // below has a stable starting offset across viewports and the- // sticky pin-and-cover reveal reads consistently.- minHeight: 600,- },- // Wrapper around the wordmark + floating Beta badge. Sized- // exactly to the wordmark image (display:inline-block with no- // explicit width, so the inline element shrinks to the image's- // natural rendered width) and centered horizontally by the- // parent VStack's align:stretch + the wrapper's marginInline:- // auto. position:relative establishes the positioning context- // for the absolutely-positioned Beta badge.- heroWordmarkWrap: {- position: 'relative',- display: 'inline-block',- alignSelf: 'center',+ // Decorative-position layer; never intercept clicks outside its actual+ // content (the buttons/links re-enable pointer events on themselves).+ zIndex: 0,},- heroWordmark: {- display: 'block',- // Responsive: scale down on narrow viewports so the wordmark- // doesn't overflow the hero column. 80px at desktop is the- // designed size; 56px keeps the wordmark visible without- // clipping on phones at ~375px viewport.+ // Reserves the hero's height in flow (heroContent is fixed/out of flow).+ // Narrow: the measured --hero-content-height (per-tier constants are the+ // fallback). Desktop: the fixed band.+ heroSpacer: {height: {- default: 80,- '@media (max-width: 480px)': 56,+ default: `var(--hero-content-height, ${HERO_BAND_HEIGHT_2COL}px)`,+ '@media (min-width: 768px)': `var(--hero-content-height, ${HERO_BAND_HEIGHT_NARROW}px)`,+ '@media (min-width: 1024px)': HERO_BAND_HEIGHT,},- width: 'auto',- maxWidth: '100%',},- // Floating Beta badge wrapper — positions the XDSBadge above- // the wordmark (bottom anchored to the wordmark's top edge)- // and offset right so it reads as a callout attached to the- // brand mark without overlapping any of the glyphs. The XDS- // Badge component carries the pill chrome (background, radius,- // typography); only positioning + rotation lives here.- //- // right: -24 is a literal pixel offset (not a spacing token)- // because the badge anchor is tied to the wordmark glyph- // geometry — the badge needs to clear the rightmost ligature- // by a precise visual margin that doesn't correspond to any- // spacing-scale step. Negative spacing tokens don't exist in- // the scale anyway, so even the symmetric "24px" would be a- // literal here.- heroWordmarkBeta: {- position: 'absolute',- bottom: '100%',- right: -24,- marginBottom: spacingVars['--spacing-1'],- transform: 'rotate(8deg)',- transformOrigin: 'bottom right',- },- // Hero CTA button grid. maxWidth: 420 caps the two-up button- // row at a comfortable thumb-reachable width so the buttons- // don't stretch edge-to-edge on wide hero columns. The grid- // uses auto-fit 160px tracks in markup so narrow phones collapse- // to one centered column instead of forcing two labels into- // undersized cells. Literals are button-pair ergonomics values,- // not spacing-scale steps.+ // CTA button row, capped at a thumb-reachable width.heroButtons: {width: '100%',maxWidth: 420,marginInline: 'auto',},- // Lighter display weight for the leading half of the hero- // headline ("An open source design system that's"). Astryx's- // theme override pushes display-1 to semibold (600); we want- // the leading copy to read as a softer editorial setup so the- // value-prop tail ("fully customizable and agent ready") can- // land harder. Applied per-span via xstyle, not as a theme- // token change, so the rest of the site keeps Astryx's display- // semibold default.+ // On dark slides the hero text switches to a light ink (headline/links inherit).+ heroTextDark: {+ color: 'var(--hero-on-dark)',+ },+ // Normal weight (the value-prop span is semibold); smaller on narrow screens.heroHeadline: {fontWeight: 'var(--font-weight-normal)',+ fontSize: {+ default: 'var(--font-size-3xl)',+ '@media (min-width: 768px)': 'var(--font-size-4xl)',+ '@media (min-width: 1024px)': 'var(--text-display-1-size)',+ },},- // The showcase overlay paints the surface that scrolls UP over- // the pinned hero (pin-and-cover reveal). Surface color +- // top-rounded corners + body padding all sit on tokens, but- // paddingBlockStart and gap use the marketing-section rhythm- // token (--xds-marketing-section-gap) — these are marketing-- // section rhythm, NOT primitives in the spacing scale.+ // The surface that scrolls up over the pinned hero (pin-and-cover).showcaseOverlay: {position: 'relative',overflow: 'hidden',@@ -135,8 +119,137 @@ const styles = stylex.create({},});+// Renders hero controls (CTAs, dots) in the active slide's mode. Always renders+// the same <XDSTheme> element and only toggles `mode` — swapping the element type+// (Fragment ↔ XDSTheme) would remount the subtree and drop keyboard focus from+// the dot the user just activated.+function DarkScope({isDark, children}: {isDark: boolean; children: ReactNode}) {+ return (+ <XDSTheme theme={astryxTheme} mode={isDark ? 'dark' : 'light'}>+ {children}+ </XDSTheme>+ );+}++// Hero text block (wordmark, headline, CTAs, dots, collage). Inside+// HeroReelProvider so it can read isDark and switch to light text on dark slides.+function HeroContent({contentRef}: {contentRef: Ref<HTMLElement>}) {+ const isDark = useHeroReelIsDark();+ // Flag the body on dark slides so the transparent nav can go light (globals.css).+ useEffect(() => {+ if (isDark) {+ document.body.setAttribute('data-hero-dark', '');+ } else {+ document.body.removeAttribute('data-hero-dark');+ }+ return () => document.body.removeAttribute('data-hero-dark');+ }, [isDark]);+ return (+ <XDSVStack+ ref={contentRef}+ data-home-page="true"+ align="stretch"+ xstyle={[styles.heroContent, isDark && styles.heroTextDark]}>+ <HeroReelWordmark />+ <XDSHeading+ level={1}+ type="display-1"+ color={isDark ? 'inherit' : 'primary'}+ xstyle={styles.heroHeadline}>+ An open source design system that's{' '}+ <XDSText as="span" type="inherit" color="inherit" weight="semibold">+ fully customizable and agent ready+ </XDSText>+ </XDSHeading>+ <XDSVStack gap={4} align="center">+ <DarkScope isDark={isDark}>+ <XDSGrid columns={2} gap={3} xstyle={styles.heroButtons}>+ <XDSButton+ variant="primary"+ size="lg"+ label="Get started"+ href="/docs/getting-started"+ />+ <XDSButton+ variant="secondary"+ size="lg"+ label="Browse components"+ href="/components"+ />+ </XDSGrid>+ </DarkScope>+ <XDSText display="block" color={isDark ? 'inherit' : 'secondary'}>+ Currently in Beta · Built on{' '}+ <XDSLink+ type="body"+ color="inherit"+ href="https://react.dev"+ target="_blank"+ rel="noopener noreferrer"+ hasUnderline>+ React+ </XDSLink>{' '}+ and{' '}+ <XDSLink+ type="body"+ color="inherit"+ href="https://stylexjs.com"+ target="_blank"+ rel="noopener noreferrer"+ hasUnderline>+ StyleX+ </XDSLink>+ </XDSText>+ {/* Theme switcher dots — jump straight to any theme in the reel. */}+ <DarkScope isDark={isDark}>+ <HeroReelDots />+ </DarkScope>+ </XDSVStack>+ {/* Narrow-screen collage — rendered inside the (fixed) hero content so it's+ pinned with the text and sits a consistent --hero-gap below it. The+ desktop overlap layer (HeroReelCards) hides below 1024px; this+ self-hides at ≥1024px. */}+ <HeroReelStack />+ </XDSVStack>+ );+}+export default function HomePage() {const showcaseRef = useRef<HTMLDivElement | null>(null);+ const heroScopeRef = useRef<HTMLDivElement | null>(null);+ const heroContentRef = useRef<HTMLElement | null>(null);++ // Measure the (auto-height) narrow hero content and expose it as+ // --hero-content-height so heroSpacer matches it (showcase starts right after+ // the cards). Desktop uses the fixed band, so the var is ignored there.+ useEffect(() => {+ const scope = heroScopeRef.current;+ const content = heroContentRef.current;+ if (!scope || !content) {+ return;+ }+ const navHeight = () => {+ const raw = getComputedStyle(document.documentElement).getPropertyValue(+ '--appshell-header-height',+ );+ return parseFloat(raw) || 64;+ };+ const setVar = () => {+ const total = content.getBoundingClientRect().height + navHeight();+ scope.style.setProperty(+ '--hero-content-height',+ `${Math.round(total)}px`,+ );+ };+ setVar();+ const ro = new ResizeObserver(setVar);+ ro.observe(content);+ window.addEventListener('resize', setVar, {passive: true});+ return () => {+ ro.disconnect();+ window.removeEventListener('resize', setVar);+ };+ }, []);useEffect(() => {const el = showcaseRef.current;@@ -177,96 +290,16 @@ export default function HomePage() {}, []);return (- <div {...stylex.props(styles.heroScope)}>- <XDSVStack- data-home-page="true"- align="stretch"- xstyle={styles.heroContent}>- {/* heroWordmarkWrap is a raw <div> because its sole job is- to establish a `position: relative` context for the- absolutely-positioned Beta badge while sizing exactly to- the inline wordmark image's natural width. XDSVStack /- XDSHStack would impose flex semantics that fight the- inline-block sizing; no other XDS primitive represents- "positioning context that hugs an inline child". */}- <div {...stylex.props(styles.heroWordmarkWrap)}>- {/* Raw <img> — @xds/core does not export a general-purpose- image component (XDSThumbnail is chat-attachment chrome;- XDSIcon is a glyph registry). Sizing + responsive- breakpoints come from the heroWordmark xstyle. */}- <img- src="/astryx-logo.svg"- alt="Astryx"- {...stylex.props(styles.heroWordmark)}- />- {/* heroWordmarkBeta is a raw <span> because we need an- inline-level element that establishes its own- position:absolute context for the XDSBadge — a stack- would force flex children and break the floating- callout placement. */}- <span {...stylex.props(styles.heroWordmarkBeta)}>- <XDSBadge label="Beta" variant="blue" />- </span>- </div>- <XDSHeading- level={1}- type="display-1"- color="primary"- xstyle={styles.heroHeadline}>- An open source design system that's{' '}- {/* XDSText emphasis span — type/color="inherit" picks up- the heading's display-1 size + color so only the- weight changes, and weight="semibold" provides the- contrast against the parent heading's normal weight- (set via styles.heroHeadline above). Using XDSText- keeps the inline emphasis on a typed XDS primitive- instead of a raw <span> + xstyle escape. */}- <XDSText as="span" type="inherit" color="inherit" weight="semibold">- fully customizable and agent ready- </XDSText>- </XDSHeading>- <XDSVStack gap={4} align="center">- <XDSGrid- columns={{minWidth: 160, repeat: 'fit'}}- gap={3}- xstyle={styles.heroButtons}>- <XDSButton- variant="primary"- size="lg"- label="Get started"- href="/docs/getting-started"- />- <XDSButton- variant="secondary"- size="lg"- label="Browse components"- href="/components"- />- </XDSGrid>- <XDSText display="block">- Built on{' '}- <XDSLink- type="body"- color="primary"- href="https://react.dev"- target="_blank"- rel="noopener noreferrer"- hasUnderline>- React- </XDSLink>{' '}- and{' '}- <XDSLink- type="body"- color="primary"- href="https://stylexjs.com"- target="_blank"- rel="noopener noreferrer"- hasUnderline>- StyleX- </XDSLink>- </XDSText>- </XDSVStack>- </XDSVStack>+ <div ref={heroScopeRef} {...stylex.props(styles.heroScope)}>+ {/* HeroReelProvider holds the shared cycling state for the cards, wordmark,+ and dots. The headline/CTAs stay in stable Astryx brand style. */}+ <HeroReelProvider>+ {/* Desktop overlap cards layer (the gutters). */}+ <HeroReelCards />+ {/* Reserves the fixed hero's height so the showcase starts below it. */}+ <div {...stylex.props(styles.heroSpacer)} aria-hidden="true" />+ <HeroContent contentRef={heroContentRef} />+ </HeroReelProvider><XDSVStack ref={showcaseRef} xstyle={styles.showcaseOverlay}><FeaturesShowcase /><AboutShowcase />diff --git a/apps/docsite/src/app/globals.css b/apps/docsite/src/app/globals.cssindex 3c5dc07613..d481bee81d 100644--- a/apps/docsite/src/app/globals.css+++ b/apps/docsite/src/app/globals.css@@ -87,12 +87,14 @@ body:has([data-home-page]) #xds-app-shell-main {transition: background 300ms ease;}-/* On the home page only, blend the top nav with the cream body background.- Use the solid body color (not a color-mix) so it matches perfectly even- without anything scrolled behind it. The backdrop-filter blur from the- .xds-top-nav rule above is preserved. */+/* On the home page only, make the top nav transparent so the slide-themed+ navBackdrop band rendered behind it (inside the hero reel's themed scope)+ shows through and retints the nav strip with the ACTIVE theme's body color.+ Without this the nav would paint Astryx's default body color and never+ follow the reel. The backdrop-filter blur from the .xds-top-nav rule above+ is preserved. */body:has([data-home-page]) .xds-top-nav:where(:not(.xds-app-shell .xds-app-shell *)) {- background: var(--color-background-body);+ background: transparent;}/* When the home page IntersectionObserver detects the theming showcase has@@ -101,6 +103,45 @@ body[data-nav-mode='surface'] .xds-top-nav:where(:not(.xds-app-shell .xds-app-shbackground: color-mix(in srgb, var(--color-background-surface) 80%, transparent);}+/* Light ink for hero text + nav on a dark slide's backdrop (e.g. Gothic). They+ live in the Astryx context, so they can't pull the dark slide's own light+ tokens — define one var here (inherited by both) instead of literals. */+body[data-hero-dark] {+ --hero-on-dark: #e8e3da;+}+/* Dark hero slide: switch the transparent nav's text to that light ink. Skipped+ in surface mode (scrolled past the hero onto the white showcase). */+body[data-hero-dark]:not([data-nav-mode='surface'])+ .xds-top-nav:where(:not(.xds-app-shell .xds-app-shell *)) {+ color: var(--hero-on-dark);+}+body[data-hero-dark]:not([data-nav-mode='surface'])+ .xds-top-nav:where(:not(.xds-app-shell .xds-app-shell *)) a,+body[data-hero-dark]:not([data-nav-mode='surface'])+ .xds-top-nav:where(:not(.xds-app-shell .xds-app-shell *)) button {+ color: var(--hero-on-dark);+}++/* Hide the prev/next chevron buttons inside the home page's hero theme+ switcher pagination so only the dot indicators show. XDSPagination's+ variant="dots" ships with chevrons by default; the hero wants a minimal+ indicator-only treatment. Scoped to [data-home-page] so other+ XDSPagination instances across the site stay untouched. */+[data-home-page] .xds-pagination button[aria-label='Go to previous page'],+[data-home-page] .xds-pagination button[aria-label='Go to next page'] {+ display: none;+}++/* On dark hero slides the dots render in Astryx, whose --color-accent is a+ near-black ink — invisible on the dark backdrop, so the active dot and the+ keyboard focus ring disappear. Repaint both with the light hero ink. */+body[data-hero-dark] [data-home-page] .xds-pagination-dot.active {+ background-color: var(--hero-on-dark);+}+body[data-hero-dark] [data-home-page] .xds-pagination-dot:focus-visible {+ outline-color: var(--hero-on-dark);+}+/* The /themes/<name> dedicated page renders a faux app top nav INSIDEits preview surface. The global `.xds-top-nav` rule above gives it asurface-tinted frosted background, which leaks through and makes the