@motion-script/core / ContextMap
Class: ContextMap
Defined in: util/context.ts:43
An immutable, layered token→value map carried down the node tree. Each provider derives a child map from its parent's via with, overriding a single token — so a deeper provider naturally shadows a shallower one (nearest-ancestor-wins) without any stack bookkeeping.
Properties
EMPTY
readonlystaticEMPTY:ContextMap
Defined in: util/context.ts:47
The empty map — every token resolves to its own default.
Methods
get()
get<
T>(ctx):T
Defined in: util/context.ts:57
Resolve ctx's value, falling back to its default when unset.
Type Parameters
T
T
Parameters
ctx
Context<T>
Returns
T
with()
with<
T>(ctx,value):ContextMap
Defined in: util/context.ts:50
Return a new map identical to this one but with ctx set to value.
Type Parameters
T
T
Parameters
ctx
Context<T>
value
T
Returns
ContextMap