@graphty/graphty-element / session / selectorRule
Function: selectorRule() ​
selectorRule(
selector,options?): {edges?:EdgeReading;match:"rule";where:RuleTree; } |undefined
Defined in: graphty-element/src/session/styles/selector.ts:335
Read any layer's selector as an editable rule, so an editor draws a run's layer the way it draws a reader's: "carries a Degree value", "Louvain group is 3", "on the shortest route". The rule matches the same elements, so writing it back changes nothing on the canvas.
import { selectorRule } from "@graphty/graphty-element/session";
const route = session.styles.list().find((layer) => layer.source.by === "run" && layer.kind === "highlight");
selectorRule(route.selector);
// { match: "rule", where: { kind: "text", reads: "results.route.onPath", mode: "exact", text: "true", caseSensitive: true } }Parameters ​
selector ​
Selector
Any selector.
options? ​
How much to read.
comparisons? ​
boolean
Read ordering comparisons and bare column names too. Default false.
Returns ​
{ edges?: EdgeReading; match: "rule"; where: RuleTree; } | undefined
Its rule form: a rule selector as it is; has as "has a value" (a text leaf with an empty regex); top as a threshold leaf; an expression that compares a data. or results. path with a number, a yes-or-no value or null (and && of those) as the matching leaves. Undefined for a selector with no rule form (everything, ids, member, state, and any other expression), which an editor draws its own way. With options.comparisons, an expression is also read through >= and <= (a range leaf) and > (a threshold leaf's above) against a number, and through a bare column name, which a rule reads as that file column: donations >= `10000` is the range leaf on data.donations from 10000 up.
Since ​
3.26.0