PURPOSE

Stub module that exposes a React-ref hook for naming DOM anchor points in the UI. Anchors are intended targets for fly-to animations and positional FX (wallet counters, progress bars, nav tabs). The current implementation is a placeholder — it returns an unmanaged ref and does not register or track anchors anywhere.

OWNS

  • The useAnchor hook.
  • The intended contract for anchor identity (string anchorId keys such as wallet-gems, bar-chapter).

READS FROM

  • React’s useRef to allocate the ref object returned to callers.

PUSHES TO

  • Nothing. The hook returns a RefObject<HTMLDivElement | null> to the calling component; no registry, store, or service is updated.

DOES NOT

  • Register anchors in any global map or store.
  • Track lifecycle (mount / unmount) of anchored elements.
  • Resolve anchorId to a DOM node for animation systems — the anchorId parameter is currently unused.
  • Compute screen-space coordinates or expose them to FX systems.
  • Emit or subscribe to signals.

Signals

None. The stub does not publish or listen to any events.

Entry points

  • useAnchor(anchorId: string): React.RefObject<HTMLDivElement | null> — React hook. Callers spread the returned ref onto a JSX element via ref={...}. The anchorId argument is accepted but ignored in the stub.

Pattern notes

  • Marked STUB — not yet implemented in the source header. Treat this file as a placeholder API surface, not a working registry.
  • The anchorId parameter is prefixed with an underscore (_anchorId) to silence unused-arg warnings, signalling the value is reserved for a future implementation.
  • Return type is RefObject<HTMLDivElement | null>, locking anchored elements to div nodes for now.
  • A real implementation would need a registry keyed by anchorId, ref-callback wiring to capture mount/unmount, and a query API for FX systems to look up live DOM rects by id.
  • File lives under src/starship-survivors/services/, alongside other engine-side service modules; the hook itself is React-side and intended for use by metagame UI components.