Conditional
Types
Node type
type Node<T> = Graph.Node<T>Properties
default Read Only
Conditional.default: anySentinel key for Flux.switch maps: the factory stored under this key mounts whenever the source value matches no other key, the conditional's catch-all branch. Unmatched values share this stable key, so switching between two different unmatched values does not rebuild the branch.
Functions
show
Conditional.show<T, F>(condition: Node<any> | (() -> any) | any, component: (value: () -> any) -> T, fallback: ((value: () -> any) -> F)?): Node<any>Mounts component while condition is truthy, swapping to fallback (if given) when it turns falsy. The chosen factory runs once per mount in its own branch scope (the effects and cleanups it registers are torn down automatically on the next swap) and receives a value accessor for the live condition value. Returns a node usable at a numeric index of Flux.new / Flux.edit.
Parameters
condition: The reactive source; re-runs only when its truthiness flips, not on every change.component: Branch factory mounted whileconditionis truthy; receives(value).fallback: Optional branch factory mounted whileconditionis falsy; receives(value).
showKeyed
Conditional.showKeyed<T, F>(condition: Node<any> | (() -> any) | any, component: (value: () -> any) -> T, fallback: ((value: () -> any) -> F)?): Node<any>Identity-keyed variant of Flux.show: instead of rebuilding only when condition's truthiness flips, it rebuilds whenever the value's identity changes, so swapping one truthy value for another remounts the branch with fresh state. The chosen factory runs in its own branch scope and receives a value accessor; since the value is fixed for the branch's lifetime, reading value() in the factory body yields it directly. Mirrors SolidJS's <Show keyed>.
Parameters
condition: The reactive source; re-runs whenever its value changes identity, not just truthiness.component: Branch factory mounted whileconditionis truthy; receives(value).fallback: Optional branch factory mounted whileconditionis falsy; receives(value).
switch
Conditional.switch<K>(source: Node<K> | (() -> K) | K)Mounts the branch keyed by source's current value. Curries: pass the reactive source, then a map of value → factory; the matching factory runs once in its own branch scope and receives a value accessor. For a keyed branch value() is the matched key (fixed for the branch's lifetime); under Flux.default (which mounts for any unmatched value), value() tracks the live unmatched value. Returns a node usable at a numeric index of Flux.new / Flux.edit.