Files
zeekayandGitHub 0dc133872c Type pages (cloudfam to McpPage) under strict (#10)
* Type the cloud pages under strict

Props, state, refs and handlers for components/pages/cloud (Frame through
Network), plus a CSSProperties augmentation so style objects may carry
custom properties. Frame's useLive takes the element type where a caller
reads or writes the ref.

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

* Type the page subfolders under strict

Props, state, refs and handlers for the entrance hooks and data modules
in cloudfam through mcp. Data shapes that more than one file reads live
in <module>.types.ts beside them.

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

* Type the top-level pages under strict

Props, state, refs and handlers for the pages Contact through McpPage,
the htmltree reader and the legal, history and grants data modules.

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

* Type local easings as bezier tuples, and lib/motion's

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

54 lines
2.5 KiB
TypeScript

'use client';
/* Page-local copy of components/v2/MaskLines for /integrations: reduced motion is read after hydration (the shared one
mismatches the server HTML under reduced motion; see docs/build-notes/requests/integrations.md). */
import { useEffect, useRef, useState } from 'react';
import { motion, useInView, useReducedMotion } from 'motion/react';
import type { MotionStyle } from 'motion/react';
import '../../v2/ProofScale.css';
const EASE: [number, number, number, number] = [0.16, 1, 0.3, 1];
interface Props { as?: 'h1' | 'h2' | 'h3'; lines: string[]; className?: string; delay?: number; amount?: number; id?: string; style?: MotionStyle }
export default function MaskLines({ as = 'h2', lines, className = '', delay = 0, amount = 0.4, id, style }: Props) {
const ref = useRef<HTMLHeadingElement>(null);
const seen = useInView(ref, { once: true, amount });
const rm = useReducedMotion();
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
const reduce = mounted && rm; // read after hydration: server and first client render agree
// a first visit opens behind the arrival curtain (components/arrival.js): wait for it to lift, or no one sees the cut-in
const [ready, setReady] = useState(true);
useEffect(() => {
if (!document.documentElement.classList.contains('x-arriving')) return;
setReady(false);
const go = () => setReady(true);
addEventListener('hz-arrived', go, { once: true });
const t = setTimeout(go, 4000); // the curtain's own failsafe is 3.5s
return () => { removeEventListener('hz-arrived', go); clearTimeout(t); };
}, []);
const Tag = motion[as] || motion.h2;
return (
<>
{/* JS off: the lines stand in place (an !important rule beats the inline start transform). Kept outside the
heading so the heading's text is only its words. */}
<noscript dangerouslySetInnerHTML={{ __html: '<style>.pf-mask-in{transform:none!important}</style>' }} />
<Tag ref={ref} id={id} className={className} style={style}>
{lines.map((l, i) => (
<span key={i} className="pf-mask-l">
<motion.span
className="pf-mask-in"
initial={reduce ? false : { y: '105%' }}
animate={(seen && ready) || reduce ? { y: '0%' } : { y: '105%' }}
transition={{ duration: reduce ? 0 : 0.7, ease: EASE, delay: delay + i * 0.06 }}
>
{l}
</motion.span>
{i < lines.length - 1 ? ' ' : null}
</span>
))}
</Tag>
</>
);
}