Angular Undo Redo 履歴ストア | ng-hub-ui-history
Signals に優しい API、トランザクション、上限、リアクティブフォーム対応を備えた Angular の undo redo 履歴ストア。
最終更新 2026/09/06
概要
チームがこのライブラリを探す理由
外部の本格的な状態管理ライブラリを導入せずに、複雑な状態に対して undo と redo が必要なとき、この Angular 履歴ストアを使ってください。
インストール
npm install ng-hub-ui-historyジャンプ
最適な用途
- エディター
- フォームビルダー
- ローコードツール
- 設定 UI
について history
ng-hub-ui-history は、ユーザーが安全に戻れることを期待する Angular のエディター、フォームビルダー、設定画面で特に役立ちます。重厚なアーキテクチャ選択を強いることなく、状態を持つワークフローに undo と redo のパターンをもたらします。
機能ガイド
手動コミットとタイムトラベル
状態の変更を追跡し、線形の履歴を前後に移動します。
サンプル:
基本的な履歴
単一の追跡対象オブジェクトに対する手動コミット、undo、redo。
{
"title": "Getting Started with History",
"description": "Edit and commit to create undo/redo entries."
}ネストされたオブジェクトと配列
深いオブジェクトグラフやリストの変更には、パッチベースの追跡を使用します。
サンプル:
ネストされたオブジェクトの履歴
ネストされたプロパティとリストの更新をパッチとして記録します。
{
"id": "invoice-1",
"customer": {
"name": "Acme Corp",
"city": "Madrid"
},
"lines": [
{
"name": "Support plan",
"quantity": 1,
"unitPrice": 150
}
]
}自動フォーム追跡
組み込みのウォッチヘルパーで、フォーム値の変更を自動コミットします。
サンプル:
リアクティブフォームの監視
watchForm() が FormGroup の値の変更を自動でコミットします。
{
"name": "Maria",
"email": "maria@demo.local",
"role": "Editor"
}トランザクションと保持
複数の操作を1つのエントリにまとめ、設定された制限に従って古いエントリを削除します。
サンプル:
トランザクション + 制限
トランザクションでまとめられたコミットを、エントリ数とバイト数の制限のもとで扱います。
Pointer: -1 / Entries: 0 / Bytes: 0
{
"id": "transaction-editor",
"title": "Release notes draft",
"content": "Initial draft content.",
"tags": [
"draft"
]
}主な機能
最近の変更
Version 22.0.4 - 9/6/26, 12:00 AM
fixed: The published manifest no longer declares a main entry. It pointed at src/public-api.ts, the ng-packagr entry file, which never travels inside the tarball, so any resolver that ignores the exports map (older bundlers, legacy Jest resolution, plain require) followed it straight to a file that is not there. Dropping the field leaves exports, module and typings as the only entry points, the shape ng-packagr emits for every other library in the monorepo.
fixed: A commit that only moves a Date (or a Set, Map or RegExp) is recorded again. The default diff walked every object key by key, and those types keep their payload outside their own enumerable keys, so the comparison found nothing and produced an empty patch. An empty patch reads as no change: commit() returned false, the tracked state kept the old value that getState() and states() then handed back, and on a mixed commit undo() restored the other fields while leaving the new date in place, all without an error. Those values are now compared and replaced as a whole, which is what structuredClone already round-trips; an instance rebuilt with the same content still records no entry.
Version 22.0.3 - 9/1/26, 12:00 AM
changed: The homepage in the manifest points at this library's own documentation page rather than at the site root. It is the link a registry shows beside the package and the one a reader clicks from it, and landing on a front page they then have to search is a worse answer than landing on the reference for the package they were already looking at. Metadata only — no code, no types, no styles change, and nothing a consumer imports is affected.
Version 22.0.2 - 8/8/26, 12:00 AM
fixed: Documentation links now point at the canonical localized URLs. The README linked to https://hubui.dev/<path> with no locale prefix and no trailing slash, and both forms are 301-redirected, so every reader arriving from npm or GitHub landed on a redirect instead of the canonical page.
Version 22.0.1 - 7/28/26, 12:00 AM
added: Test suite for the diff/patch/clone utilities and multi-object undo/redo: cloneDeep isolation (nested structures, Dates), createDefaultDiff/applyDefaultPatch round-trips across representative shapes (nested objects, array insert/remove/reorder, key deletion, null transitions, deep nesting), estimateBytes sanity, and store-level coverage for independent per-object timelines, no-op transactions and redo invalidation after transactional commits. No runtime changes.
Version 22.0.0 - 6/17/26, 12:00 AM
changed: Aligned with Angular 22.
changed: README documentation standardized.
Version 0.1.0 - 6/17/26, 12:00 AM
added: Initial release with multi-object linear history.
added: Undo/redo, transactions, and maxEntries/maxBytes retention limits.
added: Reactive Forms auto-commit integration via watchForm().