diskfile_history.svelte.ts

Declarations
#

5 declarations

view source

DiskfileHistory
#

diskfile_history.svelte.ts view source

Stores edit history for a single diskfile.

inheritance

extends:
  • Cell<typeof DiskfileHistoryJson>

path

type DiskfilePath

entries

type Array<HistoryEntry>

max_entries

type number

current_entry

The most recent history entry (by creation timestamp) Since entries are always kept sorted by creation time (newest first), the most recent is always the first element.

type HistoryEntry | null

readonly

constructor

type new (options: DiskfileHistoryOptions): DiskfileHistory

options

add_entry

Add a new history entry.

type (content: string, options?: { is_disk_change?: boolean | undefined; is_unsaved_edit?: boolean | undefined; is_original_state?: boolean | undefined; label?: string | undefined; created?: number | undefined; }): { ...; }

content
type string
options
type { is_disk_change?: boolean | undefined; is_unsaved_edit?: boolean | undefined; is_original_state?: boolean | undefined; label?: string | undefined; created?: number | undefined; }
default EMPTY_OBJECT
returns { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }

find_entry_by_id

Find a history entry by id.

type (id: string & $brand<"Uuid">): { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; } | undefined

id
type string & $brand<"Uuid">
returns { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; } | undefined

get_content

Get the content of a specific history entry.

type (id: string & $brand<"Uuid">): string | null

id
type string & $brand<"Uuid">
returns string | null

clear_except_current

Clear all history entries except the most recent one by creation time and any entries that match the optional keep predicate.

type (keep?: ((entry: { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }) => boolean) | undefined): void

keep?
type ((entry: { id: string & $brand<"Uuid">; created: number; content: string; label: string; is_disk_change: boolean; is_unsaved_edit: boolean; is_original_state: boolean; }) => boolean) | undefined
optional
returns void

DiskfileHistoryJson
#

diskfile_history.svelte.ts view source

ZodObject<{ id: ZodDefault<$ZodBranded<ZodUUID, "Uuid", "out">>; created: ZodDefault<$ZodBranded<ZodISODateTime, "Datetime", "out">>; updated: ZodDefault<...>; path: $ZodBranded<...>; entries: ZodDefault<...>; max_entries: ZodDefault<...>; }, $strict>

Schema for the DiskfileHistory cell.

DiskfileHistoryJsonInput
#

diskfile_history.svelte.ts view source

{ path: string; id?: string | undefined; created?: string | undefined; updated?: string | undefined; entries?: { created: number; content: string; label: string; id?: string | undefined; is_disk_change?: boolean | undefined; is_unsaved_edit?: boolean | undefined; is_original_state?: boolean | undefined; }[] | undefi...

DiskfileHistoryOptions
#

HistoryEntry
#

diskfile_history.svelte.ts view source

ZodObject<{ id: ZodDefault<$ZodBranded<ZodUUID, "Uuid", "out">>; created: ZodNumber; content: ZodString; label: ZodString; is_disk_change: ZodDefault<...>; is_unsaved_edit: ZodDefault<...>; is_original_state: ZodDefault<...>; }, $strict>

Schema for history entries.

Depends on
#

Imported by
#