• English
  • Hooks & Contexts

    4 Contexts

    AppContext (contexts/AppContext.tsx)

    Site-wide interactive state and effects. Provides:

    • loading sequence state
    • power / battery / inversion state
    • real-time stats (FPS, etc.)
    • home page typing effect control
    • column hover state

    Consumed via useAppContext().

    TransitionContext (contexts/TransitionContext.tsx)

    Controls route transition animations. Provides:

    • navigateTo(url)all internal navigation must use this, never router.push() (GOTCHAS #6)
    • setBackOverride() — lets detail views and lightbox intercept BACK behavior

    Consumed via useTransition().

    LayoutAnchorsContext (contexts/LayoutAnchorsContext.tsx)

    Registers active scroll containers. Since the layout uses fixed-height content containers, deep-link scrolling must target the container, not the document viewport.

    SiteAssetsContext (contexts/SiteAssetsContext.tsx)

    Provides catalog-resolved site-shell resources (favicon, og:image, avatar). Consumes data from /api/assets/home.

    22 Hooks

    Performance & device

    HookFileResponsibility
    useAdaptivePerformancehooks/useAdaptivePerformance.tsFour-tier adaptive performance control (full / balanced / reduced / minimal) with runtime FPS sampling
    useMediaQueryhooks/useMediaQuery.tsCSS media query listener
    useMobileTesseractChargehooks/useMobileTesseractCharge.tsMobile tesseract charge logic

    Blog system

    HookFileResponsibility
    useBlogPostStatehooks/useBlogPostState.tsBlog post state machine (idle → checking → granted/required → loading → ready/error)

    Routing & navigation

    HookFileResponsibility
    useLayoutRouteModehooks/useLayoutRouteMode.tsLayout route mode determination
    useRouteLoadingKindhooks/useRouteLoadingKind.tsDetermines loading overlay variant by source path (not target path)
    useDrawerNavigationhooks/useDrawerNavigation.tsDrawer navigation control

    Detail page

    HookFileResponsibility
    useDetailHeroParallaxhooks/useDetailHeroParallax.tsDetail hero parallax
    useDetailScrollRevealhooks/useDetailScrollReveal.tsDetail scroll reveal animation
    useDetailSectionNavhooks/useDetailSectionNav.tsDetail section navigation
    useDetailTitleRevealhooks/useDetailTitleReveal.tsDetail title reveal animation

    Typing effect

    HookFileResponsibility
    useTypingEffecthooks/useTypingEffect.tsBase typing effect (Unicode script classification: Latin vs CJK paths, GOTCHAS #26)
    useTypingSubtitlehooks/useTypingSubtitle.tsHome subtitle typing effect

    Interaction & UI

    HookFileResponsibility
    useCursorTargetRegistryhooks/useCursorTargetRegistry.tsCustom cursor target registration
    useGalleryLightboxhooks/useGalleryLightbox.tsGallery lightbox control
    usePowerSystemhooks/usePowerSystem.tsPower system
    useRealtimeStatshooks/useRealtimeStats.tsReal-time stats (FPS, memory, etc.)
    useLoadingSystemhooks/useLoadingSystem.tsLoading system
    useStandalonePanelStatehooks/useStandalonePanelState.tsStandalone panel state
    useAnimationSequencehooks/useAnimationSequence.tsAnimation sequence orchestration
    useColumnHoverhooks/useColumnHover.tsHome column hover state
    useVisitorLanguageCodehooks/useVisitorLanguageCode.tsVisitor language code detection

    Utilities

    HookFileResponsibility
    useSafeTimeoutshooks/use-safe-timeouts.tsSafe setTimeout wrapper that auto-cleans up on unmount

    Context-to-Hook relationships

    AppContext
      └─ usePowerSystem
      └─ useRealtimeStats
      └─ useTypingEffect / useTypingSubtitle
      └─ useColumnHover
      └─ useLoadingSystem
      └─ useMediaQuery
    
    TransitionContext
      └─ useRouteLoadingKind
      └─ useLayoutRouteMode
      └─ useDrawerNavigation
    
    LayoutAnchorsContext
      └─ (scroll containers)
    
    Standalone (no context dependency)
      ├─ useAdaptivePerformance
      ├─ useBlogPostState
      ├─ useDetailHeroParallax / useDetailScrollReveal / useDetailSectionNav / useDetailTitleReveal
      ├─ useCursorTargetRegistry
      ├─ useGalleryLightbox
      ├─ useMobileTesseractCharge
      ├─ useAnimationSequence
      ├─ useStandalonePanelState
      ├─ useSafeTimeouts
      └─ useVisitorLanguageCode