@solidrt/flux-types 0.0.71 → 0.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gui/camera.d.ts +3 -1
- package/gui/spatial.d.ts +63 -22
- package/modules/test.d.ts +15 -0
- package/package.json +1 -1
package/gui/camera.d.ts
CHANGED
|
@@ -57,7 +57,9 @@ declare module "flux:camera" {
|
|
|
57
57
|
/**
|
|
58
58
|
* List the available camera devices. The first call also starts the camera
|
|
59
59
|
* subsystem, which comes up asynchronously: expect an empty list until the
|
|
60
|
-
* initial cameraDeviceChange events arrive.
|
|
60
|
+
* initial cameraDeviceChange events arrive. Under a test that installed an
|
|
61
|
+
* image as the camera (`app.camera` of `@solidrt/test`) the list is that
|
|
62
|
+
* one camera, id 0, and every open shows the image.
|
|
61
63
|
*/
|
|
62
64
|
export function listCameras(): CameraDevice[]
|
|
63
65
|
/**
|
package/gui/spatial.d.ts
CHANGED
|
@@ -47,13 +47,14 @@ declare module "flux:spatial" {
|
|
|
47
47
|
* The node's lifecycle state, for probing: whether it is leaving, its
|
|
48
48
|
* effective visibility as of the last flush, and the motion in force
|
|
49
49
|
* per component - one entry per running track or held write, `to` the
|
|
50
|
-
* target lanes, `
|
|
51
|
-
*
|
|
50
|
+
* target lanes, `heldFor` the ms of a held write's hold still left on
|
|
51
|
+
* the node's own time as of the last advance (null for a running
|
|
52
|
+
* track).
|
|
52
53
|
*/
|
|
53
54
|
export function describeNode(node: NodeId): {
|
|
54
55
|
leaving: boolean
|
|
55
56
|
shown: boolean
|
|
56
|
-
motion: { component: NodeComponent; to: number[];
|
|
57
|
+
motion: { component: NodeComponent; to: number[]; heldFor: number | null }[]
|
|
57
58
|
}
|
|
58
59
|
/** Re-parent (null = make a root). Throws on a cycle. */
|
|
59
60
|
export function setParent(node: NodeId, parent: NodeId | null): void
|
|
@@ -154,12 +155,40 @@ declare module "flux:spatial" {
|
|
|
154
155
|
* setTransform. A component matching its running track's target is
|
|
155
156
|
* left alone, so rewriting the whole array to move one component never
|
|
156
157
|
* restarts the others (a held write's target counts, so re-sending it
|
|
157
|
-
* does not restart its delay).
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
158
|
+
* does not restart its delay). The core steps every track before the
|
|
159
|
+
* frame's JS (beside the clip players), so a read in the frame sees
|
|
160
|
+
* this frame's pose and a raw setTransform made in the frame wins the
|
|
161
|
+
* frame. Each settled component fires one "spatialTransitionEnd"
|
|
162
|
+
* engine event (sol:events), payload `{ node, component:
|
|
163
|
+
* NodeComponent }`, ahead of the frame's JS - on a live node; a
|
|
164
|
+
* leaving node's settles feed its free instead (exitNode).
|
|
161
165
|
*/
|
|
162
166
|
export function writeTransform(node: NodeId, transform: Float32Array): void
|
|
167
|
+
/**
|
|
168
|
+
* Declare (null clears) the rate the native motion in the node's
|
|
169
|
+
* subtree runs at: node transitions with their delays, enters, exits
|
|
170
|
+
* and stagger slots, weights tracks, and the clip players clocked on a
|
|
171
|
+
* node under it (createPlayer's `clock`). 0 freezes, 1 is app time,
|
|
172
|
+
* other values are slow or fast motion. The nearest declaring ancestor
|
|
173
|
+
* wins, never a product through nesting (Godot's process_mode shape): a
|
|
174
|
+
* scene root at 0 freezes the world and a node inside it declaring 1
|
|
175
|
+
* keeps running - a preview spinning on a pause screen. A frozen track
|
|
176
|
+
* is not frame demand (a paused scene lets the loop idle; this write
|
|
177
|
+
* requests the frame that resumes it). Writes while frozen behave as
|
|
178
|
+
* always: undeclared components snap, declared ones retarget and wait;
|
|
179
|
+
* a node let go of (exitNode) stays a ghost until its exit can play,
|
|
180
|
+
* and a node created frozen sits at its `from`. What it does NOT
|
|
181
|
+
* cover: the app's own frame handlers, timers, video and audio stay on
|
|
182
|
+
* app time - app code gates itself, with `timeRate` as its reading.
|
|
183
|
+
* Negative and non-finite values throw (reverse playback is a player's
|
|
184
|
+
* `speed`). The dev clock (`/clock?scale=`) scales app time underneath
|
|
185
|
+
* all of this.
|
|
186
|
+
*/
|
|
187
|
+
export function setTimeScale(node: NodeId, scale: number | null): void
|
|
188
|
+
/** The rate the node's motion runs at (setTimeScale): its own scale,
|
|
189
|
+
* else the nearest declaring ancestor's, else 1. What JS-driven motion
|
|
190
|
+
* inside a scaled subtree multiplies its own frame step by. */
|
|
191
|
+
export function timeRate(node: NodeId): number
|
|
163
192
|
export function setVisible(node: NodeId, visible: boolean): void
|
|
164
193
|
/** What a draw sink writes and where it sorts (bindDraw). */
|
|
165
194
|
export type BindDrawOptions = {
|
|
@@ -241,6 +270,13 @@ declare module "flux:spatial" {
|
|
|
241
270
|
/** Recompute every changed subtree and write the sinks; requests a frame
|
|
242
271
|
* when anything was written. */
|
|
243
272
|
export function flush(): void
|
|
273
|
+
/** The frame's start pass, core's to call after the frame callbacks and
|
|
274
|
+
* their reactive flush: start the lifecycle motion they declared (the
|
|
275
|
+
* enter of a node created in the frame from its `from`, the exit of one
|
|
276
|
+
* let go of), so a read in the late pass of onBeforeRender sees the pose
|
|
277
|
+
* the frame draws. Running motion steps before the callbacks instead.
|
|
278
|
+
* Idempotent within a frame; requests a frame for what it started. */
|
|
279
|
+
export function startTransitions(): void
|
|
244
280
|
|
|
245
281
|
export type ShapeId = number & { readonly __spatialShape: unique symbol }
|
|
246
282
|
|
|
@@ -634,22 +670,27 @@ declare module "flux:spatial" {
|
|
|
634
670
|
export function destroyClip(clip: ClipId): void
|
|
635
671
|
/**
|
|
636
672
|
* Start playing `clip`: `targets[slot]` is the node each channel
|
|
637
|
-
* animates
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
673
|
+
* animates, `clock` the node whose rate (setTimeScale) the player's
|
|
674
|
+
* time, fades and root motion run at - a player has one time over many
|
|
675
|
+
* targets, so the node it is attached to names the clock: the model's
|
|
676
|
+
* root for a mixer. Every target and the clock must be a live scene
|
|
677
|
+
* node (throws otherwise). Players advance on the frame clock BEFORE
|
|
678
|
+
* each frame's JS, sample and weight-blend every active player per
|
|
679
|
+
* (node, path) - two players on one node crossfade - and write the
|
|
680
|
+
* blended TRS into the arena, so frame handlers read and may overwrite
|
|
681
|
+
* freshly posed nodes (last write wins) and the frame's flush
|
|
682
|
+
* publishes the result. `opts` (the setPlayer field names): `speed`
|
|
683
|
+
* scales clip time (1 = as authored, the default); `loop` wraps (the
|
|
684
|
+
* default), else the player holds its final pose and reports once;
|
|
685
|
+
* `weight`/`fade` start the crossfade state (weight 0..1, default 1;
|
|
686
|
+
* fade = weight change per second, default 0 - positive fades in,
|
|
687
|
+
* negative out; past 0 the player is removed). When a player finishes
|
|
688
|
+
* or is removed without finishing (faded out, clip, clock or target
|
|
689
|
+
* destroyed), the "spatialClipEnd" engine event (sol:events) fires with
|
|
690
|
+
* payload { player, reason: "finished" | "dropped" }, before the same
|
|
691
|
+
* frame's handlers.
|
|
651
692
|
*/
|
|
652
|
-
export function createPlayer(clip: ClipId, targets: NodeId[],
|
|
693
|
+
export function createPlayer(clip: ClipId, targets: NodeId[], clock: NodeId, opts?: { speed?: number; loop?: boolean; weight?: number; fade?: number }): PlayerId
|
|
653
694
|
/** Write the given fields of a player - the O(changes) crossfade
|
|
654
695
|
* channel. Setting `time` (seconds) also re-arms a finished player's
|
|
655
696
|
* end report. Throws on an id that already dropped. */
|
package/modules/test.d.ts
CHANGED
|
@@ -130,6 +130,21 @@ declare module "flux:test" {
|
|
|
130
130
|
/** Exactly `null`; `undefined` is not. */
|
|
131
131
|
toBeNull(): void
|
|
132
132
|
|
|
133
|
+
/** Anything but `undefined`; `null` counts as defined. */
|
|
134
|
+
toBeDefined(): void
|
|
135
|
+
|
|
136
|
+
/** Exactly `undefined`; `null` is not. */
|
|
137
|
+
toBeUndefined(): void
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A string, array, typed array or anything else with a numeric `length`
|
|
141
|
+
* whose length is `length`; a failure prints the length it found.
|
|
142
|
+
*/
|
|
143
|
+
toHaveLength(length: number): void
|
|
144
|
+
|
|
145
|
+
/** An instance of the class (or constructor) `expected`, as `instanceof` sees it. */
|
|
146
|
+
toBeInstanceOf(expected: abstract new (...args: any[]) => unknown): void
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
* A string that contains the part `item`, or an array (or any other
|
|
135
150
|
* iterable) with an entry that is `item` by `===`.
|