noggin

NogginStore

Extends Noggin with the atomic apply(ops) primitive that verbs use to compose state changes. Provider implementations satisfy this; RemoteNoggin does not — verb code needs apply against locally-known state, which the wire protocol doesn't model.

The provider-side contract: a Noggin plus the atomic apply(ops) primitive that verbs use to compose state changes, and the throwing-on-miss resolvePath companion to Noggin.tryResolvePath.

In-process providers (memory, file) implement this. RemoteNoggin does not — apply requires locally-constructed ops against current state, which the wire protocol doesn't model.

The verbs.*(noggin, opts) namespace consumes NogginStore. UI code and gestures take a plain Noggin and call the bound verb methods on it instead.

Extends

Extended by

Properties

PropertyModifierTypeDescriptionInherited from
activereadonlyItem-Noggin.active
itemsreadonlyreadonly Item[]-Noggin.items
locationreadonlystringCanonical URL the provider opened. Mirrors the location the caller passed to openNoggin (e.g. file:///work/today.yaml, memory://scratch, localstorage://groceries).Noggin.location
onDidChangereadonlyEvent<ChangeEvent>-Noggin.onDidChange
onDidErrorreadonlyEvent<NogginError>-Noggin.onDidError
readOnlyreadonlybooleanWhen true, the provider has declared this noggin read-only. Every apply() call will reject with NogginError({ code: 'read-only' }). UIs read this to gate mutation affordances preemptively rather than waiting for a failed round-trip. A provider is responsible for keeping the noggin's in-memory state in sync with its backing store on its own — via watchers for the fast path plus polling as a safety net. There is no refresh() verb because callers shouldn't need to know when a provider might have missed an external change: they observe onDidChange and trust the accessors.Noggin.readOnly
rootsreadonlyreadonly Item[]-Noggin.roots

Methods

add()
add(opts: AddOptions): Promise<CurrentTreeView>;

Create a child without making it active.

Parameters
ParameterType
optsAddOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.add

apply()
apply(ops: readonly AtomicOp[]): Promise<void>;

Atomically apply a list of AtomicOps. The only write primitive.

Parameters
ParameterType
opsreadonly AtomicOp[]
Returns

Promise<void>

childrenOf()
childrenOf(k: string): readonly Item[];
Parameters
ParameterType
kstring
Returns

readonly Item[]

Inherited from

Noggin.childrenOf

delete()
delete(opts: DeleteOptions): Promise<DeleteResult>;

Remove an item (and optionally its subtree).

Parameters
ParameterType
optsDeleteOptions
Returns

Promise<DeleteResult>

Inherited from

Noggin.delete

describe()
describe(): string;

Human-readable description of where this noggin lives. Not machine-parseable.

Returns

string

Inherited from

Noggin.describe

dispose()
dispose(): Promise<void>;

Release provider resources. After dispose the noggin is unusable.

Returns

Promise<void>

Inherited from

Noggin.dispose

done()
done(opts?: DoneOptions): Promise<CurrentTreeView>;

Mark target done and surface to its parent. Idempotent.

Parameters
ParameterType
opts?DoneOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.done

edit()
edit(opts: EditOptions): Promise<CurrentTreeView>;

Idempotent mutation of an item's done state and/or title.

Parameters
ParameterType
optsEditOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.edit

findByKey()
findByKey(k: string): Item;
Parameters
ParameterType
kstring
Returns

Item

Inherited from

Noggin.findByKey

goto()
goto(opts: GotoOptions): Promise<CurrentTreeView>;

Make the item at the given path active.

Parameters
ParameterType
optsGotoOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.goto

move()
move(opts: MoveOptions): Promise<CurrentTreeView>;

Relocate an item under a new parent / among siblings.

Parameters
ParameterType
optsMoveOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.move

note()
note(opts: NoteOptions): Promise<CurrentTreeView>;

Append a timestamped note to an item.

Parameters
ParameterType
optsNoteOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.note

pathOf()
pathOf(item: Item): string;
Parameters
ParameterType
itemItem
Returns

string

Inherited from

Noggin.pathOf

pop()
pop(opts?: PopOptions): Promise<CurrentTreeView>;

Shorthand for done on the active item.

Parameters
ParameterType
opts?PopOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.pop

push()
push(opts: PushOptions): Promise<CurrentTreeView>;

Create a child of active and immediately become it.

Parameters
ParameterType
optsPushOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.push

resolvePath()
resolvePath(p: string): Item;

Resolve a path, throwing NogginError('path-not-found') on miss.

Parameters
ParameterType
pstring
Returns

Item

show()
show(opts?: ShowOptions): Promise<CurrentTreeView>;

Render the current-position view (spine + peers + first-level children).

Parameters
ParameterType
opts?ShowOptions
Returns

Promise<CurrentTreeView>

Inherited from

Noggin.show

tryResolvePath()
tryResolvePath(p: string): Item;
Parameters
ParameterType
pstring
Returns

Item

Inherited from

Noggin.tryResolvePath