visibleNodes

Returns the marks a reader can see right now: flatNodes, except that a presence cue which has not fired, or has been cued back out, takes its contents with it.

@internote/canvas-sdkFunction
On this page
import { visibleNodes } from '@internote/canvas-sdk';

Anything that puts a control in front of the reader has to ask this rather than flatNodes, or a control written inside a cue hands out its slider from the first step while the mark it drives is still off the surface. The attention cues leave presence alone, so their contents are always here.

#Signature

<N extends NodeLike>(
    children: readonly N[],
    nodeVisible: (node: N) => boolean,
): N[]

#Parameters

children
An environment's children, as childNodes returns them.
nodeVisible
Whether a cue's content is present at this moment. Pass ctx.animation.nodeVisible, so the answer is the one the anchors give.

#Returns

The visible marks in source order.

#Example

const shown = visibleNodes(childNodes(ctx.node.body), (node) => ctx.animation.nodeVisible(node));

Declared in packages/canvas-sdk/src/environment/nodes.ts:157.

Last updated