UNPKG

jotai-history-global

Version:

Lightweight global undo/redo extension for Jotai. / 为 Jotai 提供全局撤销、重做功能的轻量扩展。

23 lines (22 loc) 715 B
/** * Diff utilities for computing and applying differences between values */ import type { Diff } from './types'; /** * Creates a deep diff between two values * @param oldValue - The old value * @param newValue - The new value * @returns The difference or null if no differences */ export declare function createDiff(oldValue: unknown, newValue: unknown): Diff | null; /** * Applies a diff to a value to get the new value * @param value - The current value * @param diff - The diff to apply * @returns The new value */ export declare function applyDiff<T>(value: T, diff: Diff): T; /** * Reverses a diff so it can be applied to undo a change */ export declare function reverseDiff(diff: Diff): Diff;