Repository navigation
v0.2.0
Minor Changes
-
783e87e: Paste, copy groups and image capture.
usePaste: read the clipboard with the same honest state machine asuseCopy(idle → reading → read | error). Supports a Paste button (paste()) and keyboard paste with no permission prompt (targetPropsorlistenOnDocument). Strict by default: plain text only unless youacceptmore, images verified from their bytes, SVG never matched by wildcards,maxBytes/maxItemsenforced before decoding. Framework-agnosticcreatePasteMachineandcreateBrowserPasteAdapterinreact-smart-copy/core.<CopyGroup>: only oneuseCopy/CopyFieldinside shows "Copied" at a time. Built oncreateCopyCoordinator(), also usable from vanillacreateCopyMachine({ coordinator }).react-smart-copy/capture(new, opt-in entry, zero dependencies):svgToPngBlob,captureElement,captureSourceandcaptureImageto copy an<svg>or any element as a verified PNG, with pixel limits, timeouts andAbortSignalsupport.- Fix (React 18): a fast
CopyFieldcopy could stay on "Copied" instead of auto-resetting, becauseuseDisplayStatusupdated state during render, which disturbsuseSyncExternalStoreon React 18. - Fix: an image copy is no longer reported as copied when a lax clipboard implementation resolves without reading an image source that failed.
toCopyError(cause, operation)now produces read-specific messages and classifiesAbortError/TimeoutError. NewdescribePasteError().
Heads-up:
CopyErrorTypegainsno-content,too-large,timeoutandaborted. If you keep an exhaustiveRecord<CopyErrorType, string>of translations, add these four keys.