@typescript-package/history
Version:
A lightweight TypeScript package for tracking the history of values.
1 lines • 42 kB
Source Map (JSON)
{"version":3,"file":"typescript-package-history.mjs","sources":["../../../package/history/src/lib/core/history-storage.abstract.ts","../../../package/history/src/lib/core/history-core.abstract.ts","../../../package/history/src/lib/core/history-append.abstract.ts","../../../package/history/src/lib/core/history-current.class.ts","../../../package/history/src/lib/core/history-prepend.abstract.ts","../../../package/history/src/lib/base/current-history.class.ts","../../../package/history/src/lib/base/redo-history.class.ts","../../../package/history/src/lib/base/undo-history.class.ts","../../../package/history/src/lib/base/history-base.abstract.ts","../../../package/history/src/lib/history.class.ts","../../../package/history/src/public-api.ts","../../../package/history/src/typescript-package-history.ts"],"sourcesContent":["import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description The history storage of specified data.\n * @export\n * @abstract\n * @class HistoryStorage\n * @template Value \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {DataCore<Value[]>}\n */\nexport abstract class HistoryStorage<\n Value,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> {\n /**\n * @description Returns the `string` tag representation of the `HistoryStorage` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public get [Symbol.toStringTag](): string {\n return HistoryStorage.name;\n }\n\n /**\n * @description\n * @public\n * @readonly\n * @type {DataType}\n */\n public get data(): DataType {\n return this.#data;\n }\n\n /**\n * @description The length of the history.\n * @public\n * @readonly\n * @type {number}\n */\n public get length(): number {\n return this.#data.value.length;\n }\n\n /**\n * @description The data type to store the value.\n * @type {DataType}\n */\n #data: DataType;\n\n /**\n * Creates an instance of `HistoryStorage` child class.\n * @constructor\n * @param {Value[]} value \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n value: Value[],\n data?: DataConstructor<Value, DataType>\n ) {\n this.#data = data ? new data(value) : new (Data as unknown as DataConstructor<Value, DataType>)(value);\n }\n\n /**\n * @description Destroys the storage data by setting it to `null`.\n * @public\n * @returns {this} Returns the current instance.\n */\n public destroy(): this {\n this.#data.destroy();\n return this;\n }\n\n /**\n * @description Gets the readonly history.\n * @public\n * @returns {Readonly<Value[]>} \n */\n public get(): Readonly<Value[]> {\n return this.#data.value;\n }\n\n /**\n * @description Checks whether the storage is empty.\n * @public\n * @returns {boolean} \n */\n public isEmpty(): boolean {\n return this.#data.value.length === 0;\n }\n\n /**\n * @description Sets the data value.\n * @protected\n * @param {Value[]} value The data of `Type[]` to set.\n * @returns {this} Returns `this` current instance.\n */\n protected set(value: Value[]) {\n this.#data.set(value);\n return this;\n }\n}\n","import {\n// Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryStorage } from './history-storage.abstract';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description The core class for history append and prepend.\n * @export\n * @abstract\n * @class HistoryCore\n * @template Value \n * @template {number} [Size=number] \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryStorage<Value, DataType>}\n */\nexport abstract class HistoryCore<\n Value,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryStorage<Value, DataType> {\n /**\n * @description Returns the `string` tag representation of the `HistoryCore` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return HistoryCore.name;\n }\n\n /**\n * @description Gets the history.\n * @protected\n * @readonly\n * @type {Value[]}\n */\n protected get history(): Value[] {\n return super.data.value;\n }\n\n /**\n * @description The maximum size of the history.\n * @public\n * @readonly\n * @type {Size}\n */\n public get size(): Size {\n return this.#size;\n }\n\n /**\n * @description The maximum size of the history.\n * @type {number}\n */\n #size\n\n /**\n * Creates an instance of `HistoryCore` child class.\n * @constructor\n * @param {Size} size \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n size: Size,\n data?: DataConstructor<Value, DataType>\n ) {\n super([], data);\n this.#size = size;\n }\n\n /**\n * @description Adds the value to the history.\n * @public\n * @param {Value} value The value to store.\n * @returns {this} The current instance.\n */\n public abstract add(value: Value): this;\n\n /**\n * @description Returns the value at the specified index in the history.\n * @public\n * @param {number} index The position in the history (0-based index).\n * @returns {Value | undefined} The value at the specified position.\n */\n public at(index: number): Value | undefined {\n return this.history[index];\n }\n\n /**\n * @description Clears the history.\n * @public\n * @returns {this} The current instance.\n */\n public clear(): this {\n const history = this.history;\n history.length = 0;\n return this;\n }\n\n /**\n * @description Returns the first value without modifying history.\n * @public\n * @abstract\n * @returns {(Value | undefined)} \n */\n public first(): Value | undefined {\n return this.history[0];\n }\n\n /**\n * @description Returns the last value without modifying history.\n * @public\n * @abstract\n * @returns {(Value | undefined)} \n */\n public last(): Value | undefined {\n return this.history.at(-1);\n }\n\n /**\n * @description Returns the next value without modifying history.\n * @public\n * @abstract\n * @returns {(Value | undefined)} \n */\n public abstract next(): Value | undefined;\n\n /**\n * @description Sets the size for history.\n * @public\n * @param {Size} size \n * @returns {this} The `this` current instance.\n */\n public setSize(size: Size): this {\n this.#size = size;\n return this;\n }\n\n /**\n * @description Takes the first value.\n * @public\n * @abstract\n * @returns {(Value | undefined)} \n */\n public abstract take(): Value | undefined;\n\n /**\n * @description The method to trim the history.\n * @protected\n * @param {('pop' | 'shift')} method The method `pop` or `shift` to trim the history.\n * @returns {this} \n */\n protected trim(method: 'pop' | 'shift'): this {\n if (this.#size > 0) {\n while (this.history.length > this.size) {\n method === 'pop' ? this.history.pop() : method === 'shift' && this.history.shift();\n } \n }\n return this;\n }\n}\n","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryCore } from './history-core.abstract';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description Class extends the `HistoryCore` class to maintain a history of values in a append manner.\n * This means that new entries are added to the end of the history, and as the history exceeds its size limit, entries from the beginning are removed.\n * LIFO(Last in, First out): The last value that was added (the most recent one) will be the first one to be removed.\n * Add: Add to the end of the array (push).\n * Take: Remove from the end of the array (pop), which is the most recent item.\n * PeekFirst: Look at the first item in the history (oldest).\n * PeekLast: Look at the last item in the history (newest).\n * @export\n * @abstract\n * @class HistoryAppend\n * @template Value \n * @template {number} [Size=number] \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryCore<Value, Size, DataType>}\n */\nexport abstract class HistoryAppend<\n Value,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryCore<Value, Size, DataType> {\n /**\n * @description The default value of maximum history size.\n * @public\n * @static\n * @type {number}\n */\n public static size = 10;\n\n /**\n * @description Returns the `string` tag representation of the `HistoryAppend` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return HistoryAppend.name;\n }\n\n /**\n * Creates an instance of `HistoryAppend` child class.\n * @constructor\n * @param {Size} [size=HistoryAppend.size as Size] \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n size: Size = HistoryAppend.size as Size,\n data?: DataConstructor<Value, DataType>\n ) {\n super(size, data);\n }\n\n /**\n * @description Adds the value to the history.\n * - FIFO unshift/queue style\n * @public\n * @param {Value} value The value to store.\n * @returns {this} The current instance.\n */\n public add(value: Value): this {\n if (super.size > 0) {\n super.history.push(value);\n super.trim('shift');\n }\n return this;\n }\n\n /**\n * @description Returns the most recent (last index added) value in the history without modifying it. \n * @public\n * @returns {(Value | undefined)} \n */\n public newest(): Value | undefined {\n return this.last();\n }\n\n /**\n * @description Returns the next value that would be removed (the most recent one) without modifying history.\n * - LIFO behavior\n * @public\n * @returns {(Value | undefined)} The next value in the append manner.\n */\n public next(): Value | undefined {\n return super.last();\n }\n\n /**\n * @description Returns the first(index 0 the oldest) value in the history without modifying it.\n * @public\n * @returns {(Value | undefined)} \n */\n public oldest(): Value | undefined {\n return super.first();\n }\n\n /**\n * @description Removes and returns the last value in the history.\n * - LIFO behavior\n * @public\n * @returns {(Value | undefined)} \n */\n public take(): Value | undefined {\n return super.history.pop();\n }\n}\n","// Data.\nimport { Data, DataCore } from '@typescript-package/data';\n// Abstract.\nimport { HistoryStorage } from '.';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description The class represents the current value of the history.\n * The class is used to:\n * - store the current value of the history,\n * - check whether the current value is set,\n * - update the current value of the history,\n * - clear the current value of the history,\n * - get the current value of the history.\n * @export\n * @abstract\n * @class HistoryCurrent\n * @template Value \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryStorage<Value, DataType>}\n */\nexport abstract class HistoryCurrent<\n Value,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryStorage<Value, DataType> {\n /**\n * @description Returns the `string` tag representation of the `HistoryCurrent` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return HistoryCurrent.name;\n }\n\n /**\n * @description\n * @public\n * @abstract\n * @readonly\n * @type {Value}\n */\n public abstract get value(): Value;\n\n /**\n * Creates an instance of `HistoryCurrent` child class.\n * @constructor\n * @param {{value?: Value}} [param0={}] \n * @param {Value} param0.value \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n {value}: {value?: Value} = {},\n data?: DataConstructor<Value, DataType>\n ) {\n super(Object.hasOwn(arguments[0] || {}, 'value') ? [value] as [Value] : [], data);\n }\n\n /**\n * @description Clears the `current` history.\n * @public\n * @returns {this} The current instance.\n */\n public clear(): this {\n super.set([]);\n return this;\n }\n\n /**\n * @description Checks whether the current value is set.\n * @public\n * @abstract\n * @returns {boolean} \n */\n public abstract has(): boolean;\n\n /**\n * @description Updates a current value.\n * @public\n * @abstract\n * @param {Value} value \n * @returns {this} \n */\n public abstract update(value: Value): this;\n}\n","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryCore } from './history-core.abstract';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description Class extends the `HistoryCore` class to maintain a history of values in a prepend manner.\n * This means that new entries are added to the beginning of the history, and older entries are shifted out as the history size exceeds its limit.\n * LIFO(Last in, First out): The last value that was added (the most recent one) will be the first one to be removed.\n * Add: Add to the beginning of the array (unshift).\n * Take: Remove from the beginning of the array (shift), which is the most recent item.\n * PeekFirst: Look at the first item in the history (newest).\n * PeekLast: Look at the last item in the history (oldest).\n * @export\n * @abstract\n * @class HistoryPrepend\n * @template Value \n * @template {number} [Size=number] \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryCore<Value, Size, DataType>}\n */\nexport abstract class HistoryPrepend<\n Value,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryCore<Value, Size, DataType> {\n /**\n * @description The default value of maximum history size.\n * @public\n * @static\n * @type {number}\n */\n public static size = 10;\n\n /**\n * @description Returns the `string` tag representation of the `HistoryPrepend` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return HistoryPrepend.name;\n }\n\n /**\n * Creates an instance of `HistoryPrepend` child class.\n * @constructor\n * @param {Size} [size=HistoryPrepend.size as Size] \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n size: Size = HistoryPrepend.size as Size,\n data?: DataConstructor<Value, DataType>\n ) {\n super(size, data);\n }\n\n /**\n * @description Adds the value to the history in a backward manner.\n * @public\n * @param {Value} value The value to store.\n * @returns {this} The current instance.\n */\n public add(value: Value): this {\n if (super.size > 0) {\n super.history.unshift(value);\n super.trim('pop');\n }\n return this;\n }\n\n /**\n * @description Returns the next(index 0) value in the history, the newest value without modifying history.\n * @public\n * @returns {Value | undefined} The next redo value.\n */\n public next(): Value | undefined {\n return this.first();\n }\n\n /**\n * @description Returns the most recent(first index 0) value in the history without modifying it. \n * @public\n * @returns {(Value | undefined)} \n */\n public newest(): Value | undefined {\n return this.first();\n }\n\n /**\n * @description Returns the last value in the history, the oldest value without modifying history.\n * @public\n * @returns {Value | undefined} The next redo value.\n */\n public oldest(): Value | undefined {\n return this.last();\n }\n\n /**\n * @description Removes and returns the first value in the history.\n * @public\n * @returns {(Value | undefined)} \n */\n public take(): Value | undefined {\n return super.history.shift();\n }\n}\n","// Data.\nimport { Data, DataCore } from '@typescript-package/data';\n// Abstract.\nimport { HistoryCurrent } from '../core';\n// Type.\nimport { DataConstructor } from '../type';\n/**\n * @description \n * @export\n * @class CurrentHistory\n * @template Value \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryStorage<Value, DataType>}\n */\nexport class CurrentHistory<\n Value,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryCurrent<Value, DataType> {\n /**\n * @description Returns the `string` tag representation of the `CurrentHistory` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return CurrentHistory.name;\n }\n\n /**\n * @description\n * @public\n * @readonly\n * @type {Value}\n */\n public get value(): Value {\n return Array.isArray(super.data.value) ? super.data.value[0] : undefined as Value;\n }\n\n /**\n * Creates an instance of `CurrentHistory`.\n * @constructor\n * @param {{value?: Value}} [param0={}] \n * @param {Value} param0.value \n * @param {?DataConstructor<Value, DataType>} [data] \n */\n constructor(\n {value}: {value?: Value} = {},\n data?: DataConstructor<Value, DataType>\n ) {\n super(arguments[0], data);\n }\n\n /**\n * @description Destroys the history of this instance.\n * @public\n * @returns {this} The current instance.\n */\n public override destroy(): this {\n super.clear();\n super.destroy();\n return this;\n }\n\n /**\n * @description Checks whether the current value is set.\n * @public\n * @returns {boolean} \n */\n public has() {\n return Array.isArray(super.data.value) && super.data.value.length > 0;\n }\n\n /**\n * @description Updates a current value.\n * @public\n * @param {Value} value \n * @returns {this} \n */\n public update(value: Value): this {\n super.set([value]);\n return this;\n }\n}\n","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryPrepend } from '../core';\n/**\n * @description Manages the redo history with prepend mechanism.\n * @export\n * @class RedoHistory\n * @template [Value=any] The type of elements stored in the history\n * @template {number} [Size=number] The maximum size of the history.\n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryPrepend<Value, Size, DataType>}\n */\nexport class RedoHistory<\n Value = any,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryPrepend<Value, Size, DataType>{};\n","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryAppend } from '../core';\n/**\n * @description Manages the undo history with append mechanism.\n * @export\n * @class UndoHistory\n * @template [Value=any] The type of elements stored in the history.\n * @template {number} [Size=number] The maximum size of the history.\n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n * @extends {HistoryAppend<Value, Size, DataType>}\n */\nexport class UndoHistory<\n Value = any,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryAppend<Value, Size, DataType>{};","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Class.\nimport { CurrentHistory, RedoHistory, UndoHistory } from '.';\n// Type.\nimport { HistoryCurrentConstructor, DataConstructor, HistoryCoreConstructor } from '../type';\n/**\n * @description The base abstract class to manage history.\n * @export\n * @abstract\n * @class HistoryBase\n * @template Value \n * @template {number} [Size=number] \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n */\nexport abstract class HistoryBase<\n Value,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> {\n /**\n * @description The max size for undo history.\n * @public\n * @static\n * @type {number}\n */\n public static size = Infinity;\n\n /**\n * @description Returns the `string` tag representation of the `HistoryBase` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public get [Symbol.toStringTag](): string {\n return HistoryBase.name;\n }\n\n /**\n * @description Gets the current value stored in history.\n * @public\n * @readonly\n * @type {Value}\n */\n public get current(): Value {\n return this.#current.value;\n }\n\n /**\n * @description Returns the current history of `CurrentHistory`.\n * @public\n * @readonly\n * @type {CurrentHistory<Value, DataType>}\n */\n public get currentHistory() {\n return this.#current;\n }\n\n /**\n * @description\n * @public\n * @readonly\n * @type {{\n * current: DataType,\n * redo: DataType,\n * undo: DataType\n * }}\n */\n public get data() : {\n current: DataType,\n redo: DataType,\n undo: DataType\n } {\n return {\n current: this.#current.data,\n redo: this.#redo.data,\n undo: this.#undo.data,\n }\n }\n\n /**\n * @description Returns the redo history.\n * @public\n * @readonly \n * @type {HistoryCore<Value, Size, DataType>}\n */\n public get redoHistory() {\n return this.#redo;\n }\n \n /**\n * @description Returns the undo history.\n * @public\n * @readonly\n * @type {HistoryCore<Value, Size, DataType>}\n */\n public get undoHistory() {\n return this.#undo;\n }\n\n /**\n * @description A private field to store the current value.\n * @type {CurrentHistory<Value, DataType>}\n */\n #current: CurrentHistory<Value, DataType>;\n\n /**\n * @description Privately stored callback function invoked on redo.\n * @type {(value: Value) => void}\n */\n #onRedoCallback?: (value: Value) => void;\n\n /**\n * @description Privately stored callback function invoked on undo.\n * @type {(value: Value) => void}\n */\n #onUndoCallback?: (value: Value) => void;\n\n /**\n * @description The class to manage the redo history.\n * @type {RedoHistory}\n */\n #redo;\n\n /**\n * @description The class to manage the undo history.\n * @type {UndoHistory}\n */\n #undo\n\n /**\n * Creates an instance of `HistoryBase` child class.\n * @constructor\n * @param {{ value?: Value, size?: Size}} [param0={}] \n * @param {Value} param0.value \n * @param {Size} param0.size \n * @param {?DataConstructor<Value, DataType>} [data] \n * @param {{\n * current?: HistoryCurrentConstructor<Value, DataType>,\n * redo?: HistoryCoreConstructor<Value, Size, DataType>,\n * undo?: HistoryCoreConstructor<Value, Size, DataType>,\n * }} [param1={}] \n * @param {HistoryCurrentConstructor<Value, DataType>} param1.current \n * @param {HistoryCoreConstructor<Value, Size, DataType>} param1.redo \n * @param {HistoryCoreConstructor<Value, Size, DataType>} param1.undo \n */\n constructor(\n {value, size}: { value?: Value, size?: Size} = {},\n data?: DataConstructor<Value, DataType>,\n {current, redo, undo}: {\n current?: HistoryCurrentConstructor<Value, DataType>,\n redo?: HistoryCoreConstructor<Value, Size, DataType>,\n undo?: HistoryCoreConstructor<Value, Size, DataType>,\n } = {},\n ) {\n this.#current = new (current || CurrentHistory)(arguments[0], data);\n this.#redo = new (redo || RedoHistory)(size || Infinity as Size, data);\n this.#undo = new (undo || UndoHistory)(size, data);\n }\n\n /**\n * @description Clears the `current`, `undo` and `redo` history.\n * @public\n * @returns {this} The current instance.\n */\n public clear(): this {\n this.#current.clear();\n this.#redo.clear();\n this.#undo.clear();\n return this;\n }\n\n /**\n * @description Destroys the history of this instance.\n * @public\n * @returns {this} The current instance.\n */\n public destroy(): this {\n this.clear();\n this.#current.destroy();\n this.#redo.destroy();\n this.#undo.destroy();\n return this;\n }\n\n //#region get\n /**\n * @description Gets the current, undo and redo history.\n * @public\n * @returns {{ current: Readonly<Value>, undo: Readonly<Value[]>; redo: Readonly<Value[]> }} \n */\n public get(): { current: Readonly<Value>, undo: Readonly<Value[]>; redo: Readonly<Value[]> } {\n return {\n current: this.#current.value,\n undo: this.#undo.get(),\n redo: this.#redo.get(),\n };\n }\n \n /**\n * @description The instance method returns read-only redo history.\n * @public\n * @template Type\n * @returns {(Readonly<Value[]> | undefined)} \n */\n public getRedo(): Readonly<Value[]> | undefined {\n return this.#redo.get();\n }\n\n /**\n * @description The instance method returns read-only undo history.\n * @public\n * @template Type \n * @returns {(Readonly<Value[]> | undefined)} \n */\n public getUndo(): Readonly<Value[]> | undefined {\n return this.#undo.get();\n }\n //#endregion\n\n /**\n * @description Checks whether the current value is set.\n * @public\n * @returns {boolean} \n */\n public hasCurrent() {\n return this.#current.has();\n }\n\n /**\n * @description Checks whether the history is enabled by checking undo size.\n * @public\n * @returns {boolean} \n */\n public isEnabled(): boolean {\n return this.#undo.size > 0 === true;\n }\n\n //#region on\n /**\n * @description Sets the callback function invoked on redo.\n * @public\n * @param {(value: Value) => void} callbackFn The callback function to invoke.\n * @returns {this} \n */\n public onRedo(callbackFn: (value: Value) => void): this {\n this.#onRedoCallback = callbackFn;\n return this;\n }\n\n /**\n * @description Sets the callback function invoked on undo.\n * @public\n * @param {(value: Value) => void} callbackFn The callback function to invoke.\n * @returns {this} \n */\n public onUndo(callbackFn: (value: Value) => void): this {\n this.#onUndoCallback = callbackFn;\n return this;\n }\n //#endregion\n\n /**\n * @description Returns the specified by index value from redo history.\n * @public\n * @param {number} [index=0] \n * @returns {(Value | undefined)} \n */\n public redoAt(index: number = 0): Value | undefined {\n return this.#redo.at(index);\n }\n\n /**\n * @description Returns the specified by index value from undo history.\n * @public\n * @param {number} [index=this.#undo.length - 1] \n * @returns {(Value | undefined)} \n */\n public undoAt(index: number = this.#undo.length - 1): Value | undefined {\n return this.#undo.at(index);\n }\n\n //#region first\n /**\n * @description Returns the first value that would be redone without modifying history.\n * @public\n * @returns {Value | undefined} The first redo value.\n */\n public firstRedo(): Value | undefined {\n return this.#redo.first();\n }\n\n /**\n * @description Returns the first value that would be undone without modifying history.\n * @public\n * @returns {Value | undefined} The first undo value.\n */\n public firstUndo(): Value | undefined {\n return this.#undo.first();\n }\n //#endregion\n\n //#region last\n /**\n * @description Returns the last value that would be redone without modifying history.\n * @public\n * @returns {Value | undefined} The last redo value.\n */\n public lastRedo(): Value | undefined {\n return this.#redo.last();\n }\n\n /**\n * @description Returns the last value that would be undone without modifying history.\n * @public\n * @returns {Value | undefined} The last undo value.\n */\n public lastUndo(): Value | undefined {\n return this.#undo.last();\n }\n //#endregion\n\n //#region next\n /**\n * @description Returns the next value that would be redone without modifying history.\n * @public\n * @returns {Value | undefined} The next redo value.\n */\n public nextRedo(): Value | undefined {\n return this.#redo.next();\n }\n\n /**\n * @description Returns the next value that would be undone without modifying history.\n * @public\n * @returns {Value | undefined} The next undo value.\n */\n public nextUndo(): Value | undefined {\n return this.#undo.next();\n }\n //#endregion\n\n /**\n * @description Pick the current, redo or undo history.\n * @public\n * @param {('current' | 'redo' | 'undo')} type \n * @returns {Readonly<Value[]>} \n */\n public pick(type: 'current' | 'redo' | 'undo'): Readonly<Value[]> {\n switch(type) {\n case 'current':\n return this.#current.get();\n case 'redo':\n return this.#redo.get();\n case 'undo':\n return this.#undo.get();\n default:\n throw new Error(`Invalid type: ${type}. Expected 'current', 'redo', or 'undo'.`);\n }\n }\n\n /**\n * @description Redoes the last undone action.\n * @public\n * @returns {this} The current instance.\n */\n public redo(): this {\n const redo = this.#redo;\n if (redo.get()?.length) {\n const value = redo.take();\n this.#undo.add(this.#current.value);\n this.#current.update(value as Value);\n this.#onRedoCallback?.(value as Value);\n }\n return this;\n }\n\n /**\n * @description Sets a new value and updates the undo history.\n * @public\n * @param {Value} value \n * @returns {this} The current instance.\n */\n public set(value: Value): this {\n this.#current.has() && this.#undo.add(this.#current.value);\n this.#current.update(value);\n this.#redo.clear();\n return this;\n }\n\n /**\n * @description Sets the size of undo history.\n * @public\n * @param {Size} size The maximum size for undo history.\n */\n public setSize(size: Size): this {\n this.#undo.setSize(size);\n return this;\n }\n\n /**\n * @description Undoes the last action and moves it to redo history.\n * @public\n * @returns {this} The current instance.\n */\n public undo(): this {\n const undo = this.#undo;\n if (undo.get()?.length) {\n const value = undo.take();\n this.#redo.add(this.#current.value);\n this.#current.update(value as Value);\n this.#onUndoCallback?.(value as Value);\n }\n return this;\n }\n}\n","import {\n // Class.\n Data,\n // Abstract.\n DataCore\n} from '@typescript-package/data';\n// Abstract.\nimport { HistoryBase } from './base/history-base.abstract';\n/**\n * @description The class to manage the value changes.\n * @export\n * @class History\n * @template Value \n * @template {number} [Size=number] \n * @template {DataCore<Value[]>} [DataType=Data<Value[]>] \n */\nexport class History<\n Value,\n Size extends number = number,\n DataType extends DataCore<Value[]> = Data<Value[]>\n> extends HistoryBase<Value, Size, DataType> {\n /**\n * @description The max size for undo history.\n * @public\n * @static\n * @type {number}\n */\n public static override size = Infinity;\n\n /**\n * @description Returns the `string` tag representation of the `History` class when used in `Object.prototype.toString.call(instance)`.\n * @public\n * @readonly\n * @type {string}\n */\n public override get [Symbol.toStringTag](): string {\n return History.name;\n }\n}\n","/*\n * Public API Surface of history\n */\nexport {\n History,\n\n // Base.\n HistoryBase,\n\n // Core (Abstract).\n HistoryAppend,\n HistoryCore,\n HistoryCurrent,\n HistoryPrepend,\n HistoryStorage \n} from './lib';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAQA;;;;;;;;AAQG;MACmB,cAAc,CAAA;AAIlC;;;;;AAKG;AACH,IAAA,KAAY,MAAM,CAAC,WAAW,CAAC,GAAA;QAC7B,OAAO,cAAc,CAAC,IAAI;;AAG5B;;;;;AAKG;AACH,IAAA,IAAW,IAAI,GAAA;QACb,OAAO,IAAI,CAAC,KAAK;;AAGnB;;;;;AAKG;AACH,IAAA,IAAW,MAAM,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM;;AAGhC;;;AAGG;AACH,IAAA,KAAK;AAEL;;;;;AAKG;IACH,WACE,CAAA,KAAc,EACd,IAAuC,EAAA;QAEvC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAK,IAAoD,CAAC,KAAK,CAAC;;AAGxG;;;;AAIG;IACI,OAAO,GAAA;AACZ,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;AACpB,QAAA,OAAO,IAAI;;AAGb;;;;AAIG;IACI,GAAG,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK;;AAGzB;;;;AAIG;IACI,OAAO,GAAA;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;;AAGtC;;;;;AAKG;AACO,IAAA,GAAG,CAAC,KAAc,EAAA;AAC1B,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;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