Skip to content

Post-v1 follow-ups (hamo 1.x) #19

Description

@arzafran

Consolidated tracker for the non-blocking items deferred from #12 (v1.0.0). None of these block the v1 release — they're refinements/decisions for a 1.x. Each is self-contained below; check off as they land.


1. Decouple lenis from the main entry

v1 ships lenis as a required peer because the root hamo entry statically re-exports useScrollTrigger, which statically imports lenis/react — so an optional peer wasn't a robust guarantee (could fail to resolve in Vite dev / SSR for consumers who skipped it). Make it genuinely optional again:

  • Variant A (recommended): move useScrollTrigger / useTransform behind a hamo/scroll-trigger subpath (like the debugger already is) so the main entry never imports lenis. Breaking import move — cheap now while the hooks are new.
  • Variant B: dependency injection (pass the Lenis instance in instead of importing it).
  • Acceptance: importing only non-scroll hooks resolves with no lenis installed — verify in Vite dev and SSR, not just a tree-shaken prod bundle (that path is what publint/attw/local builds miss, since lenis is in devDeps).

2. useRect: scroll offset coordinate space

  • scrollTop/scrollLeft (packages/hamo/src/use-rect/utils.ts) accumulate scroll past the intended wrapper boundary up to the document root. Pending a coordinate-space decision (wrapper-relative vs document-relative); current behavior is tested and intentional for v1. If wrapper-relative is correct, bound the traversal and lock it with tests.

3. useScrollTrigger: stale progress on resize without scroll

  • update() is a stable useEffectEvent and its effects depend only on [lenis, update, ...deps], so a resize / geometry change without a subsequent scroll doesn't recompute progress until the next scroll/transform tick. Pre-existing since the feat: useScrollTrigger, useTransform, useEffectEvent #11 port (verified not a regression; surfaced by the cross-model review during v1 hardening). Decide whether to recompute on resize (add the derived start/end inputs to the effect deps, or recompute via the existing useWindowSize/useRect signals) or document it as intended.

4. Upgrade playground to astro 7 (blocked on upstream regression)

  • The playground stays on astro 6.4.8 (latest stable that works). Upgrading to astro 7.0.0 + @astrojs/react 6 + vite 8 breaks dev-mode React-island hydration: [astro-island] ... react_jsx-runtime.js does not provide an export named 't'. The production build is fine, but bun run dev renders the islands blank (clearing the vite cache does not help — it's an interop bug, not staleness). Revisit once astro 7.0.x / @astrojs/react 6.0.x patch the jsx-runtime interop, then re-verify dev hydration in-browser.

Supersedes #15, #17, #18 (closed in favour of this single tracker). Related: #12 (v1.0.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions