@vizij/runtime-react 0.2.0 → 0.3.0
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/README.md +420 -121
- package/dist/index.cjs +1692 -650
- package/dist/index.d.cts +63 -8
- package/dist/index.d.ts +63 -8
- package/dist/index.js +1701 -667
- package/package.json +23 -21
- package/LICENSE +0 -201
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ValueJSON } from '@vizij/value-json';
|
|
5
5
|
import { IrGraph } from '@vizij/node-graph-authoring';
|
|
6
|
-
import {
|
|
6
|
+
import { RawValue, AnimatableValue } from '@vizij/utils';
|
|
7
7
|
import { World, VizijBundleExtension, VizijProps } from '@vizij/render';
|
|
8
8
|
|
|
9
|
+
/** Value shape hint. Accepted through the public surface, unused by the device. */
|
|
10
|
+
type ShapeJSON = Record<string, unknown>;
|
|
11
|
+
/** Paths a graph reads/writes — metadata for output tracking and seeding. */
|
|
12
|
+
type GraphSubscriptions = {
|
|
13
|
+
inputs?: string[];
|
|
14
|
+
outputs?: string[];
|
|
15
|
+
};
|
|
16
|
+
/** A Vizij graph spec handled structurally (nodes/edges arrays of records). */
|
|
17
|
+
type GraphSpecLike = {
|
|
18
|
+
nodes?: Array<Record<string, unknown>>;
|
|
19
|
+
edges?: Array<Record<string, unknown>>;
|
|
20
|
+
metadata?: unknown;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** One graph source composed into the device's behavior. */
|
|
24
|
+
type GraphRegistrationConfig = {
|
|
25
|
+
id?: string;
|
|
26
|
+
spec: GraphSpecLike;
|
|
27
|
+
subs?: GraphSubscriptions;
|
|
28
|
+
};
|
|
29
|
+
/** Per-source merge options. Composition is last-writer-wins today (VIZ-53). */
|
|
30
|
+
type MergeStrategyOptions = Record<string, unknown>;
|
|
31
|
+
/** Player/instance setup carried by animation assets; consumed by the JS clip pipeline. */
|
|
32
|
+
type AnimationSetup = {
|
|
33
|
+
animation?: unknown;
|
|
34
|
+
player?: Record<string, unknown>;
|
|
35
|
+
instance?: Record<string, unknown>;
|
|
36
|
+
};
|
|
9
37
|
type PoseDefinition = {
|
|
10
38
|
id: string;
|
|
11
39
|
name?: string;
|
|
@@ -135,7 +163,7 @@ type VizijAssetBundle = {
|
|
|
135
163
|
type RuntimeError = {
|
|
136
164
|
message: string;
|
|
137
165
|
cause?: unknown;
|
|
138
|
-
phase?: "assets" | "
|
|
166
|
+
phase?: "assets" | "engine" | "registration" | "animation" | "bridge" | "driver" | "unknown";
|
|
139
167
|
timestamp: number;
|
|
140
168
|
};
|
|
141
169
|
type VizijRuntimeStatus = {
|
|
@@ -206,6 +234,29 @@ type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
|
206
234
|
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
207
235
|
assetBundle: VizijAssetBundle;
|
|
208
236
|
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
237
|
+
/** Current engine-store value of a path (read-your-own-write included). */
|
|
238
|
+
getValueSnapshot: (path: string) => ValueJSON | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* A snapshot of EVERY key currently in the device store, as path → Value in
|
|
241
|
+
* arora's serde JSON shape (pass-through from the device; not `ValueJSON`).
|
|
242
|
+
* `undefined` until the device exists. For mirrors/bridges that forward the
|
|
243
|
+
* whole store (e.g. the standalone's native-store bridge), not for per-path
|
|
244
|
+
* sampling — use `getValueSnapshot` for that.
|
|
245
|
+
*/
|
|
246
|
+
getStoreSnapshot: () => Record<string, unknown> | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Notifies with each step's drained store changes (path → Value in arora's
|
|
249
|
+
* serde JSON shape; `null` for a cleared key). The change-driven counterpart
|
|
250
|
+
* to `getStoreSnapshot` for store bridges: seed from the snapshot, then stay
|
|
251
|
+
* current from these. Returns an unsubscribe function.
|
|
252
|
+
*/
|
|
253
|
+
subscribeToStoreChanges: (listener: (changes: Record<string, unknown>) => void) => () => void;
|
|
254
|
+
/**
|
|
255
|
+
* Notifies after each engine step, once the step's store changes have been
|
|
256
|
+
* applied. Pair with `getValueSnapshot` to sample values step-aligned.
|
|
257
|
+
* Returns an unsubscribe function.
|
|
258
|
+
*/
|
|
259
|
+
subscribeToStep: (listener: () => void) => () => void;
|
|
209
260
|
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
261
|
tier?: "auto" | "assets" | "graphs";
|
|
211
262
|
}) => void;
|
|
@@ -229,7 +280,6 @@ type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
|
229
280
|
step: (dt: number, opts?: {
|
|
230
281
|
forceRuntime?: boolean;
|
|
231
282
|
}) => void;
|
|
232
|
-
advanceAnimations: (dt: number) => void;
|
|
233
283
|
inputConstraints: Record<string, {
|
|
234
284
|
min?: number;
|
|
235
285
|
max?: number;
|
|
@@ -243,9 +293,15 @@ type VizijRuntimeProviderProps = {
|
|
|
243
293
|
faceId?: string;
|
|
244
294
|
updateTier?: RuntimeUpdateTier;
|
|
245
295
|
autoCreate?: boolean;
|
|
246
|
-
createOptions?: CreateOrchOptions;
|
|
247
296
|
autostart?: boolean;
|
|
248
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Whether this provider's device paces itself: when true the device is
|
|
299
|
+
* handed to its own `run()` loop at boot and the provider only pumps its
|
|
300
|
+
* changes; when false the device advances solely on `step(dt,
|
|
301
|
+
* { forceRuntime: true })` calls from the host. A device handed to `run()`
|
|
302
|
+
* keeps its loop even if this later turns false.
|
|
303
|
+
*/
|
|
304
|
+
driveRuntime?: boolean;
|
|
249
305
|
mergeStrategy?: MergeStrategyOptions;
|
|
250
306
|
onRegisterControllers?: (ids: {
|
|
251
307
|
graphs: string[];
|
|
@@ -253,7 +309,6 @@ type VizijRuntimeProviderProps = {
|
|
|
253
309
|
}) => void;
|
|
254
310
|
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
311
|
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
256
|
-
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
257
312
|
};
|
|
258
313
|
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
314
|
type RuntimeUpdatePlan = {
|
|
@@ -268,7 +323,7 @@ type RuntimeGraphBundle = {
|
|
|
268
323
|
};
|
|
269
324
|
|
|
270
325
|
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
271
|
-
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate,
|
|
326
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, autostart, driveRuntime, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
272
327
|
|
|
273
328
|
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
274
329
|
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ValueJSON } from '@vizij/value-json';
|
|
5
5
|
import { IrGraph } from '@vizij/node-graph-authoring';
|
|
6
|
-
import {
|
|
6
|
+
import { RawValue, AnimatableValue } from '@vizij/utils';
|
|
7
7
|
import { World, VizijBundleExtension, VizijProps } from '@vizij/render';
|
|
8
8
|
|
|
9
|
+
/** Value shape hint. Accepted through the public surface, unused by the device. */
|
|
10
|
+
type ShapeJSON = Record<string, unknown>;
|
|
11
|
+
/** Paths a graph reads/writes — metadata for output tracking and seeding. */
|
|
12
|
+
type GraphSubscriptions = {
|
|
13
|
+
inputs?: string[];
|
|
14
|
+
outputs?: string[];
|
|
15
|
+
};
|
|
16
|
+
/** A Vizij graph spec handled structurally (nodes/edges arrays of records). */
|
|
17
|
+
type GraphSpecLike = {
|
|
18
|
+
nodes?: Array<Record<string, unknown>>;
|
|
19
|
+
edges?: Array<Record<string, unknown>>;
|
|
20
|
+
metadata?: unknown;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** One graph source composed into the device's behavior. */
|
|
24
|
+
type GraphRegistrationConfig = {
|
|
25
|
+
id?: string;
|
|
26
|
+
spec: GraphSpecLike;
|
|
27
|
+
subs?: GraphSubscriptions;
|
|
28
|
+
};
|
|
29
|
+
/** Per-source merge options. Composition is last-writer-wins today (VIZ-53). */
|
|
30
|
+
type MergeStrategyOptions = Record<string, unknown>;
|
|
31
|
+
/** Player/instance setup carried by animation assets; consumed by the JS clip pipeline. */
|
|
32
|
+
type AnimationSetup = {
|
|
33
|
+
animation?: unknown;
|
|
34
|
+
player?: Record<string, unknown>;
|
|
35
|
+
instance?: Record<string, unknown>;
|
|
36
|
+
};
|
|
9
37
|
type PoseDefinition = {
|
|
10
38
|
id: string;
|
|
11
39
|
name?: string;
|
|
@@ -135,7 +163,7 @@ type VizijAssetBundle = {
|
|
|
135
163
|
type RuntimeError = {
|
|
136
164
|
message: string;
|
|
137
165
|
cause?: unknown;
|
|
138
|
-
phase?: "assets" | "
|
|
166
|
+
phase?: "assets" | "engine" | "registration" | "animation" | "bridge" | "driver" | "unknown";
|
|
139
167
|
timestamp: number;
|
|
140
168
|
};
|
|
141
169
|
type VizijRuntimeStatus = {
|
|
@@ -206,6 +234,29 @@ type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
|
206
234
|
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
207
235
|
assetBundle: VizijAssetBundle;
|
|
208
236
|
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
237
|
+
/** Current engine-store value of a path (read-your-own-write included). */
|
|
238
|
+
getValueSnapshot: (path: string) => ValueJSON | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* A snapshot of EVERY key currently in the device store, as path → Value in
|
|
241
|
+
* arora's serde JSON shape (pass-through from the device; not `ValueJSON`).
|
|
242
|
+
* `undefined` until the device exists. For mirrors/bridges that forward the
|
|
243
|
+
* whole store (e.g. the standalone's native-store bridge), not for per-path
|
|
244
|
+
* sampling — use `getValueSnapshot` for that.
|
|
245
|
+
*/
|
|
246
|
+
getStoreSnapshot: () => Record<string, unknown> | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Notifies with each step's drained store changes (path → Value in arora's
|
|
249
|
+
* serde JSON shape; `null` for a cleared key). The change-driven counterpart
|
|
250
|
+
* to `getStoreSnapshot` for store bridges: seed from the snapshot, then stay
|
|
251
|
+
* current from these. Returns an unsubscribe function.
|
|
252
|
+
*/
|
|
253
|
+
subscribeToStoreChanges: (listener: (changes: Record<string, unknown>) => void) => () => void;
|
|
254
|
+
/**
|
|
255
|
+
* Notifies after each engine step, once the step's store changes have been
|
|
256
|
+
* applied. Pair with `getValueSnapshot` to sample values step-aligned.
|
|
257
|
+
* Returns an unsubscribe function.
|
|
258
|
+
*/
|
|
259
|
+
subscribeToStep: (listener: () => void) => () => void;
|
|
209
260
|
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
261
|
tier?: "auto" | "assets" | "graphs";
|
|
211
262
|
}) => void;
|
|
@@ -229,7 +280,6 @@ type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
|
229
280
|
step: (dt: number, opts?: {
|
|
230
281
|
forceRuntime?: boolean;
|
|
231
282
|
}) => void;
|
|
232
|
-
advanceAnimations: (dt: number) => void;
|
|
233
283
|
inputConstraints: Record<string, {
|
|
234
284
|
min?: number;
|
|
235
285
|
max?: number;
|
|
@@ -243,9 +293,15 @@ type VizijRuntimeProviderProps = {
|
|
|
243
293
|
faceId?: string;
|
|
244
294
|
updateTier?: RuntimeUpdateTier;
|
|
245
295
|
autoCreate?: boolean;
|
|
246
|
-
createOptions?: CreateOrchOptions;
|
|
247
296
|
autostart?: boolean;
|
|
248
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Whether this provider's device paces itself: when true the device is
|
|
299
|
+
* handed to its own `run()` loop at boot and the provider only pumps its
|
|
300
|
+
* changes; when false the device advances solely on `step(dt,
|
|
301
|
+
* { forceRuntime: true })` calls from the host. A device handed to `run()`
|
|
302
|
+
* keeps its loop even if this later turns false.
|
|
303
|
+
*/
|
|
304
|
+
driveRuntime?: boolean;
|
|
249
305
|
mergeStrategy?: MergeStrategyOptions;
|
|
250
306
|
onRegisterControllers?: (ids: {
|
|
251
307
|
graphs: string[];
|
|
@@ -253,7 +309,6 @@ type VizijRuntimeProviderProps = {
|
|
|
253
309
|
}) => void;
|
|
254
310
|
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
311
|
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
256
|
-
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
257
312
|
};
|
|
258
313
|
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
314
|
type RuntimeUpdatePlan = {
|
|
@@ -268,7 +323,7 @@ type RuntimeGraphBundle = {
|
|
|
268
323
|
};
|
|
269
324
|
|
|
270
325
|
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
271
|
-
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate,
|
|
326
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, autostart, driveRuntime, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
272
327
|
|
|
273
328
|
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
274
329
|
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|