From b67eeab4a900e9370066a403837200b8ef3df124 Mon Sep 17 00:00:00 2001 From: Adam Pickering Date: Thu, 24 Sep 2026 08:01:38 -0400 Subject: [PATCH 01/20] My Jetpack: add a setup wizard shell behind a feature flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A full-screen onboarding wizard for My Jetpack, off by default behind `my-jetpack-onboarding-wizard`. With the flag off the existing single-screen takeover renders exactly as before. The shell is built from the components the WordPress Site Editor itself uses rather than a lookalike: NavigableRegion from @wordpress/admin-ui, ItemGroup and Item from @wordpress/components, and a ThemeProvider seeded dark so the rail's colours come from the same --wpds-* tokens resolving differently in that subtree. No dark colour is hardcoded anywhere. Three columns: the step rail, the question column, and a brand panel carrying a CSS mesh gradient, the Jetpack bolt artwork, and display copy outlined from Söhne Breit. The font file is not part of this repository, so the display lines are pre-outlined by tools/generate-panel-type.py and only the paths ship. They are brand copy and read the same in every locale by design, which replaces an earlier version that split each line into half-sentence translatable strings no translator could have worked with. Step 1 is the start screen, ported from the prototype. Steps 2 to 4 are scaffolding and their copy says so plainly: nothing is connected, activated or saved yet. That work follows in a second PR, which is blocked on two open connection PRs and on the final feature list. Accessibility is 100 in Lighthouse with no failing nodes. Contrast was measured rather than assumed throughout, including the mint display copy against the worst frame of the animated mesh rather than its first. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG --- .../components/onboarding-screen/index.tsx | 10 + .../onboarding-screen/wizard/index.ts | 1 + .../onboarding-screen/wizard/lib.ts | 231 ++++ .../onboarding-screen/wizard/panel-art.tsx | 142 +++ .../onboarding-screen/wizard/panel-type.ts | 69 + .../wizard/steps/placeholder-step.tsx | 140 ++ .../wizard/steps/start-step.tsx | 112 ++ .../wizard/styles.module.scss | 1126 +++++++++++++++++ .../wizard/test/smoke.test.tsx | 351 +++++ .../onboarding-screen/wizard/wizard.tsx | 394 ++++++ .../testimonials/slide-01-gradient.tsx | 37 +- .../add-my-jetpack-onboarding-wizard | 4 + projects/packages/my-jetpack/global.d.ts | 9 + .../my-jetpack/src/class-initializer.php | 46 + .../my-jetpack/tools/generate-panel-type.py | 127 ++ 15 files changed, 2792 insertions(+), 7 deletions(-) create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/index.ts create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/lib.ts create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-art.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-type.ts create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/placeholder-step.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/start-step.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/styles.module.scss create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/test/smoke.test.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/wizard.tsx create mode 100644 projects/packages/my-jetpack/changelog/add-my-jetpack-onboarding-wizard create mode 100644 projects/packages/my-jetpack/tools/generate-panel-type.py diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/index.tsx b/projects/packages/my-jetpack/_inc/components/onboarding-screen/index.tsx index 3ac0d8af8064..a3c928749de2 100644 --- a/projects/packages/my-jetpack/_inc/components/onboarding-screen/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/index.tsx @@ -1,14 +1,24 @@ import { Container, Col } from '@automattic/jetpack-components'; import clsx from 'clsx'; +import { getMyJetpackWindowInitialState } from '../../data/utils/get-my-jetpack-window-state'; import { useFullScreen } from '../../hooks/use-fullscreen'; import Testimonials from '../testimonials'; import ConnectionForm from './connection-form/connection-form'; import styles from './styles.module.scss'; +import { Wizard } from './wizard'; import type { FC } from 'react'; const OnboardingScreen: FC = () => { useFullScreen(); + // Only set when the wizard's feature flag is on; the page carries its configuration + // rather than the flag itself. + const wizard = getMyJetpackWindowInitialState( 'onboardingWizard' ); + + if ( wizard?.exitUrl ) { + return ; + } + return ( >; +} + +/** + * The steps, in order. Placeholder content until stage 3 brings the real steps. + * + * @return One entry per step, translated at call time. + */ +export function wizardSteps(): WizardStepMeta[] { + return [ + { + id: 'start', + kind: 'start', + label: __( 'Connect', 'jetpack-my-jetpack' ), + title: __( 'Start with Jetpack for free', 'jetpack-my-jetpack' ), + description: __( + 'One plugin, and your site can do the things it usually takes five to do.', + 'jetpack-my-jetpack' + ), + options: [], + }, + { + id: 'site-type', + kind: 'question', + label: __( 'Your site', 'jetpack-my-jetpack' ), + title: __( 'What is this site for?', 'jetpack-my-jetpack' ), + description: __( + 'This step is still being built. Your answer is not saved yet, and nothing is set up from it.', + 'jetpack-my-jetpack' + ), + options: [ + { + value: 'business', + label: __( 'A business or organization', 'jetpack-my-jetpack' ), + description: __( 'Services, bookings, or a storefront.', 'jetpack-my-jetpack' ), + icon: store, + }, + { + value: 'publication', + label: __( 'A blog or publication', 'jetpack-my-jetpack' ), + description: __( 'Regular writing for an audience.', 'jetpack-my-jetpack' ), + icon: post, + }, + { + value: 'personal', + label: __( 'A personal site', 'jetpack-my-jetpack' ), + description: __( 'A portfolio, a project, or somewhere to start.', 'jetpack-my-jetpack' ), + icon: people, + }, + ], + }, + { + id: 'features', + kind: 'question', + label: __( 'What you need', 'jetpack-my-jetpack' ), + title: __( 'The feature list is not decided yet', 'jetpack-my-jetpack' ), + description: __( + 'These three are stand-ins for it. Picking one turns nothing on and saves nothing.', + 'jetpack-my-jetpack' + ), + options: [ + { + value: 'protect', + label: __( 'Example: keeping the site safe', 'jetpack-my-jetpack' ), + description: __( 'A stand-in. Nothing is turned on.', 'jetpack-my-jetpack' ), + icon: shield, + }, + { + value: 'grow', + label: __( 'Example: reaching more people', 'jetpack-my-jetpack' ), + description: __( 'A stand-in. Nothing is turned on.', 'jetpack-my-jetpack' ), + icon: megaphone, + }, + { + value: 'speed', + label: __( 'Example: making the site faster', 'jetpack-my-jetpack' ), + description: __( 'A stand-in. Nothing is turned on.', 'jetpack-my-jetpack' ), + icon: trendingUp, + }, + ], + }, + { + id: 'done', + kind: 'question', + label: __( 'Finish', 'jetpack-my-jetpack' ), + title: __( 'The rest of this is not built yet', 'jetpack-my-jetpack' ), + description: __( + 'Nothing has been turned on and nothing is saved. This step exists so the end of the flow can be judged alongside the rest.', + 'jetpack-my-jetpack' + ), + options: [], + }, + ]; +} + +/** + * The start screen's benefits, in order. + * + * Every feature named here is in the free tier. VideoPress and Backup are + * deliberately absent: both are paid, and this screen cannot promise what sits + * behind a plan. Do not add a row without checking its tier. + * + * @return One entry per row, translated at call time. + */ +export function startBenefits(): WizardBenefit[] { + return [ + { + id: 'secure', + icon: shield, + text: __( 'Spam, brute force and downtime, handled for you', 'jetpack-my-jetpack' ), + }, + { + id: 'fast', + icon: cloud, + text: __( 'Pages and images served fast from a global network', 'jetpack-my-jetpack' ), + }, + { + id: 'grow', + icon: chartBar, + text: __( 'Stats, SEO and social sharing, in one place', 'jetpack-my-jetpack' ), + }, + { + id: 'publish', + icon: postCommentsForm, + text: __( 'Forms, newsletters and podcasting, built in', 'jetpack-my-jetpack' ), + }, + ]; +} + +/** + * Whether the user may advance from the given step. + * + * A step that offers options needs one picked; a step that offers none is free to leave. + * + * @param step - The current step index. + * @param state - The collected wizard state. + * @return True when the primary action is enabled. + */ +export function canContinue( step: WizardStep, state: WizardState ): boolean { + const meta = wizardSteps()[ step ]; + + // The start screen asks nothing, and carries its own way forward. + return meta.kind === 'start' || meta.options.length === 0 || state.choices[ step ] !== undefined; +} + +/** + * Whether the given step is the final one. + * + * @param step - The current step index. + * @return True on the last step. + */ +export function isLastStep( step: WizardStep ): boolean { + return step === TOTAL_STEPS - 1; +} diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-art.tsx b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-art.tsx new file mode 100644 index 000000000000..a25bb2187878 --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-art.tsx @@ -0,0 +1,142 @@ +import clsx from 'clsx'; +import styles from './styles.module.scss'; + +/** + * The brand artwork's own geometry: 14 hairline strokes making the isometric + * Jetpack bolt inside two organic circles. + * + * Copied verbatim from the prototype's `components/onboarding/panel-art.tsx`, + * which inlined it from Layer_1.svg. It is hand-drawn brand art: the path data + * and the two stroke widths are not to be redrawn, rounded or simplified. + * + * The stroke colour is not here. The prototype writes `#48FF50` on every path; + * that value is `$brand-gradient-green-bright` in styles.module.scss, so the + * paths take `currentColor` and the stylesheet is the one place it lives. + */ +const ART_PATHS: { d: string; width: number }[] = [ + { + d: 'M658.827 323.388C662.115 173.215 560.214 30.5771 400.987 26.5906C278.987 23.5433 167.999 99.9342 106.151 201.163C40.7016 308.277 24.9988 451.896 91.2647 562.558C168.92 692.256 332.879 719.994 460.867 650.199C565.113 593.344 638.058 484.185 655.038 367.469C657.152 352.859 658.43 338.144 658.827 323.388Z', + width: 0.327402, + }, + { + d: 'M610.777 289.158C610.274 408.044 551.42 524.447 456.282 596.079C347.598 677.896 189.837 690.858 86.9936 591.299C-11.348 496.123 -19.1366 341.985 33.939 222.16C80.6496 116.715 175.39 28.824 290.816 6.42852C450.168 -24.5035 588.479 88.8097 608.118 245.703C609.918 260.105 610.756 274.632 610.777 289.158Z', + width: 0.327402, + }, + { + d: 'M321.636 275.049L321.615 592.823L369.477 618.975L369.561 300.847L321.636 275.049Z', + width: 0.327402, + }, + { + d: 'M473.932 253.509L321.636 275.049L369.561 300.847L521.983 279.265L473.932 253.509Z', + width: 0.982206, + }, + { + d: 'M321.615 592.823L473.933 253.509L521.983 279.265L369.477 618.975L321.615 592.823Z', + width: 0.982206, + }, + { + d: 'M138.792 410.591L290.795 388.988L338.678 414.911L186.529 436.576L138.792 410.591Z', + width: 0.327402, + }, + { + d: 'M290.795 71.2773L138.792 410.591L186.529 436.576L338.72 96.8452L290.795 71.2773Z', + width: 0.982206, + }, + { + d: 'M290.795 388.988V71.2773L338.72 96.8452L338.679 414.911L290.795 388.988Z', + width: 0.982206, + }, + { + d: 'M658.954 314.914C658.43 433.946 599.513 550.453 504.27 622.189C395.02 704.487 236.15 717.156 133.37 616.241C30.5893 515.326 28.7469 366.593 82.0527 246.956C129.182 141.219 224.781 53.2859 340.793 31.5792C499.706 1.83689 636.76 115.275 656.294 271.438C658.095 285.861 658.933 300.388 658.954 314.935V314.914Z', + width: 0.982206, + }, + { + d: 'M610.672 297.611C613.959 146.019 509.923 2.88015 349.189 1.06431C228.298 -0.313235 119.006 75.7855 57.8701 176.346C-7.39078 283.752 -22.4655 427.643 44.5542 538.013C122.566 666.458 285.708 693.362 412.921 624.047C517.063 567.317 589.944 458.22 606.883 341.651C608.997 327.061 610.254 312.347 610.651 297.611H610.672Z', + width: 0.982206, + }, + { d: 'M369.477 618.975L521.983 279.265L369.561 300.847L369.477 618.975Z', width: 0.982206 }, + { + d: 'M473.933 253.509L321.615 592.823V275.049C372.409 267.869 423.16 260.689 473.933 253.509Z', + width: 0.982206, + }, + { + d: 'M338.678 414.911L338.72 96.8452L186.549 436.555C237.259 429.334 287.969 422.112 338.678 414.89V414.911Z', + width: 0.982206, + }, + { d: 'M290.795 71.2773V388.988L138.792 410.591L290.795 71.2773Z', width: 0.982206 }, +]; + +/* + * The draw-in's stagger, from the prototype's panel-art.tsx: a delay of + * `0.15 + index * 0.08` seconds. Written as seconds because the CSS duration + * it runs against is, and kept here rather than in the stylesheet because one + * selector per path is 14 selectors. + */ +const DRAW_DELAY_BASE_S = 0.15; +const DRAW_DELAY_STEP_S = 0.08; + +// The artwork's own coordinate space, from Layer_1.svg. +const ART_VIEW_BOX = '0 0 660 689'; + +type PanelArtProps = { + /* + * Draw the paths in, one after another. True on the start step only, which + * is what the prototype does: its other panels render the art complete. + */ + animate?: boolean; +}; + +/** + * The brand panel's artwork. + * + * Each path carries `pathLength={ 1 }`, which normalises its length so a single + * `stroke-dasharray: 1` rule draws all 14 regardless of how long they really + * are. Without it every path would need its own dash length. + * + * @param props - The component props. + * @param props.animate - Whether the paths draw themselves in. + * @return The rendered artwork. + */ +export function PanelArt( { animate = false }: PanelArtProps ) { + return ( +
+ +
+ ); +} diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-type.ts b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-type.ts new file mode 100644 index 000000000000..5622a587d5cf --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-type.ts @@ -0,0 +1,69 @@ +/** + * GENERATED FILE — do not edit by hand. + * + * The onboarding panel's display copy, outlined from Söhne Breit. Regenerate with + * `tools/generate-panel-type.py` after changing a line; that script holds the copy. + * + * These lines are brand copy and read the same in every locale by design, so they + * carry no `__()` call. Each entry keeps its text for the accessible name. + */ + +export type PanelLine = { + // The words, for the accessible name and the visually hidden copy. + text: string; + // SVG path data for the whole line, already shaped and kerned. + path: string; + // Width as a multiple of the line box, so one font-size scales the line. + ratio: number; +}; + +export const PANEL_LINES: Record< number, PanelLine[] > = { + '0': [ + { + text: 'Grow your audience.', + path: '', + ratio: 7.9208, + }, + { + text: 'Speed up your site.', + path: '', + ratio: 7.4646, + }, + { + text: 'Keep it secure.', + path: '', + ratio: 5.7489, + }, + ], + '1': [ + { + text: "Tell us what you're", + path: '', + ratio: 7.0822, + }, + { + text: 'building.', + path: '', + ratio: 3.187, + }, + ], + '2': [ + { + text: 'Only what you need.', + path: '', + ratio: 7.8929, + }, + { + text: "Nothing you don't.", + path: '', + ratio: 7.1199, + }, + ], + '3': [ + { + text: 'Still being built.', + path: '', + ratio: 5.8552, + }, + ], +}; diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/placeholder-step.tsx b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/placeholder-step.tsx new file mode 100644 index 000000000000..abd81f06a61d --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/placeholder-step.tsx @@ -0,0 +1,140 @@ +import { isRTL } from '@wordpress/i18n'; +import { check } from '@wordpress/icons'; +import { Icon, Stack, Text } from '@wordpress/ui'; +import { useCallback, useRef } from 'react'; +import styles from '../styles.module.scss'; +import type { WizardStepOption } from '../lib'; +import type { KeyboardEvent, MouseEvent, ReactNode } from 'react'; + +type PlaceholderStepProps = { + // Owned by the wizard so the panel region can be labelled by the heading. + titleId: string; + title: string; + description: string; + // The dots and counter, which sit under the standfirst and above the options. + progress?: ReactNode; + // An empty list renders the heading alone, with nothing to choose. + options: WizardStepOption[]; + value?: string; + onChange: ( value: string ) => void; +}; + +// Arrow keys move the selection inside a radiogroup, as they do for native radios. +const VERTICAL_STEP_BY_KEY: Record< string, number > = { + ArrowDown: 1, + ArrowUp: -1, +}; + +// Horizontal arrows follow the writing direction; the vertical pair never mirrors. +const HORIZONTAL_STEP_BY_KEY: Record< string, number > = { + ArrowRight: 1, + ArrowLeft: -1, +}; + +/** + * A stand-in step: a heading, a standfirst, and one hand-rolled radio group. + * + * `@wordpress/ui` has no RadioGroup, so the group carries its own ARIA and roving + * tab stop. Stage 3 replaces the content, not the shape. + * + * @param props - The component props. + * @param props.titleId - The id the panel region is labelled by. + * @param props.title - The step heading. + * @param props.description - The line under the heading. + * @param props.progress - The progress dots and counter. + * @param props.options - The choices offered, possibly none. + * @param props.value - The chosen option's value, if any. + * @param props.onChange - Called with the value the user picks. + * @return The rendered step. + */ +export function PlaceholderStep( { + titleId, + title, + description, + progress, + options, + value, + onChange, +}: PlaceholderStepProps ) { + const groupRef = useRef< HTMLDivElement >( null ); + + const handleClick = useCallback( + ( event: MouseEvent< HTMLButtonElement > ) => onChange( event.currentTarget.value ), + [ onChange ] + ); + + const handleKeyDown = useCallback( + ( event: KeyboardEvent< HTMLButtonElement > ) => { + const offset = + VERTICAL_STEP_BY_KEY[ event.key ] ?? + ( HORIZONTAL_STEP_BY_KEY[ event.key ] ?? 0 ) * ( isRTL() ? -1 : 1 ); + if ( ! offset ) { + return; + } + event.preventDefault(); + + const radios = Array.from( + groupRef.current?.querySelectorAll< HTMLButtonElement >( '[role="radio"]' ) ?? [] + ); + const next = + radios[ + ( radios.indexOf( event.currentTarget ) + offset + radios.length ) % radios.length + ]; + + next.focus(); + onChange( next.value ); + }, + [ onChange ] + ); + + // The first option holds the group's tab stop until something is chosen. + const tabStop = value ?? options[ 0 ]?.value; + + return ( + + + }> + { title } + + } className={ styles[ 'step-description' ] }> + { description } + + + + { progress } + + { options.length > 0 && ( +
+ { options.map( option => ( + + ) ) } +
+ ) } +
+ ); +} diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/start-step.tsx b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/start-step.tsx new file mode 100644 index 000000000000..4d5d88a02b4b --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/start-step.tsx @@ -0,0 +1,112 @@ +import { getRedirectUrl, JetpackLogo } from '@automattic/jetpack-components'; +import { createInterpolateElement } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; +import { ThemeProvider } from '@wordpress/theme'; +import { Button, Icon, Link, Text } from '@wordpress/ui'; +import clsx from 'clsx'; +import { useCallback } from 'react'; +import { START_INTENT, startBenefits } from '../lib'; +import styles from '../styles.module.scss'; + +type StartStepProps = { + // Owned by the wizard so the panel region can be labelled by the heading. + titleId: string; + title: string; + description: string; + // Called with the route the user took, which is recorded and then followed. + onStart: ( intent: string ) => void; +}; + +/** + * The start screen: what Jetpack does for the site, and the two ways in. + * + * Both routes lead into setup; they differ only in which connection intent is + * recorded, which stage 2 turns into an account. + * + * @param props - The component props. + * @param props.titleId - The id the panel region is labelled by. + * @param props.title - The screen's heading. + * @param props.description - The line under the heading. + * @param props.onStart - Called with the chosen connection intent. + * @return The rendered step. + */ +export function StartStep( { titleId, title, description, onStart }: StartStepProps ) { + const handleCreate = useCallback( () => onStart( START_INTENT.create ), [ onStart ] ); + const handleSignIn = useCallback( () => onStart( START_INTENT.signIn ), [ onStart ] ); + + return ( +
+
+ +
+ +
+ } + className={ styles[ 'start-title' ] } + > + { title } + + } className={ styles[ 'start-body' ] }> + { description } + +
+ +
    + { startBenefits().map( benefit => ( +
  • + + + { benefit.text } + +
  • + ) ) } +
+ +
+ { /* Square corners from the theme's own radius scale, not a hardcoded zero. */ } + + + + + { /* A link in appearance only: it moves the wizard on, so it is a button. */ } + + + } className={ styles[ 'start-terms' ] }> + { createInterpolateElement( + __( + 'By continuing, you agree to our Terms of Service and to sync your site’s data with us.', + 'jetpack-my-jetpack' + ), + { + tosLink: , + syncLink: ( + + ), + } + ) } + +
+
+ ); +} diff --git a/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/styles.module.scss b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/styles.module.scss new file mode 100644 index 000000000000..7fd5152e8d7f --- /dev/null +++ b/projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/styles.module.scss @@ -0,0 +1,1126 @@ +/* + * The --jp-* brand variables the panel needs. Imported here rather than + * inherited from the Testimonials stylesheet, which the wizard will outlive. + */ +@use "@automattic/jetpack-base-styles/root-variables"; + +/* + * The prototype's own constants. Each is a design value with no WPDS token; + * everything else on this screen is a token. + */ +$rail-width: 300px; +$panel-width: 38%; + +/* + * The one departure from the prototype on this screen, and deliberate: the + * prototype drops its panel at Tailwind's `lg` (1024px), but it has no rail. + * The rail changes the arithmetic. The panel is $panel-width of the whole grid + * and the rail takes $rail-width off what is left, so the content frame is + * `W * (1 - $panel-width) - $rail-width - 2 * $canvas-inset`: at 1024px that is + * 239px and all four benefits wrap onto two lines. + * + * Measured rather than derived, because the first attempt at this number was + * wrong: the panel is a share of the WHOLE grid, not of what the rail leaves, + * so 1200px still gives only a 412px frame and two benefits still wrap. The + * frame clears the benefit copy at 1280px (461.6px), which is where it sits. + */ +$panel-breakpoint: 1280px; +$glow-height: 55%; +$row-glyph-size: 28px; +$row-glyph-gap: 14px; +$row-min-height: 56px; + +/* + * The panel's display copy. The prototype sizes it off the viewport, at + * `clamp(26px,2.3vw,40px)` (components/onboarding/brand-panel.tsx:72), and the + * same rule reads much smaller here: its panel is 44% of a screen with no + * rail, ours is $panel-width of a grid that carries one. + * + * So the size is a share of the panel instead. .brand-panel__inner is the + * query container, and 1cqw is 1% of its content box, which $panel-copy-inset + * below makes exactly the copy block's own width. A line renders at `ratio` + * times the font size, and the widest ratio across the four steps is 7.9208, + * "Grow your audience." in panel-type.ts, so landing that line on 72% of the + * block is 72 / 7.9208, or 9.09cqw. At a 1440px viewport the block is 451.2px, + * the size is 41.0px, and that line is 324.8px wide: 72.0% of the block. + * + * 72% and not the 80% this started at, which put the widest line 8px from the + * inset and read as touching it. The prototype's own widest line is 38% of its + * panel; 72% is the compromise, because the size was raised deliberately. + * + * The clamp only guards the ends. 26px is the prototype's own floor, below a + * window the panel is hidden at anyway; 72px is reached at 792px of block, + * which is where $panel-copy-max-width stops it too. + * + * The line height is a unitless ratio rather than a token because the size it + * multiplies is fluid. + */ +$panel-copy-size-min: 26px; +$panel-copy-size-fluid: 9.09cqw; +$panel-copy-size-max: 72px; +$panel-copy-line-height: 1.16; + +/* + * The copy's inset from the panel's edge, from the prototype's `inset-x-10` on + * components/onboarding/brand-panel.tsx — Tailwind's 10, so 2.5rem. No WPDS + * padding token is 40px. It replaces the inner's inline padding rather than + * nesting inside it, so the container-query box and the copy block are one + * width and the 72% above is measured against the block itself. + */ +$panel-copy-inset: 40px; + +/* + * The measure's ceiling, so a very wide panel cannot sprawl the line. It is + * the width at which the clamp caps out — 72px / 9.09% — so the two limits + * land together and the widest line stays at 72% past it. + */ +$panel-copy-max-width: 792px; + +/* + * The three stops of the shared gradient artwork, read off the linearGradient + * in testimonials/slide-01-gradient.tsx — the same SVG this panel draws as its + * glow. Named here so the mesh, the panel artwork and that SVG cannot drift + * apart. The composition's fourth colour, the ground, is already a variable: + * --jp-green-90, #003010. + */ +$brand-gradient-green-bright: #48ff50; +$brand-gradient-green-mid: #108642; +$brand-gradient-blue: #2e38fa; + +/* + * The mesh gradient: four blurred blobs drifting behind the glow, built as + * MESH-GRADIENT.md specifies. Nothing here has a token — the WPDS motion + * durations stop in the hundreds of milliseconds and this is a half-minute + * field, and a blur radius has no scale at all. + * + * The periods are primes, so the four never visibly re-align: the shortest + * cycle they share is 17 x 19 x 23 x 29 seconds, about 48 hours. They were + * 37/47/59, which showed roughly one pass before anyone had read the screen. + */ +$mesh-period-1: 17s; +$mesh-period-2: 19s; +$mesh-period-3: 23s; +$mesh-period-4: 29s; + +/* + * Blur is what makes four circles read as one field, so it is large next to + * the blobs. The opacities are set by the mint copy's contrast, measured on + * the composited background at the worst alignment of all four cycles rather + * than at one frame: 7.87:1 on a 680px panel, 8.00:1 on a 900px one, against + * a 7:1 floor. The mask below is what buys the headroom to be this bright. + */ +$mesh-blur: 64px; +$mesh-opacity-bright: 0.34; +$mesh-opacity-mid: 0.8; +$mesh-opacity-blue: 0.58; +$mesh-opacity-deep: 0.62; + +/* + * A stencil rather than a colour, and the reason the blobs can be this bright: + * the field is opaque over the top 62% and drops to $mesh-mask-floor by 77%, + * which is where the display copy starts on the shortest panel the breakpoint + * allows. A floor rather than nothing, so the lower third still moves. What + * the fade uncovers is the same ground the mesh paints, so it has no edge. + * + * It is a mask and not a per-blob drift limit because blur() is a fixed radius: + * a percentage travel limit that clears the copy at 900px fails at 680px, where + * the same 64px of soft edge covers half as much again of the panel. The mask + * is in percentages of the panel, so it is the only one of the two that scales. + */ +$mesh-mask-floor: 0.56; +$mesh-mask-low: rgba(0, 0, 0, $mesh-mask-floor); +$mesh-mask: linear-gradient(to bottom, #000 0%, #000 62%, $mesh-mask-low 77%); + +/* + * The panel artwork. Its width is the prototype's own proportion: 560px of art + * (`max-w-[560px]`) in its 728px panel, so 77%. + * + * The draw-in runs 1.4s there (app/globals.css, `.panel-draw`). The nearest + * WPDS duration is --wpds-motion-duration-xl at 400ms, far too fast to read as + * drawing, so the prototype's value is kept. + */ +$panel-art-width: 77%; +$panel-art-draw-duration: 1.4s; + +/* + * The start column, from the prototype's app/page.tsx:40 — `max-w-md`, which + * is Tailwind's 28rem, so 448px. `--wpds-dimension-surface-width-md` is 400px + * and wraps the first benefit onto a second line. + */ +$start-column-width: 448px; + +/* + * The start heading, from the prototype's components/chat/chat-pane.tsx:335 — + * `text-[28px] leading-tight sm:text-[32px]`, so 28px is its real value below + * 640px and `leading-tight` is 1.25. Neither is on the WPDS scale: the sizes + * step 20 -> 32 with nothing between them. + */ +$start-title-size: 28px; +$start-title-line-height: 1.25; + +/* + * WCAG 2.2 target size (2.5.8, AA) asks for 24px, and the secondary link's own + * box is 20px — it is a standalone call to action, so the inline-link + * exception does not cover it. No WPDS spacing token is 2px. + */ +$start-secondary-target-padding: 2px; + +/* + * The Site Editor's own measurements, read off wp-admin/site-editor.php: the + * canvas inset, and the padding and height of one sidebar navigation row. + * 6px has no token, so the row padding is written out whole. + */ +$canvas-inset: 16px; +$rail-row-padding-block: 8px; +$rail-row-padding-inline: 16px 6px; +$rail-row-min-height: 40px; + +.layout { + display: grid; + grid-template-columns: minmax(0, 1fr); + + // Named, or the collapsed rail is stretched to half the viewport by the + // default row distribution and leaves a dead band under its header. + grid-template-rows: auto minmax(0, 1fr); + block-size: 100%; + min-block-size: 100vh; + + // Dark, because the ThemeProvider around it is seeded dark: this is the + // token the Site Editor's own shell reads, and it lands on rgb(30, 30, 30). + background: var(--wpds-color-background-surface-neutral); + color: var(--wpds-color-foreground-content-neutral); + font-family: var(--wpds-typography-font-family-body); + + // Stack from @wordpress/ui writes gap and alignment as inline styles, which + // cannot carry this query, so the split is plain grid. + @media (min-width: $panel-breakpoint) { + grid-template-columns: $rail-width minmax(0, 1fr) $panel-width; + grid-template-rows: minmax(0, 1fr); + } +} + +/* + * The canvas: the shell's gutter around the sheet, the same inset the Site + * Editor holds its canvas at. + */ +.canvas { + display: flex; + min-inline-size: 0; + min-block-size: 0; + padding: $canvas-inset; +} + +/* + * The content frame: a white sheet floating on the dark shell. Its tokens come + * from the nested ThemeProvider, which puts this subtree on the light ramp. + */ +.frame { + display: flex; + flex-direction: column; + flex-grow: 1; + min-inline-size: 0; + min-block-size: 0; + border-radius: var(--wpds-border-radius-xl); + background: var(--wpds-color-background-surface-neutral-strong); + color: var(--wpds-color-foreground-content-neutral); + overflow: hidden; + box-shadow: + 0 5px 15px rgba(0, 0, 0, 0.08), + 0 15px 27px rgba(0, 0, 0, 0.07), + 0 30px 36px rgba(0, 0, 0, 0.04), + 0 50px 43px rgba(0, 0, 0, 0.02); +} + +/* -------------------------------------------------------------- rail */ + +/* + * The sidebar region, as the Site Editor builds it: transparent, so the shell's + * ground shows through, and as wide as the layout grid's first column. + */ +.rail { + display: flex; + flex-direction: column; + gap: var(--wpds-dimension-gap-lg); + min-inline-size: 0; + padding-block: var(--wpds-dimension-padding-lg); +} + +.rail-head { + display: flex; + flex-direction: column; + align-items: flex-start; + flex-shrink: 0; + gap: var(--wpds-dimension-gap-xs); + padding-inline: var(--wpds-dimension-padding-lg); +} + +/* + * The icon-only exit control, sized the way @wordpress/ui's own icon buttons + * are: square, at the compact height. + */ +.exit { + --wp-ui-button-aspect-ratio: 1; + --wp-ui-button-min-width: unset; + --wp-ui-button-padding-inline: 0; + + align-self: flex-start; +} + +/* + * Heading writes its size and colour as runtime styles at one class of + * specificity, so the line height is set from two. + */ +.rail-head .rail-title { + line-height: var(--wpds-typography-line-height-xl); +} + +.rail-count { + color: var(--wpds-color-foreground-content-neutral-weak); + font-variant-numeric: tabular-nums; +} + +/* + * The landmark itself goes below the breakpoint, rather than its contents, so + * the collapsed rail leaves neither an empty