Files
zeekayandGitHub ea43c5a975 Type lib, scripts, v2, home and app under strict (#8)
* Type scripts under strict

Playwright's API the checks use is declared in host.ts (the package is
the app repo's); caught errors read through why(). tabs-tree.test waits
for the typed tabsTree.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type the shared components under strict

Window globals (__lenis, __hzHold, google) and the two react-dom calls
are declared in components/*.d.ts, since @types/react-dom is not a
dependency and the lockfile is frozen.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type components/v2 under strict

Props, state, refs and DOM events in the 93 v2 files. A2Motion's easing
tuples are as const. Two real bugs: x-archimedes/MaskLines imported a
NoJs that does not exist, and x-hypatia/PinChapters returned the element
from a ref callback, which React 19 reads as a cleanup. AppSheet no
longer sets aria-label to a JSX label.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type components/home under strict

The race, cost and frontier figures, the plan cards, the repository card
and the product stories take Run, Models and Plan types from lib.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Type the hero devices and the app routes under strict

HeroScene and its parts describe hero-scenes.json; the [slug] pages take
params as a Promise, and metadata and viewport carry Next's types.

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Give the integrations previews their Preview type

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk

* Use the bench Card type for the closing cards

Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
2026-11-14 01:34:34 -08:00

54 lines
2.8 KiB
TypeScript

'use client';
/* LineReveal: v2 kinetic type (docs/VISION.md, motion 4), owned by the Wave 2 Programs chat.
Each line of a headline rises out of its own mask, once: 105% to 0 in 700 ms, ease-emphasis, 60 ms apart (MASTER part 3). The words are in the HTML from the server;
reduced motion shows them in place (MotionConfig reducedMotion="user").
Usage: <LineReveal as="h1" className="xp-display" lines={['Refer customers', 'to Hanzo']} />
Also exports <NoJs />: put it once in a Programs page's <main>; with JavaScript off it shows every final state
(no transform or opacity left from an entrance) and lays sticky chapters out as their plain story.
- onView: play when it scrolls into view (default: on arrival, for a hero). The arrival version is pure CSS, so the
headline cuts in from the first paint, before any JavaScript runs, and still ends in place with JavaScript off;
- delay: seconds before the first line. Needs components/v2/ProgramScale.css for the .xp-l masks. */
import { useRef, type CSSProperties, type ReactNode } from 'react';
import { motion, useInView } from 'motion/react';
import SharedNoJs from '../NoJs';
const EASE = [0.16, 1, 0.3, 1] as const;
interface LineRevealProps {
lines: ReactNode[];
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div';
className?: string;
id?: string;
delay?: number;
onView?: boolean;
}
export default function LineReveal({ lines, as = 'h2', className = '', id, delay = 0, onView = false }: LineRevealProps) {
const ref = useRef<HTMLHeadingElement>(null);
const seen = useInView(ref, { once: true, amount: 0.5 });
const go = onView ? seen : true;
const Tag = as;
if (!onView) return (
<Tag id={id} className={className}>
{lines.map((l, i) => (
<span className="xp-l" key={i}><span className="xp-cut" style={{ '--i': i, '--d': delay + 's' } as CSSProperties}>{l}</span></span>
))}
</Tag>
);
return (
<Tag ref={ref} id={id} className={className}>
{lines.map((l, i) => (
<span className="xp-l" key={i}>
<motion.span initial={{ y: '105%' }} animate={go ? { y: '0%' } : { y: '105%' }} transition={{ duration: 0.7, ease: EASE, delay: delay + i * 0.06 }}>{l}</motion.span>
</span>
))}
</Tag>
);
}
/* With JavaScript off nothing animates, so every element shows its final state. */
const NOJS = '<style>.xp [style]{transform:none!important;opacity:1!important;clip-path:none!important}.xpc{height:auto!important;padding:96px 0}.xpc-pin{display:none!important}.xpc-story{display:block!important;width:min(100% - 48px,1440px);margin:0 auto}.xpc-rail-p{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:24px}.xpc-sstage{position:relative;height:340px;margin-bottom:24px}.xpc-dots{display:none}</style>';
export function NoJs() {
return <SharedNoJs css={NOJS} />;
}