{"_id":"@arrisa/history","_rev":"7-b832713ede6e1efb9e5ad6a4751f7d9b","name":"@arrisa/history","dist-tags":{"latest":"1.0.29"},"versions":{"0.1.1":{"name":"@arrisa/history","version":"0.1.1","license":"MIT","_id":"@arrisa/history@0.1.1","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"12a1544318ff6f977d40424fcbc6585ac6606705","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-0.1.1.tgz","fileCount":25,"integrity":"sha512-DxwGkAhpVmYNh5p0VPYaXa0zPm5K+VBOg7YjRedOXzSkec1U3Xx2rVNRR92SN6sS+V5lmX8YXvpCKBQm4EjTPg==","signatures":[{"sig":"MEQCIE1ul2tOuIrxGscrwyIqdZWGV2fuhNG80lL9gIxNO4/oAiAS+JXicScT3s5l1I6mnOcqRL4uVhjgd0CSoCzbzCgShg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57745},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/f541f5b73cd1e3633297acab5db2ad45/arrisa-history-0.1.1.tgz","_integrity":"sha512-DxwGkAhpVmYNh5p0VPYaXa0zPm5K+VBOg7YjRedOXzSkec1U3Xx2rVNRR92SN6sS+V5lmX8YXvpCKBQm4EjTPg==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"0.1.1","@arrisa/state":"0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_0.1.1_1788634718504_0.5250171048514347","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@arrisa/history","version":"0.1.2","license":"MIT","_id":"@arrisa/history@0.1.2","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"205b4c17ecd35cd33870ea121fd37de0000f9d25","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-0.1.2.tgz","fileCount":25,"integrity":"sha512-N1EwULemD1m4Rrm0LXv4O1iBq69kE03UyQtUYb840HrtcVb/3qbxyXFMZJAXHzVgGzvSc5WzbsVJvEn0JElJxQ==","signatures":[{"sig":"MEQCIFtBO993k5/9qhhOM42m7yiIVMYk9euBfw4nhT6HUVzZAiBUX2m2QeHZmpcUwuy83FDaOCBf8etqd4wQa1lXuPx1og==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIADOTmk+Mzd2pOdwRMa21uscpTNzHtsanSXGsY1NQ+pkAiEAlrLucEL1Z2lpk38S1J4ccVy2mQB34C8SFTHkdrWCXrI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57745},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/9da01239998f66951a2f0cb5fc1fce56/arrisa-history-0.1.2.tgz","_integrity":"sha512-N1EwULemD1m4Rrm0LXv4O1iBq69kE03UyQtUYb840HrtcVb/3qbxyXFMZJAXHzVgGzvSc5WzbsVJvEn0JElJxQ==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"0.1.2","@arrisa/state":"0.1.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_0.1.2_1788718387351_0.33186497230674883","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@arrisa/history","version":"0.1.3","license":"MIT","_id":"@arrisa/history@0.1.3","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"7213e45a9c0dbbc8d2f81fe8b8ece4d459c6d12c","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-0.1.3.tgz","fileCount":25,"integrity":"sha512-iLL7JhSOLqfkJD8mXpr4a68rHZE4JE2o2tlPpBh7nIecAIPGlz1cHK9aAdw8IiMzwfT+zPr+BLMPgW9/EDRwGw==","signatures":[{"sig":"MEUCIDQfSjGTk5XLtrCQuRmD2Ux6lmfGUqFC56G5YSrRRxQXAiEAqV6qTGBrtMD+rK4g/x5TubET1PFh0ItmDD2nhhnGn6g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCi/rFfw5W4rTOHPiJP5pMP5kRZqrqKU6vcdIVpyibeAgIgWQLULo9GD0G39zrMHlqw653cdk6GuGL98vExWA92GtY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57745},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-0.1.3.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/1a76cc23a626d7a7c733d26b59644aad/arrisa-history-0.1.3.tgz","_integrity":"sha512-iLL7JhSOLqfkJD8mXpr4a68rHZE4JE2o2tlPpBh7nIecAIPGlz1cHK9aAdw8IiMzwfT+zPr+BLMPgW9/EDRwGw==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"0.1.3","@arrisa/state":"0.1.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_0.1.3_1788802274454_0.36518114578111716","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@arrisa/history","version":"0.1.5","license":"MIT","_id":"@arrisa/history@0.1.5","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"ee6e1362dd9fcb816b0730f622982b2bfdf5b036","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-0.1.5.tgz","fileCount":25,"integrity":"sha512-f/enJkc+D3XdctH/BvrE9eYJ41KBQ3oTucFEHnkrpM8qOJhZyV05pQnb5xvArfPvfKv8lDK8WVxydStVifDzsg==","signatures":[{"sig":"MEQCID+zcn1pyMacYeprTDaNMuFuETegzXDMaTNgMh135UaTAiBrTYmXCYTW2qNJDvoTCOMIwTnwjjHZVSTYERalWVsX6Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCICXD9qeT58JAXCndn5rZm103eiQ7BOzJiQTr7t721utuAiABC9cdxc4XlLr5WIl/oUtiIx5sOzk9YIb20No+s/YlcA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57745},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-0.1.5.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/87a9c0965cfbf00f204a0c51068952a9/arrisa-history-0.1.5.tgz","_integrity":"sha512-f/enJkc+D3XdctH/BvrE9eYJ41KBQ3oTucFEHnkrpM8qOJhZyV05pQnb5xvArfPvfKv8lDK8WVxydStVifDzsg==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"0.1.5","@arrisa/state":"0.1.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_0.1.5_1788984228379_0.275787130287815","host":"s3://npm-registry-packages-npm-production"}},"0.1.12":{"name":"@arrisa/history","version":"0.1.12","license":"MIT","_id":"@arrisa/history@0.1.12","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"8493e0d917660714eaa77350e219ee973c9ec954","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-0.1.12.tgz","fileCount":25,"integrity":"sha512-Aa+3GToUw+39f82eWAr0rPSjUWstaJLKKvS74xQaVf2UDGys0pwyBTR3bauzKH4NXm0lIQOu/jY+RrqyvWcCQA==","signatures":[{"sig":"MEQCIHCIo5hN+ufvj8OVt3LAOvgSmBnK46e9eLFJCQBChwb6AiAeXbEtwXXjXb1SxFOflR2hkaYkhSq/TXKV8sAYQHVNqA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDnado1sfNgYKQMEFe4LalOFVNYMPlL8ObippKkyp6PKwIgcbAF3Dh0UXaseQiyl8NpKHoUqYSuzuRURyae8LCUZ2Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57748},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-0.1.12.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/fcf0443417f19b1a9c3f2991cfe7ab59/arrisa-history-0.1.12.tgz","_integrity":"sha512-Aa+3GToUw+39f82eWAr0rPSjUWstaJLKKvS74xQaVf2UDGys0pwyBTR3bauzKH4NXm0lIQOu/jY+RrqyvWcCQA==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"0.1.12","@arrisa/state":"0.1.12"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_0.1.12_1789806588213_0.33959019497638043","host":"s3://npm-registry-packages-npm-production"}},"1.0.14":{"name":"@arrisa/history","version":"1.0.14","license":"MIT","_id":"@arrisa/history@1.0.14","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"homepage":"https://github.com/inshinrei/arrisa#readme","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"6faa84c075aa1e2885a8ff4c37a14764039a6058","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-1.0.14.tgz","fileCount":25,"integrity":"sha512-n5xUvDPcNmHWmhp3tFHQCC1yjawtLT9oEP12g6tHi2Bk2giOFdx/wI4zopS3ZLkgpYB6xgI1zY/Z4aMC7w2csg==","signatures":[{"sig":"MEUCIQCiAJIZU87Iwcjh46NgL0VTsnR2zdvdy+pJDobRilQMjAIgF7+yWIR/Dhxy3Cg5g40/8V8O37TLdRPzQJflZzWODvs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDUlIxKgYSu6MUdAjd5Viu2nLbGFNpCkMNbWO+BFZX1fAIhAMtlLS/tl7C4YG4xEgG7I2aSX9mI4ABnP0iwUHZD+U1P","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57748},"main":"./dist/index.js","type":"module","_from":"file:arrisa-history-1.0.14.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/c19e1a3c4cdd985839457125a98f814d/arrisa-history-1.0.14.tgz","_integrity":"sha512-n5xUvDPcNmHWmhp3tFHQCC1yjawtLT9oEP12g6tHi2Bk2giOFdx/wI4zopS3ZLkgpYB6xgI1zY/Z4aMC7w2csg==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"1.0.14","@arrisa/state":"1.0.14"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/history_1.0.14_1790150811321_0.4430370875322016","host":"s3://npm-registry-packages-npm-production"}},"1.0.29":{"_id":"@arrisa/history@1.0.29","bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"dist":{"shasum":"daf98df1ee2471567a4ae7757bdb19d98293e64b","tarball":"https://registry.npmjs.org/@arrisa/history/-/history-1.0.29.tgz","fileCount":25,"integrity":"sha512-4j4wVz4qTkh3LFuGNho5JNUuX5GC9jgglpCvaGKkyPL/A4NITttuLiROJ6wIKqjPc1rI8ofvKTWnWpHhJh7NhQ==","signatures":[{"sig":"MEUCIQCrLKgAfac7eRAfAlercXQ5FzUD7cgNRbGTfKgRmTNBVwIgM6X2iP++p9IvTWiZdZL6AZrRGdh+j4ZIXMOqRwO6oJA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD1NR9eShc8PJFdBXwpP7oaSDpUxUUE9zCps9s40FgqFAIgIJM1QxzIcjnpJ7/Bdkccn1ctoC4hz6Yl0IVrulR6eTY="}],"unpackedSize":57748},"main":"./dist/index.js","name":"@arrisa/history","type":"module","_from":"file:arrisa-history-1.0.29.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"MIT","scripts":{"dev":"vite build --watch","test":"vitest run","build":"vite build","typecheck":"tsc -p tsconfig.json --noEmit"},"version":"1.0.29","_npmUser":{"name":"inshinrei","email":"tokkiumai@icloud.com"},"homepage":"https://github.com/inshinrei/arrisa#readme","_resolved":"/private/var/folders/dr/zy5hc7_n3p5ds1hk9tt_l84w0000gn/T/899778055e6ce7a677e5146fec1cafa6/arrisa-history-1.0.29.tgz","_integrity":"sha512-4j4wVz4qTkh3LFuGNho5JNUuX5GC9jgglpCvaGKkyPL/A4NITttuLiROJ6wIKqjPc1rI8ofvKTWnWpHhJh7NhQ==","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"_npmVersion":"10.9.8","description":"Arrisa — undo/redo history for editor state","directories":{},"maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"sideEffects":false,"_nodeVersion":"22.23.2","dependencies":{"@arrisa/doc":"1.0.29","@arrisa/state":"1.0.29"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/history_1.0.29_1790429263056_0.09518471716667642"}}},"time":{"created":"2026-09-05T18:58:38.323Z","modified":"2026-09-26T13:27:43.335Z","0.1.1":"2026-09-05T18:58:38.649Z","0.1.2":"2026-09-06T18:13:07.443Z","0.1.3":"2026-09-07T17:31:14.550Z","0.1.5":"2026-09-09T20:03:48.471Z","0.1.12":"2026-09-19T08:29:48.289Z","1.0.14":"2026-09-23T08:06:51.446Z","1.0.29":"2026-09-26T13:27:43.143Z"},"bugs":{"url":"https://github.com/inshinrei/arrisa/issues"},"license":"MIT","homepage":"https://github.com/inshinrei/arrisa#readme","repository":{"url":"git+https://github.com/inshinrei/arrisa.git","type":"git","directory":"packages/history"},"description":"Arrisa — undo/redo history for editor state","maintainers":[{"name":"inshinrei","email":"tokkiumai@icloud.com"}],"readme":"# @arrisa/history\n\nUndo/redo history for Arrisa editor state — grouped events, configurable depth, and pure undo/redo commands.\n\n## Install\n\n```bash\npnpm add @arrisa/history\n```\n\nDepends on `@arrisa/doc` and `@arrisa/state`. For keymaps/menus that use command identities from `@arrisa/command`, wire handlers as shown below.\n\n## Quick start\n\n```ts\nimport {history, undo, redo, undoDepth, redoDepth} from \"@arrisa/history\"\nimport {Command, undo as cmdUndo, redo as cmdRedo} from \"@arrisa/command\"\nimport {EditorState} from \"@arrisa/state\"\n\nlet state = EditorState.create({\n  doc,\n  config: [\n    // …schema extensions…\n    history({minDepth: 100, newGroupDelay: 500}),\n    // Optional: connect default keymap Mod-z / Mod-y\n    Command.handler(cmdUndo, (ed) => undo({state: ed.state})),\n    Command.handler(cmdRedo, (ed) => redo({state: ed.state})),\n  ],\n})\n\n// After edits…\nlet spec = undo({state})\nif (spec) state = state.update(spec).state\n\nundoDepth(state) // number of undo groups\nredoDepth(state) // number of redo groups\n```\n\nWith a live editor:\n\n```ts\nimport {Arrisa} from \"@arrisa/editor\"\nimport {history, undo, redo} from \"@arrisa/history\"\nimport {Command, undo as cmdUndo, redo as cmdRedo} from \"@arrisa/command\"\n\nlet editor = Arrisa.create({\n  parent,\n  doc: \"<p>Hello</p>\",\n  config: [\n    history(),\n    Command.handler(cmdUndo, (ed) => undo({state: ed.state})),\n    Command.handler(cmdRedo, (ed) => redo({state: ed.state})),\n  ],\n})\n```\n\n## Features / concepts\n\n### Recording\n\nDocument changes (and optional inverted effects) are stored as linked events on a done branch; undo moves them to an undone branch. Adjacent typing/deletes can **join** into one undo step when they occur within `newGroupDelay` and pass `joinToEvent`.\n\n### Pure commands\n\n`undo` / `redo` return `Transaction.Spec | false`. They never dispatch themselves — apply with `state.update` or `editor.dispatch`.\n\n### Opt-out and boundaries\n\n| Mechanism | Effect |\n|-----------|--------|\n| `Transaction.addToHistory.of(false)` | Edit without recording (still maps existing events) |\n| `history.isolate.of(\"before\" \\| \"after\" \\| \"full\")` | Force a group boundary relative to neighbors |\n| `EditorState.readOnly` | Commands return `false` (history may still record if other code applies changes) |\n\n### Custom effects\n\nRegister `history.invertedEffects` providers so non-document effects can be inverted and restored on undo/redo.\n\n### Serialization\n\nInclude `history.field` in the field map for `state.toJSON` / `EditorState.fromJSON` to preserve undo stacks:\n\n```ts\nlet fields = {hist: history.field as EditorState.Field<any>}\nlet json = state.toJSON(fields)\nlet restored = EditorState.fromJSON(json, [/* schema… */, history()], fields)\n```\n\n## Main public API\n\n### Extension\n\n| Export | Description |\n|--------|-------------|\n| `history(config?)` | Install history field + config facet |\n| `HistoryConfig` | `{minDepth?, newGroupDelay?, joinToEvent?}` |\n\n**Defaults:** `minDepth: 100`, `newGroupDelay: 500`, `joinToEvent: (_tr, isAdjacent) => isAdjacent`.\n\nCombined config uses max `minDepth`, min `newGroupDelay`, and OR of `joinToEvent` predicates.\n\n### Namespace `history`\n\n| Member | Description |\n|--------|-------------|\n| `history.field` | State field for JSON serialization |\n| `history.isolate` | Annotation: `\"before\"` \\| `\"after\"` \\| `\"full\"` |\n| `history.invertedEffects` | Facet: `(tr) => readonly Effect[]` to store inverted |\n| `history.EventJSON` / `history.JSON` | JSON shapes for events / full history |\n\n### Commands\n\n| Export | Description |\n|--------|-------------|\n| `undo` | Pop one group from the done branch |\n| `redo` | Pop one group from the undone branch |\n| `undoDepth(state)` | Count of undoable groups |\n| `redoDepth(state)` | Count of redoable groups |\n| `HistoryCommand` | Type: `(cx: {state}) => Transaction.Spec \\| false` |\n\n```ts\nimport {history, undo} from \"@arrisa/history\"\nimport {Transaction} from \"@arrisa/state\"\n\n// Force a boundary after a programmatic edit\neditor.dispatch({\n  changes: {from: 1, to: 1, insert: /* … */},\n  annotations: history.isolate.of(\"full\"),\n})\n\n// Edit without polluting undo\neditor.dispatch({\n  changes: remoteChanges,\n  annotations: Transaction.addToHistory.of(false),\n})\n```\n\n## Layering / related packages\n\n| Package | Role |\n|---------|------|\n| `@arrisa/doc` | Changes / document model |\n| `@arrisa/state` | Fields, transactions, `addToHistory` |\n| `@arrisa/command` | Stub `undo`/`redo` identities + menus; wire with `Command.handler` |\n| `@arrisa/editor` | View dispatch; default keymap binds Mod-z/y to command stubs |\n\n**Layer:** depends only on doc + state (layer 2). Does not depend on command or editor.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}