From cc5c8bd07512b2d5e5f42833b16afe038ba08744 Mon Sep 17 00:00:00 2001 From: Carl Olsen Date: Sat, 7 Feb 2026 13:30:18 -0500 Subject: [PATCH 1/2] added History type --- packages/core/src/core.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/core/src/core.ts b/packages/core/src/core.ts index 1d944fd..671d113 100644 --- a/packages/core/src/core.ts +++ b/packages/core/src/core.ts @@ -1,5 +1,7 @@ import type { Command, HistoryOptions } from '@core/types' +export type History = ReturnType + /** * Creates a history manager for undo/redo functionality. * @@ -40,11 +42,15 @@ export function createHistory({ size = 30, coalesce = true }: HistoryOptions) { /** * Whether there are commands available to undo. */ - get canUndo() { return undoStack.length > 0 }, + get canUndo() { + return undoStack.length > 0 + }, /** * Whether there are commands available to redo. */ - get canRedo() { return redoStack.length > 0 }, + get canRedo() { + return redoStack.length > 0 + }, /** * Executes a command and adds it to the history. * Clears the redo stack. @@ -84,8 +90,7 @@ export function createHistory({ size = 30, coalesce = true }: HistoryOptions) { undoFn() redoStack.push({ key: cmd.key, do: redoFn, undo: undoFn }) - } - else { + } else { cmd.undo() redoStack.push(cmd) } From d64a2a10e4f24e7da902561bd949efa4a80b40b7 Mon Sep 17 00:00:00 2001 From: Carl Olsen Date: Sat, 7 Feb 2026 13:48:43 -0500 Subject: [PATCH 2/2] added History type --- packages/core/src/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 3340c29..41524ac 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,3 +1,5 @@ +export type { History } from '@core/core' + /** * Represents a command that can be executed, undone, and redone. */