Skip to content

feat(registry): add hero-flow-field scroll-driven generative streamline block - #75

Merged
pras75299 merged 2 commits into
mainfrom
feat/hero-flow-field
Jun 1, 2026
Merged

pras75299 merged 2 commits into
mainfrom
feat/hero-flow-field

Conversation

@pras75299

@pras75299 pras75299 commented Jun 1, 2026 •

Copy link
Copy Markdown
Owner

Type

  • New component / block (registry)

Summary

Builds backlog section F — the last unbuilt hero idea (#6). A <canvas> flow field of streamlines whose phase is driven by window.scrollY, so the lines bend and wave as the page scrolls, with a glowing particle at each streamline head. Scroll-driven (not cursor-driven) and pure summed-sine generative — distinct from the cursor-driven particle-field/noise-dot-field and the gradient-mesh family.

Screenshots / video (UI changes only)

Canvas/scroll-driven — not capturable as a static frame. Behavior: streamlines reflow as window.scrollY changes; idle drift keeps it alive at rest; prefers-reduced-motion renders a single static frame (no rAF, no scroll listener).

Test plan

  • pnpm test (66 repo + 92 www tests pass)
  • pnpm build:registry — diff limited to hero-flow-field + aggregates + expected ADR-0004 cross-link recompute (particle-field via shared field tag)
  • pnpm registry:validate (64 entries) · pnpm check:reduced-motion (covered)
  • pnpm --dir apps/www build (docs site builds clean) · tsc --noEmit · eslint

New component checklist

Registry sources

  • registry/blocks/hero/flow-field/component.tsx created
  • registry/components/hero-flow-field.json created — registry block + docs block (name, description, category, props)
  • Slug added to order and docsOrder in registry/manifest.json (via pnpm new:component)
  • registry/blocks/hero/flow-field/demo.tsx added + key appended to registry/demos/demo-key-order.json; FlowFieldHero import added to registry/demos/shared.tsx
  • pnpm build:registry run — no unexpected git diff in generated dirs

Component quality gate

  • "use client" at top (uses useEffect/useRef/canvas)
  • Accepts className and merges via cn
  • Props extend correct DOM type (Omit<ComponentProps<"section">, "children">)
  • Uses motion from motion/react; entrance uses type: "spring"
  • Honors useReducedMotion — static frame, no rAF/scroll animation
  • No layout shift on mount — absolutely-positioned canvas background
  • rAF, ResizeObserver, and scroll listener all cancelled/disconnected on unmount
  • SSR-safe — no window/document at module scope; getContext null-guarded
  • Decorative canvas is aria-hidden; CTAs are real <button>s
  • No cross-imports between registry components; only declared dependencies (motion, clsx, tailwind-merge)
  • Render coverage via apps/www/tests/blocks.test.tsx (auto-includes registered demos)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced Flow Field Hero: a full-viewport hero with a scroll-reactive animated canvas background and customizable overlay content with default CTAs.
    • Respects reduced-motion preferences by rendering a static field when enabled.
  • Documentation & Demos

    • Added demo, registry entry, and docs scenario so the new hero appears in component listings and previews.

@vercel

vercel Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
uniqueui-platform Ready Ready Preview, Comment Jun 1, 2026 7:18pm

@coderabbitai

coderabbitai Bot commented Jun 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 47e6b8ee-d878-4ae3-af6f-0aa73ca1cd9f

📥 Commits

Reviewing files that changed from the base of the PR and between 341b45b and f6474b4.

📒 Files selected for processing (10)
  • apps/www/components/ui/hero-flow-field.tsx
  • apps/www/public/r/hero-flow-field.json
  • apps/www/public/r/registry.json
  • apps/www/public/registry.json
  • apps/www/public/registry/changelogs.json
  • apps/www/public/registry/hero-flow-field.json
  • apps/www/public/registry/index.json
  • registry.json
  • registry/blocks/hero/flow-field/component.tsx
  • registry/manifest.json
✅ Files skipped from review due to trivial changes (1)
  • apps/www/public/registry/index.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • apps/www/public/r/registry.json
  • apps/www/public/registry/changelogs.json
  • apps/www/components/ui/hero-flow-field.tsx
  • apps/www/public/r/hero-flow-field.json
  • registry/blocks/hero/flow-field/component.tsx
  • apps/www/public/registry/hero-flow-field.json
  • registry.json

📝 Walkthrough

Walkthrough

Adds FlowFieldHero: a new scroll-reactive canvas flow-field background (FlowFieldBackground) plus a full-viewport hero wrapper (FlowFieldHero) with default motion-animated content, and integrates the block into demos, component config, and registry/manifests.

Changes

Flow Field Hero Component

Layer / File(s) Summary
Config & registry wiring (initial edits)
apps/www/config/components.ts, apps/www/config/demos.tsx, apps/www/config/docs-scenarios.ts, registry/blocks/hero/flow-field/demo.tsx, registry/components/hero-flow-field.json
Adds LucideWind import/registration, registers hero-flow-field in componentDefinitions, adds demo import/entry and docs scenario, and introduces the component registry definition and props shape.
Implementation: apps/www component
apps/www/components/ui/hero-flow-field.tsx, registry/blocks/hero/flow-field/component.tsx
Implements FlowFieldBackground (DPR-aware canvas, ResizeObserver, streamline tracing, smoothed scroll-driven phase + idle drift, rAF loop, reduced-motion static path) and FlowFieldHero wrapper with DefaultFlowFieldContent and default export.
Public registry & embedded implementations
apps/www/public/r/hero-flow-field.json, apps/www/public/r/registry.json, apps/www/public/registry/hero-flow-field.json, apps/www/public/registry/changelogs.json, apps/www/public/registry/index.json
Adds public registry entries embedding the component source, a cn util, dependency lists, metadata, and an initial changelog for the new component.
Registry, demos, and manifest updates
registry.json, registry/blocks/hero/flow-field/*, registry/demos/*, registry/manifest.json
Adds the registry block hero-flow-field, demo entries, shared demo import, updates relatedSlugs entries and demo/manifest ordering to place hero-flow-field after hero-terminal.

Sequence Diagram

sequenceDiagram
  participant User as Page (scroll)
  participant Scroll as ScrollListener
  participant RAF as requestAnimationFrame loop
  participant Canvas as FlowFieldBackground (canvas)
  participant Reduce as useReducedMotion

  User->>Scroll: window.scrollY changes
  Scroll->>RAF: update target scroll (smoothed)
  Reduce->>Reduce: check prefers-reduced-motion
  alt Motion enabled
    RAF->>Canvas: interpolate phase from smoothed scroll + idle drift
    Canvas->>Canvas: compute streamline angles & draw streamlines + head particles
    RAF->>RAF: schedule next frame
  else Motion disabled
    Reduce->>Canvas: render single static frame anchored to current scroll
  end
Loading

🎯 4 (Complex) | ⏱️ ~45 minutes

"🐰
I trace the wind with gentle scroll,
bright heads aglow, lines weave and roll,
a hero stands where pixels play,
registry whispers: ship today!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a new hero-flow-field block that uses scroll-driven generative streamlines, directly matching the changeset's primary contribution.
Description check ✅ Passed The description comprehensively covers all required template sections: type selection, detailed summary with use-case distinction, test plan with checkmarks, and complete new component checklist with all items marked complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hero-flow-field

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
registry/blocks/hero/flow-field/component.tsx (1)

7-25: 💤 Low value

Consider exporting FlowFieldBackgroundProps and FlowFieldHeroProps types.

Consumers who want to type their props (e.g., when building wrappers or storing config objects) cannot reference these types. Since backgroundProps exposes FlowFieldBackgroundProps in the public API, exporting both improves DX.

♻️ Proposed fix
-type FlowFieldBackgroundProps = {
+export type FlowFieldBackgroundProps = {
-type FlowFieldHeroProps = Omit<ComponentProps<"section">, "children"> & {
+export type FlowFieldHeroProps = Omit<ComponentProps<"section">, "children"> & {

Also applies to: 161-164

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry/blocks/hero/flow-field/component.tsx` around lines 7 - 25, The
FlowFieldBackgroundProps and FlowFieldHeroProps types are currently internal;
export both type declarations so downstream consumers can import them (e.g., for
typing wrappers or config objects). Locate the type declarations named
FlowFieldBackgroundProps and FlowFieldHeroProps in component.tsx and add exports
(export type FlowFieldBackgroundProps = ... and export type FlowFieldHeroProps =
...) so they become part of the public API while leaving the implementations
unchanged.
registry/manifest.json (1)

68-68: ⚡ Quick win

Inconsistent grouping: magnetic-text breaks the hero-* component group.

In the order array, magnetic-text (line 68) is placed between hero-terminal and hero-flow-field, interrupting the hero-* component grouping pattern (lines 61-69). However, in the docsOrder array, magnetic-text appears at line 86, well before the hero-* group (lines 128-135).

For consistency and maintainability, magnetic-text should be positioned outside the hero-* group in both arrays.

♻️ Proposed fix to align grouping across arrays
     "hero-magnetic-letters",
     "hero-terminal",
-    "magnetic-text",
     "hero-flow-field"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry/manifest.json` at line 68, The manifest's ordering is inconsistent:
the "magnetic-text" entry currently interrupts the hero-* group in the order
array (sitting between "hero-terminal" and "hero-flow-field") but is placed
before the hero group in docsOrder; move the "magnetic-text" entry so it is
located outside and consistently positioned relative to all "hero-*" entries in
both arrays (order and docsOrder), ensuring the hero-* block remains contiguous
(e.g., place magnetic-text before or after the entire hero-* block in both
arrays).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/www/public/registry.json`:
- Line 4044: The FlowFieldBackground component uses the spacing prop directly
which can be <=0 or non-finite and break the render loop; before any grid math
(e.g., where cols/rows and step are computed in render and where spacing is used
elsewhere), validate and clamp spacing to a sensible positive finite value
(e.g., fallback to the existing default like 56 or a small minimum such as 8) so
downstream math in render, cols/rows, and loop stepping is always safe; update
references to spacing inside FlowFieldBackground (including render and any
derived vars like step/stepLen) to use the validated/clamped value.

In `@registry.json`:
- Line 4044: The render loop can lock up if spacing is 0/NaN/Infinity because
cols/rows are computed directly from the spacing prop; before using spacing
inside FlowFieldBackground (e.g., in render and variables cols/rows), normalize
it to a positive finite value (clamp or fallback) — for example compute a local
seedSpacing = Number.isFinite(spacing) && spacing > 0 ? spacing : 56 — and use
seedSpacing everywhere (cols, rows, step, stepLen) so the nested loops always
iterate a safe finite number of times.
- Line 4044: The reduced-motion path renders once but the resize() handler
doesn't redraw the canvas for reduced users; update the resize function (inside
the useEffect) to trigger a render when reduced is true — e.g., after setting
canvas.width/height and ctx.setTransform(...) call render(scroll * 0.0015 *
scrollStrength) (using the existing render, scroll and scrollStrength symbols)
so the canvas is repainted after container/viewport resizes; keep the existing
ResizeObserver (ro) and cleanup.

In `@registry/blocks/hero/flow-field/component.tsx`:
- Around line 223-238: The two button elements in
registry/blocks/hero/flow-field/component.tsx (the "Get started" button using
the class string starting with "group inline-flex..." and the "View source"
button using the class string starting with "inline-flex...") lack explicit
focus-visible styles; add consistent keyboard focus styles to both by appending
utility classes such as focus-visible:outline-none plus a visible ring (e.g.
focus-visible:ring-2, focus-visible:ring-offset-2, and a suitable color like
focus-visible:ring-white/40 or similar) so keyboard users get a clear,
consistent focus indicator that matches the existing hover/visual design.

---

Nitpick comments:
In `@registry/blocks/hero/flow-field/component.tsx`:
- Around line 7-25: The FlowFieldBackgroundProps and FlowFieldHeroProps types
are currently internal; export both type declarations so downstream consumers
can import them (e.g., for typing wrappers or config objects). Locate the type
declarations named FlowFieldBackgroundProps and FlowFieldHeroProps in
component.tsx and add exports (export type FlowFieldBackgroundProps = ... and
export type FlowFieldHeroProps = ...) so they become part of the public API
while leaving the implementations unchanged.

In `@registry/manifest.json`:
- Line 68: The manifest's ordering is inconsistent: the "magnetic-text" entry
currently interrupts the hero-* group in the order array (sitting between
"hero-terminal" and "hero-flow-field") but is placed before the hero group in
docsOrder; move the "magnetic-text" entry so it is located outside and
consistently positioned relative to all "hero-*" entries in both arrays (order
and docsOrder), ensuring the hero-* block remains contiguous (e.g., place
magnetic-text before or after the entire hero-* block in both arrays).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e1ae295-bbca-40d7-8753-d585f55b76c4

📥 Commits

Reviewing files that changed from the base of the PR and between 5872149 and 341b45b.

📒 Files selected for processing (18)
  • apps/www/components/ui/hero-flow-field.tsx
  • apps/www/config/components.ts
  • apps/www/config/demos.tsx
  • apps/www/config/docs-scenarios.ts
  • apps/www/public/r/hero-flow-field.json
  • apps/www/public/r/registry.json
  • apps/www/public/registry.json
  • apps/www/public/registry/changelogs.json
  • apps/www/public/registry/hero-flow-field.json
  • apps/www/public/registry/index.json
  • apps/www/public/registry/particle-field.json
  • registry.json
  • registry/blocks/hero/flow-field/component.tsx
  • registry/blocks/hero/flow-field/demo.tsx
  • registry/components/hero-flow-field.json
  • registry/demos/demo-key-order.json
  • registry/demos/shared.tsx
  • registry/manifest.json

Comment thread apps/www/public/registry.json Resolved
Comment thread registry.json Resolved
Comment on lines +223 to +238
<button
type="button"
className="group inline-flex h-11 items-center gap-2 rounded-full bg-white px-6 text-sm font-medium text-black transition-transform duration-200 hover:-translate-y-px"
>
<span>Get started</span>
<span aria-hidden className="transition-transform duration-200 group-hover:translate-x-0.5">
→
</span>
</button>
<button
type="button"
className="inline-flex h-11 items-center gap-2 rounded-full border border-white/15 px-6 font-mono text-xs uppercase tracking-[0.18em] text-white/85 backdrop-blur transition-colors hover:bg-white/5"
>
View source
</button>
</motion.div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add focus-visible styles for keyboard accessibility.

Both buttons rely on the browser's default focus ring. Adding explicit focus-visible styles ensures consistent visibility across browsers and matches the existing hover styling.

♿ Proposed fix
         <button
           type="button"
-          className="group inline-flex h-11 items-center gap-2 rounded-full bg-white px-6 text-sm font-medium text-black transition-transform duration-200 hover:-translate-y-px"
+          className="group inline-flex h-11 items-center gap-2 rounded-full bg-white px-6 text-sm font-medium text-black transition-transform duration-200 hover:-translate-y-px focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-[`#06070a`]"
         >
           <span>Get started</span>
           <span aria-hidden className="transition-transform duration-200 group-hover:translate-x-0.5">
             →
           </span>
         </button>
         <button
           type="button"
-          className="inline-flex h-11 items-center gap-2 rounded-full border border-white/15 px-6 font-mono text-xs uppercase tracking-[0.18em] text-white/85 backdrop-blur transition-colors hover:bg-white/5"
+          className="inline-flex h-11 items-center gap-2 rounded-full border border-white/15 px-6 font-mono text-xs uppercase tracking-[0.18em] text-white/85 backdrop-blur transition-colors hover:bg-white/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:ring-offset-2 focus-visible:ring-offset-[`#06070a`]"
         >
           View source
         </button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@registry/blocks/hero/flow-field/component.tsx` around lines 223 - 238, The
two button elements in registry/blocks/hero/flow-field/component.tsx (the "Get
started" button using the class string starting with "group inline-flex..." and
the "View source" button using the class string starting with "inline-flex...")
lack explicit focus-visible styles; add consistent keyboard focus styles to both
by appending utility classes such as focus-visible:outline-none plus a visible
ring (e.g. focus-visible:ring-2, focus-visible:ring-offset-2, and a suitable
color like focus-visible:ring-white/40 or similar) so keyboard users get a
clear, consistent focus indicator that matches the existing hover/visual design.

@pras75299

Copy link
Copy Markdown
Owner Author

Addressed all CodeRabbit findings in f6474b4:

  • Major — clamp spacing: added safeSpacing = Number.isFinite(spacing) && spacing > 0 ? spacing : 56 so a <= 0/non-finite prop can't blow up cols/rows and freeze the render loop. (Covers both the registry.json and public/registry.json inline comments — same source.)
  • Nitpick — export prop types: FlowFieldBackgroundProps and FlowFieldHeroProps are now exported for consumer DX.
  • Quick win — order grouping: moved hero-flow-field above magnetic-text in registry/manifest.json so the hero-* group stays contiguous in both order and docsOrder.

Edits made on the source of truth (registry/blocks/hero/flow-field/component.tsx, registry/manifest.json) then pnpm build:registry. Verified: 66 repo + 92 www tests, registry:validate (64 entries), check:reduced-motion, tsc --noEmit, eslint, and apps/www build all green.

@pras75299
pras75299 merged commit 21c044d into main Jun 1, 2026
12 checks passed

This branch was successfully deployed

1 active deployment
Preview — f6474b44 Deployed Jun 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant