@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
| Property | Type | Description |
|---|---|---|
kind | Localized | What kind of meaning, and anything it carries. |
lands? | string | Where it lands, when that is more than the ref (a param, two instances). |
ref | string | The path it resolves to. |
words | Localized | The words, as said. |
InstanceView
Defined in: packages/scene/src/api.ts
A thing on stage: its boxes, its props and its parts.
Extends
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
entity | string | - | - |
geometry | Box | null | From its shapes, seen or not. | NodeView.geometry |
host | "canvas" | "svg" | - | NodeView.host |
instance | string | null | - | - |
parts | NodeView[] | - | - |
path | string | - | NodeView.path |
props | Record<string, unknown> | - | - |
visible | Box | null | From 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
| Property | Type | Description |
|---|---|---|
concepts | readonly Concept[] | - |
prompt | readonly (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
| Property | Type | Description |
|---|---|---|
geometry | Box | null | From its shapes, seen or not. |
host | "canvas" | "svg" | - |
path | string | - |
visible | Box | null | From 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
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
| Parameter | Type |
|---|---|
name | string |
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
| Parameter | Type |
|---|---|
x | number |
y | number |
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
| Parameter | Type |
|---|---|
name | string |
on | boolean |
Returns
void
setOverride()
setOverride(
key,
prop,
value
): void;Defined in: packages/scene/src/api.ts
Parameters
| Parameter | Type |
|---|---|
key | string |
prop | string |
value | unknown |
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
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
| Property | Type | Description |
|---|---|---|
coverage | number | - |
frame | object | - |
frame.height | number | - |
frame.width | number | - |
frame.x | number | - |
frame.y | number | - |
frozen | boolean | - |
instances | InstanceView[] | - |
phase | string | null | The timeline phase the scene says it is in. |
still | string | null | - |
t | number | - |
timeline | TimelineValues | The 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]. |
unclaimed | Box | null | - |
StageProps
Defined in: packages/scene/src/stage.tsx
A stage's props.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends TimelineSpec | TimelineSpec |
Properties
| Property | Type | Description |
|---|---|---|
canvas? | ReactNode | <Draw>s that belong to no svg thing. A <Draw> can also sit inside its owner. |
children | ReactNode | - |
className? | string | - |
fit? | "slice" | "meet" | Fill the stage and crop ('slice'), or show it all ('meet'). |
height | number | - |
html? | ReactNode | - |
language? | LanguageLayer | The words it came from, and what they were taken to mean. |
onStill? | (name, t, timeline) => void | Move the scene's state to a still (by name) or back to play (null). Time is held at t. |
phase? | string | The 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? | T | Its beats, phases and inputs (timeline()). |
viewBox? | string | A part of the frame to show instead of all of it (a card, a crop). |
width | number | The 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
Type Aliases
Localized
type Localized = object;Defined in: packages/scene/src/language.ts
A text in Chinese and in English.
Properties
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
| Parameter | Type |
|---|---|
win | Window |
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 Parameter | Default type |
|---|---|
T extends TimelineSpec | TimelineSpec |
Parameters
| Parameter | Type |
|---|---|
props | StageProps<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
| Parameter | Type |
|---|---|
name | string |
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
Last updated on
Edit on GitHub