zundo icon indicating copy to clipboard operation
zundo copied to clipboard

zundo v2

Open charkour opened this issue 2 years ago • 1 comments

After a year of the v1, it's finally time for the next major release of zundo. The goal is to create a smaller bundle size, have an easier API, and improve type correctness.

All new work is being done in packages/zundo

Here is a checklist that is required before v2 can be released:

  • [x] Support zustand v4
  • [x] modify zustand types to support temporal object
  • [x] create temporal factory function (undo, redo, clear, pastStates, futureStates)
  • [x] persist option (to replace include and exclude)
  • [x] add steps param to undo and redo
  • [x] Add option to pause and resume history tracking (pause(): void, resume(): void, state: 'tracking' | 'paused')
  • [x] Add optional historyDepthLimit as limit
  • [x] Add option to pass equality function to save states (rather than bundling lodash/isEqual)
  • [x] Add option to provide a callback when state is saved in temporal store. onSave
  • [x] Add handleSet middleware. ~Add option to set coolDownTime.~ Maybe we can allow the user to pass in a function rather then writing it ourself? Debounce vs Throttle
  • [x] chained middleware support
  • [ ] update readme IN PROGRESS
  • [ ] dev tools support IN PROGRESS

Future versions of v2

  • [ ] create nicer API, or a helper hook in react land (useTemporal). or vanilla version of the it
  • [ ] Allow alternative storage engines for past and future states
  • [ ] See if it canUndo and canRedo
  • [ ] Set initial history, past and future states
  • [ ] create jump method that takes an integer
  • [ ] create a present object that holds the current state? perhaps
  • [ ] support history branches rather than clearing the future states
  • [ ] Pass middleware to temporal store
  • [ ] store state delta rather than full object

charkour avatar Aug 03 '22 13:08 charkour

Might need to update tests to use React ACT: https://github.com/pmndrs/its-fine/blob/main/tests/setupTests.ts

charkour avatar Sep 06 '22 14:09 charkour