Skip to content

@graphty/graphty-element / index / CodedFact

Interface: CodedFact<Code> ​

Defined in: graphty-element/src/session/shared.ts:68

Something the element has to say, as a code and the values it is about -- never as words.

graphty-element does not write sentences, headings or labels for a reader: how a fact is worded, in which language, and whether it is shown at all is the application's decision. Every API that reports such a fact hands it over in this shape, and documents its codes and what each parameter holds. Switch on code; treat an unknown code as something to leave out, because new codes may be added in a minor release.

Every parameter is a plain value, so a fact survives structuredClone and JSON.stringify. A parameter that came from the data (a column name, a value) is the data's own text: escape it before putting it into HTML.

Type Parameters ​

Code ​

Code extends string = string

Properties ​

code ​

readonly code: Code

Defined in: graphty-element/src/session/shared.ts:70

What kind of fact this is. Stable: a code is renamed or removed only in a major release.


params ​

readonly params: Readonly<Record<string, CodedFactParam>>

Defined in: graphty-element/src/session/shared.ts:72

The values the fact is about, by name. Each code documents its own names.