Pro
Sweep apply
Reviews a set of suggested changes to one file, hunk by hunk. Accept or reject each change, or sweep through all of them as a highlight travels down each hunk while it merges.
pnpm dlx shadcn@latest add @caliper/sweep-applyFix: hold to confirm never fires
Three edits from Kofi Mensah's review of pull request #482
hold-to-confirm.tsx3 of 3 changes pendingNothing applied yet. Saving keeps the file as it is.
When to use
Use it for
- Reviewing an assistant's edits to a file before they are written.
- Applying a set of suggested fixes where each one needs a yes or no.
Skip it when
- Comparing two files with no decision to make; use the file diff.
- Merge conflicts, which need a third side to choose from.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- It hands back the file, not a log
- onChange gives the text with every accepted change applied, plus the counts. Pending and rejected changes keep the original lines, so applying the result is one assignment.
- Rejecting is as visible as accepting
- Accepting closes the removed lines and lets the added ones settle into plain code; rejecting closes the additions. Either way the resolved hunk stays on screen with an Undo, so nothing vanishes.
Usage
- Signs, not colour, carry the meaning
- Every line has a + or − and a spoken Added or Removed. The violet and orange tints are the file diff's, so the two read as one system.
Installation
pnpm dlx shadcn@latest add @caliper/sweep-apply
Adds its 7 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from SweepApply and countSweepChanges.
import { SweepApply, countSweepChanges } from "@/components/ui/sweep-apply"
The worked example comes with Pro
The 78-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
SweepApply
component
countSweepChanges
component
No props of its own; it accepts the native props of its root element.
Accessibility
It exposes status and region semantics, with aria-hidden and aria-label kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.
Related
- File diffA line-by-line comparison of two versions of a file.
- Version historyEvery saved version of a document, grouped by day: see what changed against now or the version before, name the important ones, and restore any of them without losing what is there.
- Undo rewindThe bar that follows a destructive action: what happened, an Undo button and a ring that drains over the time you have left. Ctrl or Cmd Z undoes it too.