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
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
active | readonly | Item | - | Noggin.active |
items | readonly | readonly Item[] | - | Noggin.items |
location | readonly | string | Canonical URL the provider opened. Mirrors the location the caller passed to openNoggin (e.g. file:///work/today.yaml, memory://scratch, localstorage://groceries). | Noggin.location |
onDidChange | readonly | Event<ChangeEvent> | - | Noggin.onDidChange |
onDidError | readonly | Event<NogginError> | - | Noggin.onDidError |
readOnly | readonly | boolean | When 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 |
roots | readonly | readonly Item[] | - | Noggin.roots |
Methods
add()
add(opts: AddOptions): Promise<CurrentTreeView>;
Create a child without making it active.
Parameters
| Parameter | Type |
|---|---|
opts | AddOptions |
Returns
Promise<CurrentTreeView>
Inherited from
apply()
apply(ops: readonly AtomicOp[]): Promise<void>;
Atomically apply a list of AtomicOps. The only write primitive.
Parameters
| Parameter | Type |
|---|---|
ops | readonly AtomicOp[] |
Returns
Promise<void>
childrenOf()
childrenOf(k: string): readonly Item[];
Parameters
| Parameter | Type |
|---|---|
k | string |
Returns
readonly Item[]
Inherited from
delete()
delete(opts: DeleteOptions): Promise<DeleteResult>;
Remove an item (and optionally its subtree).
Parameters
| Parameter | Type |
|---|---|
opts | DeleteOptions |
Returns
Promise<DeleteResult>
Inherited from
describe()
describe(): string;
Human-readable description of where this noggin lives. Not machine-parseable.
Returns
string
Inherited from
dispose()
dispose(): Promise<void>;
Release provider resources. After dispose the noggin is unusable.
Returns
Promise<void>
Inherited from
done()
done(opts?: DoneOptions): Promise<CurrentTreeView>;
Mark target done and surface to its parent. Idempotent.
Parameters
| Parameter | Type |
|---|---|
opts? | DoneOptions |
Returns
Promise<CurrentTreeView>
Inherited from
edit()
edit(opts: EditOptions): Promise<CurrentTreeView>;
Idempotent mutation of an item's done state and/or title.
Parameters
| Parameter | Type |
|---|---|
opts | EditOptions |
Returns
Promise<CurrentTreeView>
Inherited from
findByKey()
findByKey(k: string): Item;
Parameters
| Parameter | Type |
|---|---|
k | string |
Returns
Inherited from
goto()
goto(opts: GotoOptions): Promise<CurrentTreeView>;
Make the item at the given path active.
Parameters
| Parameter | Type |
|---|---|
opts | GotoOptions |
Returns
Promise<CurrentTreeView>
Inherited from
move()
move(opts: MoveOptions): Promise<CurrentTreeView>;
Relocate an item under a new parent / among siblings.
Parameters
| Parameter | Type |
|---|---|
opts | MoveOptions |
Returns
Promise<CurrentTreeView>
Inherited from
note()
note(opts: NoteOptions): Promise<CurrentTreeView>;
Append a timestamped note to an item.
Parameters
| Parameter | Type |
|---|---|
opts | NoteOptions |
Returns
Promise<CurrentTreeView>
Inherited from
pathOf()
pathOf(item: Item): string;
Parameters
| Parameter | Type |
|---|---|
item | Item |
Returns
string
Inherited from
pop()
pop(opts?: PopOptions): Promise<CurrentTreeView>;
Shorthand for done on the active item.
Parameters
| Parameter | Type |
|---|---|
opts? | PopOptions |
Returns
Promise<CurrentTreeView>
Inherited from
push()
push(opts: PushOptions): Promise<CurrentTreeView>;
Create a child of active and immediately become it.
Parameters
| Parameter | Type |
|---|---|
opts | PushOptions |
Returns
Promise<CurrentTreeView>
Inherited from
resolvePath()
resolvePath(p: string): Item;
Resolve a path, throwing NogginError('path-not-found') on miss.
Parameters
| Parameter | Type |
|---|---|
p | string |
Returns
show()
show(opts?: ShowOptions): Promise<CurrentTreeView>;
Render the current-position view (spine + peers + first-level children).
Parameters
| Parameter | Type |
|---|---|
opts? | ShowOptions |
Returns
Promise<CurrentTreeView>
Inherited from
tryResolvePath()
tryResolvePath(p: string): Item;
Parameters
| Parameter | Type |
|---|---|
p | string |