Skip to content

Export curated PhotoViewer hooks as public API #32

Description

@kulcsarrudolf

Motivation

The PhotoViewer refactor (#7, PR #13) produced a set of well-scoped hooks in src/hooks/photo-viewer/, but none are exported.
Consumers who want a custom viewer UI with the same zoom/gesture behavior currently have to reimplement them.

Proposed change

Export a curated subset from src/index.ts, the ones that are generally reusable:

  • useTransform
  • useWheelZoom
  • useTouchGestures
  • useKeyboardShortcuts

Deliberately keep the viewer-internal glue private (useImageNavigation, useImagePreloader, useMouseDrag, useClickOutsideToClose, usePhotoViewerSettings) to preserve refactoring freedom; they can graduate later if there is demand.

Each exported hook gets:

  • TSDoc comments on the hook and its options/return types.
  • A "Hooks" section in the README with a minimal custom-viewer example.
  • Type exports for their option/return shapes.

Best done after component/hook tests exist, so the exported behavior is locked in before it becomes public API.

Acceptance criteria

  • The four hooks importable from the package root with full types.
  • README documents each with an example.
  • Tests cover the exported hook contracts.

Compatibility

Purely additive API.
Existing exports unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions