workspace/store#

Interfaces#

SettingsChange#

Defined in: workspace/store.ts:85

A change of the settings: any of their members, each given in part; the manifest files and the MatchClaim filters block by block, each block’s entry whole.

Properties#

blockDefaults?#

readonly optional blockDefaults?: Partial<BlockPlacement>

Defined in: workspace/store.ts:87

granularity?#

readonly optional granularity?: Partial<Granularity>

Defined in: workspace/store.ts:88

grid?#

readonly optional grid?: Partial<{ size: number; snap: boolean; }>

Defined in: workspace/store.ts:86

manifests?#

readonly optional manifests?: object

Defined in: workspace/store.ts:89

Index Signature#

[block: string]: ManifestFile

matchClaimFilters?#

readonly optional matchClaimFilters?: object

Defined in: workspace/store.ts:90

Index Signature#

[block: string]: MatchClaimFilter


Store#

Defined in: workspace/store.ts:111

The workspace store: the current view, the journal and the open editors’ sessions, changed only through its methods.

Properties#

canRedo#

readonly canRedo: boolean

Defined in: workspace/store.ts:131

canUndo#

readonly canUndo: boolean

Defined in: workspace/store.ts:130

changes#

readonly changes: number

Defined in: workspace/store.ts:127

How many changes Cancel would discard; 0 when no editor is open.

editing#

readonly editing: readonly OpenEditor[]

Defined in: workspace/store.ts:121

The editing path: the open editors, outermost first.

entries#

readonly entries: readonly Entry[]

Defined in: workspace/store.ts:123

The entries of the innermost open editor’s session holding an applied change; the journal when no editor is open.

journal#

readonly journal: readonly Entry[]

Defined in: workspace/store.ts:114

The main level’s entries holding an applied change: commands and closed sessions.

listed#

readonly listed: readonly ListedEntry[]

Defined in: workspace/store.ts:125

Every entry of that level in order, its undone ones included, each with its undo state.

openings#

readonly openings: number

Defined in: workspace/store.ts:129

How many editors open has opened since the store was created.

sessions#

readonly sessions: Sessions

Defined in: workspace/store.ts:119

The closed sessions, by id, their undone changes included until a new entry discards them; snapshot() is the replayable form.

view#

readonly view: View

Defined in: workspace/store.ts:112

Methods#

cancel()#

cancel(): void

Defined in: workspace/store.ts:176

Close the innermost editor, restoring the state at its opening.

Returns#

void

configure()#

configure(change): Problem | null

Defined in: workspace/store.ts:149

Change the settings: journals nothing, is never undone, and gives a new view; null when accepted, else the first problem of the settings it would leave (at ["settings", …]).

Parameters#
change#

SettingsChange

Returns#

Problem | null

dispatch()#

dispatch(command): Problem | null

Defined in: workspace/store.ts:136

Apply a command and journal it, with the IDs of every element it created as its ids; null when it was accepted.

Parameters#
command#

unknown

Returns#

Problem | null

done()#

done(): void

Defined in: workspace/store.ts:174

Close the innermost editor, keeping its changes.

Returns#

void

edit()#

edit(target, commands): Problem | null

Defined in: workspace/store.ts:166

Make commands, in order, in the editor of target (the one it opens, editorKindOf) as if it were opened, the commands dispatched in it and Done pressed: a new session holding their entries, journalled as one entry, so undo and redo take them as one step. Inside an open editor the editor of target must open there (else not_inside, as open); where the innermost open editor is that editor itself, the commands are its own entries, a step each, as every change made in an open editor. Atomic: a refused command (its own error) or an editor that does not open leaves the store as it was; no commands change nothing. null when every command was accepted.

Parameters#
target#

Address

commands#

readonly unknown[]

Returns#

Problem | null

minter()#

minter(): IdMinter

Defined in: workspace/store.ts:143

A copy of the store’s minter at its count (IdMinter.copy): it mints the IDs the next dispatch mints beyond those its command carries, and minting from it never advances the store’s. preview with it shows the IDs the dispatch of the same command stores.

Returns#

IdMinter

open()#

open(target, kind?): Problem | null

Defined in: workspace/store.ts:172

Open the editor of target inside the innermost open editor, of kind where given (the flow-control editor of a root timeline), else the one the target opens (editorKindOf); null when it opened.

Parameters#
target#

Address

kind?#

EditorKind

Returns#

Problem | null

redo()#

redo(): void

Defined in: workspace/store.ts:153

Re-apply the innermost level’s earliest undone step.

Returns#

void

setAuthor()#

setAuthor(name): void

Defined in: workspace/store.ts:179

Parameters#
name#

string

Returns#

void

snapshot()#

snapshot(): Workspace

Defined in: workspace/store.ts:178

The workspace as Save writes it, every open editor folded as Done would fold it.

Returns#

Workspace

subscribe()#

subscribe(listener): () => void

Defined in: workspace/store.ts:181

Call listener with the view after every change of it, of a level’s entries or undo state, or of editing; returns the unsubscriber.

Parameters#
listener#

(view) => void

Returns#

() => void

undo()#

undo(): void

Defined in: workspace/store.ts:151

Revert the innermost level’s latest applied step: one change of its own, or a closed session’s run.

Returns#

void


StoreOptions#

Defined in: workspace/store.ts:94

The options of createStore.

Properties#

author?#

readonly optional author?: string

Defined in: workspace/store.ts:96

Who dispatches, until setAuthor changes it; "Gerhardt" by default.

clock?#

readonly optional clock?: () => Date

Defined in: workspace/store.ts:98

The time of each entry; the system clock by default.

Returns#

Date

minter?#

readonly optional minter?: IdMinter

Defined in: workspace/store.ts:104

What mints the IDs of the elements a dispatched command creates beyond those it carries; a minter of 64 random bits by default. Tests give a seeded one.


Workspace#

Defined in: workspace/store.ts:74

A workspace: its view, the journal that produced it and the sessions its journal names.

Properties#

journal#

readonly journal: readonly Entry[]

Defined in: workspace/store.ts:76

sessions#

readonly sessions: Sessions

Defined in: workspace/store.ts:77

view#

readonly view: View

Defined in: workspace/store.ts:75

Variables#

DEFAULT_AUTHOR#

const DEFAULT_AUTHOR: "Gerhardt" = "Gerhardt"

Defined in: workspace/store.ts:185

Who dispatches when StoreOptions.author states nobody.

Functions#

createStore()#

createStore(workspace, options?): Store

Defined in: workspace/store.ts:368

A store holding workspace, its journal verified first: replaying it from the empty workspace must reproduce the workspace’s view, or JournalMismatchError is thrown.

Parameters#

workspace#

Workspace

options?#

StoreOptions = {}

Returns#

Store


replay()#

replay(journal, sessions): View[]

Defined in: workspace/store.ts:232

The view a journal produces from the empty workspace, and the view after each of its entries, a session’s being the view after all of its changes.

Parameters#

journal#

readonly Entry[]

sessions#

Sessions

Returns#

View[]