Reintent

@reintent/scene/stage

`<Stage>`: one scene, one clock, one registry, one svg.

Its children are the scene, as SVG, with semantic components inside; canvas holds <Draw>s painted every frame over the svg, in its coordinates; html is atmosphere and UI over both, not measured. timeline gives its beats, phases and inputs, phase the one it is in now, language the words it came from.

It opens the scene to the outside as window.__scene (a SceneApi): the manifest, a snapshot with every thing's box, hit tests, stills, overrides and the verifier. An inspector drives a running scene through it; openScene waits for a framed one.

Interfaces

Concept

Defined in: packages/scene/src/language.ts

What some words were understood as, and the path they resolve to.

Properties

PropertyTypeDescription
kindLocalizedWhat kind of meaning, and anything it carries.
lands?stringWhere it lands, when that is more than the ref (a param, two instances).
refstringThe path it resolves to.
wordsLocalizedThe words, as said.

InstanceView

Defined in: packages/scene/src/api.ts

A thing on stage: its boxes, its props and its parts.

Extends

Properties

PropertyTypeDescriptionInherited from
entitystring--
geometryBox | nullFrom its shapes, seen or not.NodeView.geometry
host"canvas" | "svg"-NodeView.host
instancestring | null--
partsNodeView[]--
pathstring-NodeView.path
propsRecord<string, unknown>--
visibleBox | nullFrom the pick buffer: what can be seen of it.NodeView.visible

LanguageLayer

Defined in: packages/scene/src/language.ts

The words a scene came from, and what they meant.

Properties

PropertyTypeDescription
conceptsreadonly Concept[]-
promptreadonly (string | readonly [string, string])[]The words, each span that names a thing as [words, path].

NodeView

Defined in: packages/scene/src/api.ts

A path on stage, and its boxes.

Extended by

Properties

PropertyTypeDescription
geometryBox | nullFrom its shapes, seen or not.
host"canvas" | "svg"-
pathstring-
visibleBox | nullFrom the pick buffer: what can be seen of it.

SceneApi

Defined in: packages/scene/src/api.ts

A running scene, as window.__scene opens it.

Properties

PropertyType
version1

Methods

clearOverrides()
clearOverrides(): void;

Defined in: packages/scene/src/api.ts

Returns

void

flags()
flags(): string[];

Defined in: packages/scene/src/api.ts

Returns

string[]

goto()
goto(name): void;

Defined in: packages/scene/src/api.ts

Hold time and move the scene to a still.

Parameters
ParameterType
namestring
Returns

void

hitTest()
hitTest(x, y): string | null;

Defined in: packages/scene/src/api.ts

Client pixels within the stage → the path drawn there (from the last snapshot).

Parameters
ParameterType
xnumber
ynumber
Returns

string | null

language()
language(): LanguageLayer | null;

Defined in: packages/scene/src/api.ts

Returns

LanguageLayer | null

manifest()
manifest(): Declaration<Params, Params>[];

Defined in: packages/scene/src/api.ts

Every declaration made.

Returns

Declaration<Params, Params>[]

overrides()
overrides(): Record<string, Record<string, unknown>>;

Defined in: packages/scene/src/api.ts

Returns

Record<string, Record<string, unknown>>

play()
play(): void;

Defined in: packages/scene/src/api.ts

Let it run again.

Returns

void

setFlag()
setFlag(name, on): void;

Defined in: packages/scene/src/api.ts

Parameters
ParameterType
namestring
onboolean
Returns

void

setOverride()
setOverride(
   key, 
   prop, 
   value
): void;

Defined in: packages/scene/src/api.ts

Parameters
ParameterType
keystring
propstring
valueunknown
Returns

void

snapshot()
snapshot(): Promise<Snapshot>;

Defined in: packages/scene/src/api.ts

Returns

Promise<Snapshot>

stills()
stills(): readonly Still[];

Defined in: packages/scene/src/api.ts

Returns

readonly Still[]

timeline()
timeline(): TimelineSpec;

Defined in: packages/scene/src/api.ts

Returns

TimelineSpec

verify()
verify(): Promise<Report>;

Defined in: packages/scene/src/api.ts

Returns

Promise<Report>


Snapshot

Defined in: packages/scene/src/api.ts

A scene at one moment, measured.

Properties

PropertyTypeDescription
coveragenumber-
frameobject-
frame.heightnumber-
frame.widthnumber-
frame.xnumber-
frame.ynumber-
frozenboolean-
instancesInstanceView[]-
phasestring | nullThe timeline phase the scene says it is in.
stillstring | null-
tnumber-
timelineTimelineValuesThe timeline, as it is now: declared values with overrides over them.
toClient[number, number, number, number, number, number]Scene units → the stage's client pixels: [a, b, c, d, e, f].
unclaimedBox | null-

StageProps

Defined in: packages/scene/src/stage.tsx

A stage's props.

Type Parameters

Type ParameterDefault type
T extends TimelineSpecTimelineSpec

Properties

PropertyTypeDescription
canvas?ReactNode<Draw>s that belong to no svg thing. A <Draw> can also sit inside its owner.
childrenReactNode-
className?string-
fit?"slice" | "meet"Fill the stage and crop ('slice'), or show it all ('meet').
heightnumber-
html?ReactNode-
language?LanguageLayerThe words it came from, and what they were taken to mean.
onStill?(name, t, timeline) => voidMove the scene's state to a still (by name) or back to play (null). Time is held at t.
phase?stringThe phase it is in now: one of the timeline's.
stills?readonly Still[]Named moments: what an inspector, a thumbnail or a sentence can go to.
style?CSSProperties-
svg?SvgAttrs | ((t, timeline) => SvgAttrs)Attributes for the root svg; a function of time for what moves (a filter, a jolt).
timeline?TIts beats, phases and inputs (timeline()).
viewBox?stringA part of the frame to show instead of all of it (a card, a crop).
widthnumberThe scene's own units: the frame it is designed in.

Still

Defined in: packages/scene/src/api.ts

A named moment of a scene: what an inspector, a thumbnail or a sentence can go to.

Properties

PropertyTypeDescription
expect?readonly string[]Paths that must be visible here (the verifier checks).
label?stringWhat a person would call this moment.
namestring-
phase?stringThe timeline phase it is in (the verifier checks the scene gets there).

Type Aliases

Localized

type Localized = object;

Defined in: packages/scene/src/language.ts

A text in Chinese and in English.

Properties

PropertyType
enstring
zhstring

Functions

openScene()

function openScene(win, options?): Promise<SceneApi>;

Defined in: packages/scene/src/api.ts

The scene running in a window (a frame's, most often), once it has opened itself as window.__scene; rejects after options.timeout milliseconds (10 seconds by default).

Parameters

ParameterType
winWindow
options{ timeout?: number; }
options.timeout?number

Returns

Promise<SceneApi>


Stage()

function Stage<T>(props): ReactNode;

Defined in: packages/scene/src/stage.tsx

One scene: an svg, a canvas over it in its coordinates, one clock and one registry.

Type Parameters

Type ParameterDefault type
T extends TimelineSpecTimelineSpec

Parameters

ParameterType
propsStageProps<T>

Returns

ReactNode


useFlag()

function useFlag(name): boolean;

Defined in: packages/scene/src/stage.tsx

Is a switch on (one an inspector can flip)?

Parameters

ParameterType
namestring

Returns

boolean


useRegistry()

function useRegistry(): Registry;

Defined in: packages/scene/src/context.ts

The stage's registry: what is on stage, and the overrides laid over it.

Returns

Registry

Last updated on

Edit on GitHub