API reference
components/undo-action
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/undo-action";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | FuseProps | Props accepted by Fuse. |
| type alias | UndoActionProps | Props accepted by UndoAction. |
| constant | UndoAction | A destructive action that waits for its undo window instead of asking first. Pressing it turns the same button into Undo with a fuse burning along its edge; Undo or Escape cancels, and the action commits when the fuse runs out. Resting the pointer on it holds the fuse. |
| function | Fuse() | A hairline that burns down over its duration, then calls onBurnt. Its
thickness is the theme’s --stipe-motion-fuse (0 hides it but the window still
runs). Under reduced motion it ticks down once a second instead of burning
smoothly. |
FusePropstype alias
Section titled “FuseProps”type FuseProps = object;Props accepted by Fuse.
Properties
Section titled “Properties”duration
Section titled “duration”duration: number;How long the fuse burns, in milliseconds: a decision window, not motion.
paused?
Section titled “paused?”optional paused?: boolean;Hold the burn, for example while the pointer rests on the action.
onBurnt
Section titled “onBurnt”onBurnt: () => void;Called once when the fuse has burnt down.
Returns
Section titled “Returns”void
className?
Section titled “className?”optional className?: string;UndoActionPropstype alias
Section titled “UndoActionProps”type UndoActionProps = object & Omit<ButtonProps, "children" | "onClick" | "result" | "resultLabel">;Props accepted by UndoAction.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
children |
ReactNode |
The action’s label, such as “Stop”. |
onCommit() |
() => void |
Runs when the undo window closes without an undo: the action happens then. |
armedAnnouncement |
string |
Spoken when the action is armed, such as “Port 5173 stops in 5 seconds”. |
undoneAnnouncement |
string |
Spoken after an undo, such as “Port 5173 kept open”. |
undoLabel? |
ReactNode |
- |
undoMs? |
number |
The undo window in milliseconds. |
UndoActionconstant
Section titled “UndoAction”const UndoAction: ForwardRefExoticComponent< object & Omit<ButtonProps, "children" | "onClick" | "result" | "resultLabel"> & RefAttributes<HTMLButtonElement>>;A destructive action that waits for its undo window instead of asking first. Pressing it turns the same button into Undo with a fuse burning along its edge; Undo or Escape cancels, and the action commits when the fuse runs out. Resting the pointer on it holds the fuse.
Fuse()function
Section titled “Fuse()”function Fuse(__namedParameters): Element;A hairline that burns down over its duration, then calls onBurnt. Its
thickness is the theme’s --stipe-motion-fuse (0 hides it but the window still
runs). Under reduced motion it ticks down once a second instead of burning
smoothly.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
__namedParameters |
FuseProps |
Returns
Section titled “Returns”Element