@graphty/graphty-element / session / Layer
Interface: Layer ​
Defined in: graphty-element/src/session/styles/Layer.ts:82
One layer of the style stack: what it paints, where it paints it, and who put it there.
Data, not an object with behaviour. Everything that happens to a layer happens through the styles API, so a layer handed to a consumer can be read, kept, diffed and serialised without any of it being able to change the picture behind the element's back.
Properties ​
enabled ​
readonlyenabled:boolean
Defined in: graphty-element/src/session/styles/Layer.ts:107
Whether the layer paints at all. A disabled layer keeps its place in the stack.
encode? ​
readonlyoptionalencode?:Partial<Record<Channel,Binding>>
Defined in: graphty-element/src/session/styles/Layer.ts:115
The declarative value-to-channel bindings it writes, when it has any.
id ​
readonlyid:string
Defined in: graphty-element/src/session/styles/Layer.ts:87
The layer's identity: element-minted, stable for the life of the layer, and never an array index. Opaque -- nothing reads meaning back out of it.
kind ​
readonlykind:LayerKind
Defined in: graphty-element/src/session/styles/Layer.ts:91
What the layer is for, which is what a layer list groups and sorts on.
locked ​
readonlylocked:boolean
Defined in: graphty-element/src/session/styles/Layer.ts:105
Whether the layer belongs to the element rather than to the consumer.
Exactly source.by === "element", never set on its own. A locked layer cannot be removed, edited or moved by a consumer; the way past one is to add a layer above it.
name ​
readonlyname:string
Defined in: graphty-element/src/session/styles/Layer.ts:89
What a person calls it. Free text, and not an identity: two layers may share a name.
selector ​
readonlyselector:Selector
Defined in: graphty-element/src/session/styles/Layer.ts:111
Which elements it paints.
set? ​
readonlyoptionalset?:Partial<Record<Channel,ChannelValue>>
Defined in: graphty-element/src/session/styles/Layer.ts:113
The literal values it writes, when it writes any.
source ​
readonlysource:LayerSource
Defined in: graphty-element/src/session/styles/Layer.ts:98
Who put the layer in the stack.
REQUIRED, unlike on the spec that authored it: a layer whose origin is unknown is a layer nothing can sweep up, protect or explain. An unstated source on a spec means {by:"user"}.
target ​
readonlytarget:SelectorTarget
Defined in: graphty-element/src/session/styles/Layer.ts:109
Whether the layer paints nodes or edges. One layer never paints both.
userData? ​
readonlyoptionaluserData?:Record<string,unknown>
Defined in: graphty-element/src/session/styles/Layer.ts:126
The consumer's own bag, carried untouched.
The element never reads it, copies it, validates it or freezes it: what was handed in is the object handed back, and it survives every update that does not replace it. It exists so that a consumer keeping per-layer state of its own -- which row is expanded, which control is pinned, where the layer came from in its own model -- has a documented place to keep it. Without one, every consumer invents a place, and that place is a name collision with the next release.