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

49 lines
2.3 KiB
TypeScript

'use client';
/* LineMask: kinetic type, played once. Each line cuts up out of its own mask (VISION motion 4, JAMES "headlines cut
into their line").
Usage: <LineMask as="h1" className="lx-display" lines={['Hanzo', 'Metrics']} /> — a hero: plays at first paint;
<LineMask lines={[...]} inView /> — plays when first scrolled to.
The words are real text in the server HTML and are never hidden from a reader without JS:
- the hero cut-in is a CSS animation, so it starts at first paint, does not wait for hydration and ends visible
even with JS off;
- the inView variant is armed (hidden) only after mount and only while it is still below the fold.
Timing (MASTER part 3): translateY 105% → 0, 700 ms, ease-emphasis, 60 ms between lines.
Reduced motion: set, no movement. Owned by Cloud 3. */
import { useEffect, useRef, useState, type HTMLAttributes, type ReactNode } from 'react';
import './LaunchType.css';
export type LineTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div';
interface LineMaskProps extends HTMLAttributes<HTMLElement> {
lines: ReactNode[];
as?: LineTag;
delay?: number;
inView?: boolean;
stagger?: number;
}
export default function LineMask({ lines, as = 'h2', className = '', delay = 0, inView = false, stagger = 0.06, ...rest }: LineMaskProps) {
const ref = useRef<HTMLHeadingElement>(null);
const [st, setSt] = useState(inView ? 'idle' : 'play'); // idle (visible, untouched) → armed (hidden) → play
useEffect(() => {
if (!inView) return;
const el = ref.current;
if (!el || matchMedia('(prefers-reduced-motion: reduce)').matches) return;
if (el.getBoundingClientRect().top < innerHeight * 0.9) return; // already in view: leave it set
setSt('armed');
const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setSt('play'); io.disconnect(); } }, { threshold: 0.5 });
io.observe(el);
return () => io.disconnect();
}, [inView]);
const Tag = as;
return (
<Tag ref={ref} className={`lx-lm ${className}`} data-lm={st} {...rest}>
{lines.map((t, i) => (
<span className="lx-line" key={i}>
<span style={{ animationDelay: `${delay + i * stagger}s` }}>{t}</span>
</span>
))}
</Tag>
);
}