@vizij/runtime-react 0.0.14 → 0.2.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 +18 -4
- package/dist/index.cjs +4077 -0
- package/dist/index.d.cts +342 -0
- package/dist/index.d.ts +173 -9
- package/dist/index.js +3035 -346
- package/package.json +15 -11
- package/dist/index.d.mts +0 -178
- package/dist/index.mjs +0 -1363
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
|
+
import { GraphRegistrationConfig, GraphSubscriptions, AnimationSetup, ValueJSON, CreateOrchOptions, MergeStrategyOptions, ShapeJSON } from '@vizij/orchestrator-react';
|
|
5
|
+
import { IrGraph } from '@vizij/node-graph-authoring';
|
|
6
|
+
import { AnimatableValue, RawValue } from '@vizij/utils';
|
|
7
|
+
import { World, VizijBundleExtension, VizijProps } from '@vizij/render';
|
|
8
|
+
|
|
9
|
+
type PoseDefinition = {
|
|
10
|
+
id: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
group?: string | null;
|
|
14
|
+
groupId?: string | null;
|
|
15
|
+
groupIds?: string[];
|
|
16
|
+
values: Record<string, number | undefined>;
|
|
17
|
+
};
|
|
18
|
+
type PoseBlendMode = "average" | "additive";
|
|
19
|
+
type PoseGroupDefinition = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
blendMode?: PoseBlendMode;
|
|
24
|
+
};
|
|
25
|
+
type PoseRigConfig = {
|
|
26
|
+
version: number;
|
|
27
|
+
faceId?: string | null;
|
|
28
|
+
title?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
poseGroups?: PoseGroupDefinition[];
|
|
31
|
+
crossGroupBlendMode?: PoseBlendMode;
|
|
32
|
+
neutralInputs: Record<string, number>;
|
|
33
|
+
poses: PoseDefinition[];
|
|
34
|
+
metadata?: Record<string, unknown> | {
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type RootBounds = {
|
|
41
|
+
center: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
};
|
|
45
|
+
size: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
type VizijGlbAsset = {
|
|
51
|
+
kind: "url";
|
|
52
|
+
src: string;
|
|
53
|
+
aggressiveImport?: boolean;
|
|
54
|
+
rootBounds?: RootBounds;
|
|
55
|
+
} | {
|
|
56
|
+
kind: "blob";
|
|
57
|
+
blob: Blob;
|
|
58
|
+
aggressiveImport?: boolean;
|
|
59
|
+
rootBounds?: RootBounds;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "world";
|
|
62
|
+
world: World | Record<string, unknown>;
|
|
63
|
+
animatables: Record<string, AnimatableValue> | Record<string, unknown>;
|
|
64
|
+
bundle?: VizijBundleExtension | null;
|
|
65
|
+
};
|
|
66
|
+
type VizijGraphAsset = {
|
|
67
|
+
id: string;
|
|
68
|
+
spec?: GraphRegistrationConfig["spec"];
|
|
69
|
+
ir?: IrGraph | null;
|
|
70
|
+
subscriptions?: Partial<GraphSubscriptions>;
|
|
71
|
+
inputMetadata?: VizijInputMetadata[];
|
|
72
|
+
};
|
|
73
|
+
type VizijInputMetadata = {
|
|
74
|
+
id?: string;
|
|
75
|
+
path: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
source?: string;
|
|
78
|
+
root?: string;
|
|
79
|
+
defaultValue?: number;
|
|
80
|
+
range?: {
|
|
81
|
+
min?: number;
|
|
82
|
+
max?: number;
|
|
83
|
+
};
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
type AnimationKeyframeLike = {
|
|
87
|
+
time?: number;
|
|
88
|
+
value?: number;
|
|
89
|
+
inTangent?: number | null;
|
|
90
|
+
outTangent?: number | null;
|
|
91
|
+
[key: string]: unknown;
|
|
92
|
+
};
|
|
93
|
+
type AnimationTrackLike = {
|
|
94
|
+
channel: string;
|
|
95
|
+
keyframes?: AnimationKeyframeLike[];
|
|
96
|
+
interpolation?: "linear" | "step" | "cubic" | string;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
type AnimationClipLike = {
|
|
100
|
+
id?: string;
|
|
101
|
+
name?: string;
|
|
102
|
+
duration?: number;
|
|
103
|
+
tracks?: AnimationTrackLike[];
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
};
|
|
106
|
+
type VizijAnimationAsset = {
|
|
107
|
+
id: string;
|
|
108
|
+
clip: AnimationClipLike;
|
|
109
|
+
setup?: Partial<AnimationSetup>;
|
|
110
|
+
weight?: number;
|
|
111
|
+
};
|
|
112
|
+
type VizijProgramAsset = {
|
|
113
|
+
id: string;
|
|
114
|
+
label?: string;
|
|
115
|
+
graph: VizijGraphAsset;
|
|
116
|
+
resetValues?: Record<string, number>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
};
|
|
119
|
+
type VizijAssetBundle = {
|
|
120
|
+
namespace?: string;
|
|
121
|
+
faceId?: string;
|
|
122
|
+
glb: VizijGlbAsset;
|
|
123
|
+
rig?: VizijGraphAsset;
|
|
124
|
+
pose?: {
|
|
125
|
+
graph?: VizijGraphAsset;
|
|
126
|
+
config?: PoseRigConfig;
|
|
127
|
+
stageNeutralFilter?: (id: string, path: string) => boolean;
|
|
128
|
+
};
|
|
129
|
+
animations?: VizijAnimationAsset[];
|
|
130
|
+
programs?: VizijProgramAsset[];
|
|
131
|
+
initialInputs?: Record<string, ValueJSON>;
|
|
132
|
+
metadata?: Record<string, unknown>;
|
|
133
|
+
bundle?: VizijBundleExtension | null;
|
|
134
|
+
};
|
|
135
|
+
type RuntimeError = {
|
|
136
|
+
message: string;
|
|
137
|
+
cause?: unknown;
|
|
138
|
+
phase?: "assets" | "orchestrator" | "registration" | "animation" | "bridge" | "driver" | "unknown";
|
|
139
|
+
timestamp: number;
|
|
140
|
+
};
|
|
141
|
+
type VizijRuntimeStatus = {
|
|
142
|
+
loading: boolean;
|
|
143
|
+
ready: boolean;
|
|
144
|
+
error: RuntimeError | null;
|
|
145
|
+
errors: RuntimeError[];
|
|
146
|
+
namespace: string;
|
|
147
|
+
faceId?: string;
|
|
148
|
+
rootId?: string | null;
|
|
149
|
+
/** Namespaced output signal paths emitted by registered graphs. */
|
|
150
|
+
outputPaths: string[];
|
|
151
|
+
/** Approximate current stepping rate in Hz (smoothed). */
|
|
152
|
+
stepHz?: number;
|
|
153
|
+
controllers: {
|
|
154
|
+
graphs: string[];
|
|
155
|
+
anims: string[];
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
type AnimateValueOptions = {
|
|
159
|
+
duration?: number;
|
|
160
|
+
easing?: ((t: number) => number) | "linear" | "easeInOut" | "easeOut" | "easeIn";
|
|
161
|
+
namespace?: string;
|
|
162
|
+
coordinate?: "input" | "renderer";
|
|
163
|
+
};
|
|
164
|
+
type PlayAnimationOptions = {
|
|
165
|
+
weight?: number;
|
|
166
|
+
speed?: number;
|
|
167
|
+
reset?: boolean;
|
|
168
|
+
};
|
|
169
|
+
type StopAnimationOptions = {
|
|
170
|
+
clearOutputs?: boolean;
|
|
171
|
+
};
|
|
172
|
+
type AnimationPlaybackState = {
|
|
173
|
+
time: number;
|
|
174
|
+
duration: number;
|
|
175
|
+
playing: boolean;
|
|
176
|
+
loop: boolean;
|
|
177
|
+
speed: number;
|
|
178
|
+
};
|
|
179
|
+
type StopProgramOptions = {
|
|
180
|
+
resetOutputs?: boolean;
|
|
181
|
+
};
|
|
182
|
+
type ProgramPlaybackState = {
|
|
183
|
+
state: "playing" | "paused" | "stopped";
|
|
184
|
+
};
|
|
185
|
+
type InputDriverLifecycle = {
|
|
186
|
+
start: () => void;
|
|
187
|
+
stop: () => void;
|
|
188
|
+
dispose: () => void;
|
|
189
|
+
};
|
|
190
|
+
type InputDriverContext = {
|
|
191
|
+
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
192
|
+
setRendererValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
193
|
+
namespace: string;
|
|
194
|
+
faceId?: string;
|
|
195
|
+
};
|
|
196
|
+
type InputDriverFactory = (ctx: InputDriverContext) => InputDriverLifecycle;
|
|
197
|
+
type RuntimeOutputWrite = {
|
|
198
|
+
id: string;
|
|
199
|
+
namespace: string;
|
|
200
|
+
value: RawValue;
|
|
201
|
+
currentValue?: RawValue;
|
|
202
|
+
};
|
|
203
|
+
type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
204
|
+
namespaceOverride?: string;
|
|
205
|
+
};
|
|
206
|
+
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
207
|
+
assetBundle: VizijAssetBundle;
|
|
208
|
+
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
209
|
+
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
|
+
tier?: "auto" | "assets" | "graphs";
|
|
211
|
+
}) => void;
|
|
212
|
+
setValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
213
|
+
stagePoseNeutral: (force?: boolean) => void;
|
|
214
|
+
animateValue: (path: string, target: ValueJSON, options?: AnimateValueOptions) => Promise<void>;
|
|
215
|
+
cancelAnimation: (path: string) => void;
|
|
216
|
+
registerInputDriver: (id: string, factory: InputDriverFactory) => InputDriverLifecycle;
|
|
217
|
+
playAnimation: (id: string, options?: PlayAnimationOptions) => Promise<void>;
|
|
218
|
+
pauseAnimation: (id: string) => void;
|
|
219
|
+
seekAnimation: (id: string, timeSeconds: number) => void;
|
|
220
|
+
setAnimationLoop: (id: string, enabled: boolean) => void;
|
|
221
|
+
getAnimationState: (id: string) => AnimationPlaybackState | null;
|
|
222
|
+
stopAnimation: (id: string, options?: StopAnimationOptions) => void;
|
|
223
|
+
playProgram: (id: string) => void;
|
|
224
|
+
pauseProgram: (id: string) => void;
|
|
225
|
+
stopProgram: (id: string, options?: StopProgramOptions) => void;
|
|
226
|
+
getProgramState: (id: string) => ProgramPlaybackState | null;
|
|
227
|
+
setAnimationActive: (active: boolean) => void;
|
|
228
|
+
isAnimationActive: () => boolean;
|
|
229
|
+
step: (dt: number, opts?: {
|
|
230
|
+
forceRuntime?: boolean;
|
|
231
|
+
}) => void;
|
|
232
|
+
advanceAnimations: (dt: number) => void;
|
|
233
|
+
inputConstraints: Record<string, {
|
|
234
|
+
min?: number;
|
|
235
|
+
max?: number;
|
|
236
|
+
defaultValue?: number;
|
|
237
|
+
}>;
|
|
238
|
+
};
|
|
239
|
+
type VizijRuntimeProviderProps = {
|
|
240
|
+
assetBundle: VizijAssetBundle;
|
|
241
|
+
children: ReactNode;
|
|
242
|
+
namespace?: string;
|
|
243
|
+
faceId?: string;
|
|
244
|
+
updateTier?: RuntimeUpdateTier;
|
|
245
|
+
autoCreate?: boolean;
|
|
246
|
+
createOptions?: CreateOrchOptions;
|
|
247
|
+
autostart?: boolean;
|
|
248
|
+
driveOrchestrator?: boolean;
|
|
249
|
+
mergeStrategy?: MergeStrategyOptions;
|
|
250
|
+
onRegisterControllers?: (ids: {
|
|
251
|
+
graphs: string[];
|
|
252
|
+
anims: string[];
|
|
253
|
+
}) => void;
|
|
254
|
+
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
|
+
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
256
|
+
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
257
|
+
};
|
|
258
|
+
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
|
+
type RuntimeUpdatePlan = {
|
|
260
|
+
reloadAssets: boolean;
|
|
261
|
+
reregisterGraphs: boolean;
|
|
262
|
+
};
|
|
263
|
+
type RuntimeGraphBundle = {
|
|
264
|
+
rig?: VizijGraphAsset;
|
|
265
|
+
pose?: VizijAssetBundle["pose"];
|
|
266
|
+
animations?: VizijAnimationAsset[];
|
|
267
|
+
programs?: VizijProgramAsset[];
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
271
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
272
|
+
|
|
273
|
+
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
274
|
+
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
|
275
|
+
|
|
276
|
+
declare function useVizijRuntime(): VizijRuntimeContextValue;
|
|
277
|
+
|
|
278
|
+
declare function useOptionalVizijRuntime(): VizijRuntimeContextValue | null;
|
|
279
|
+
|
|
280
|
+
declare function useVizijOutputs(paths: string[]): Record<string, RawValue | undefined>;
|
|
281
|
+
|
|
282
|
+
declare function useRigInput(path: string): [RawValue | undefined, (value: ValueJSON, shape?: ShapeJSON) => void];
|
|
283
|
+
|
|
284
|
+
declare function resolveRuntimeUpdatePlan(previous: VizijAssetBundle | null, next: VizijAssetBundle, tier: RuntimeUpdateTier): RuntimeUpdatePlan;
|
|
285
|
+
|
|
286
|
+
declare const POSE_WEIGHT_INPUT_PATH_PREFIX = "/poses/";
|
|
287
|
+
declare const VISEME_POSE_KEYS: readonly ["a", "at", "b", "e", "e_2", "f", "i", "k", "m", "o", "o_2", "p", "r", "s", "t", "t_2", "u"];
|
|
288
|
+
declare const EXPRESSIVE_EMOTION_POSE_KEYS: readonly ["concerned", "happy", "sad", "sleepy", "surprise"];
|
|
289
|
+
declare const EMOTION_POSE_KEYS: readonly ["concerned", "happy", "neutral", "sad", "sleepy", "surprise", "angry"];
|
|
290
|
+
type PoseSemanticKind = "emotion" | "viseme" | "other";
|
|
291
|
+
declare function buildRigInputPath(faceId: string, path: string): string;
|
|
292
|
+
declare function buildPoseWeightInputPathSegment(poseId: string | null | undefined): string;
|
|
293
|
+
declare function buildPoseWeightRelativePath(poseId: string | null | undefined): string;
|
|
294
|
+
declare function buildPoseWeightPathMap(poses: PoseDefinition[], faceId: string | null | undefined): Map<string, string>;
|
|
295
|
+
declare function normalizePoseSemanticKey(value: string | null | undefined): string | null;
|
|
296
|
+
declare function getPoseSemanticKey(pose: Pick<PoseDefinition, "id" | "name">): string | null;
|
|
297
|
+
declare function resolvePoseMembership(pose: Pick<PoseDefinition, "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
298
|
+
groupIds: string[];
|
|
299
|
+
primaryGroupId: string | null;
|
|
300
|
+
primaryGroupPath: string | null;
|
|
301
|
+
groupPathsById: Record<string, string>;
|
|
302
|
+
};
|
|
303
|
+
declare function resolvePoseSemantics(pose: Pick<PoseDefinition, "id" | "name" | "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
304
|
+
key: string | null;
|
|
305
|
+
kind: PoseSemanticKind;
|
|
306
|
+
membership: ReturnType<typeof resolvePoseMembership>;
|
|
307
|
+
};
|
|
308
|
+
declare function filterPosesBySemanticKind(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, kind: PoseSemanticKind): PoseDefinition[];
|
|
309
|
+
declare function buildSemanticPoseWeightPathMap(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, faceId: string | null | undefined, kind: Exclude<PoseSemanticKind, "other">): Map<string, string>;
|
|
310
|
+
|
|
311
|
+
type InputConstraint = {
|
|
312
|
+
min?: number;
|
|
313
|
+
max?: number;
|
|
314
|
+
defaultValue?: number;
|
|
315
|
+
};
|
|
316
|
+
type FaceScalarControl = {
|
|
317
|
+
path: string;
|
|
318
|
+
min: number;
|
|
319
|
+
max: number;
|
|
320
|
+
defaultValue: number;
|
|
321
|
+
};
|
|
322
|
+
type ResolvedFaceControls = {
|
|
323
|
+
faceId: string;
|
|
324
|
+
gazeSource: "standard-vizij" | "standard" | "propsrig" | "coupled-gaze" | "none";
|
|
325
|
+
blinkSource: "lids" | "blink" | "none";
|
|
326
|
+
eyes: {
|
|
327
|
+
leftX: FaceScalarControl | null;
|
|
328
|
+
leftY: FaceScalarControl | null;
|
|
329
|
+
rightX: FaceScalarControl | null;
|
|
330
|
+
rightY: FaceScalarControl | null;
|
|
331
|
+
};
|
|
332
|
+
eyelids: {
|
|
333
|
+
leftUpper: FaceScalarControl | null;
|
|
334
|
+
rightUpper: FaceScalarControl | null;
|
|
335
|
+
};
|
|
336
|
+
blink: FaceScalarControl | null;
|
|
337
|
+
};
|
|
338
|
+
declare function resolveFaceControls(assetBundle: VizijAssetBundle, runtimeFaceId?: string | null, inputConstraints?: Record<string, InputConstraint>): ResolvedFaceControls;
|
|
339
|
+
declare function mapNormalizedControlValue(control: FaceScalarControl, normalizedValue: number): number;
|
|
340
|
+
declare function mapUnitControlValue(control: FaceScalarControl, unitValue: number): number;
|
|
341
|
+
|
|
342
|
+
export { type AnimateValueOptions, type AnimationClipLike, type AnimationKeyframeLike, type AnimationPlaybackState, type AnimationTrackLike, EMOTION_POSE_KEYS, EXPRESSIVE_EMOTION_POSE_KEYS, type FaceScalarControl, type InputDriverContext, type InputDriverFactory, type InputDriverLifecycle, POSE_WEIGHT_INPUT_PATH_PREFIX, type PlayAnimationOptions, type PoseDefinition, type PoseGroupDefinition, type PoseRigConfig, type ProgramPlaybackState, type RootBounds, type RuntimeGraphBundle, type RuntimeOutputWrite, type RuntimeUpdatePlan, type RuntimeUpdateTier, type StopProgramOptions, VISEME_POSE_KEYS, type VizijAnimationAsset, type VizijAssetBundle, type VizijGlbAsset, type VizijGraphAsset, type VizijProgramAsset, VizijRuntimeFace, type VizijRuntimeFaceProps, VizijRuntimeProvider, type VizijRuntimeProviderProps, type VizijRuntimeStatus, buildPoseWeightInputPathSegment, buildPoseWeightPathMap, buildPoseWeightRelativePath, buildRigInputPath, buildSemanticPoseWeightPathMap, filterPosesBySemanticKind, getPoseSemanticKey, mapNormalizedControlValue, mapUnitControlValue, normalizePoseSemanticKey, resolveFaceControls, resolvePoseMembership, resolvePoseSemantics, resolveRuntimeUpdatePlan, useOptionalVizijRuntime, useRigInput, useVizijOutputs, useVizijRuntime };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, PropsWithChildren } from 'react';
|
|
4
4
|
import { GraphRegistrationConfig, GraphSubscriptions, AnimationSetup, ValueJSON, CreateOrchOptions, MergeStrategyOptions, ShapeJSON } from '@vizij/orchestrator-react';
|
|
5
|
+
import { IrGraph } from '@vizij/node-graph-authoring';
|
|
5
6
|
import { AnimatableValue, RawValue } from '@vizij/utils';
|
|
6
7
|
import { World, VizijBundleExtension, VizijProps } from '@vizij/render';
|
|
7
8
|
|
|
@@ -9,17 +10,32 @@ type PoseDefinition = {
|
|
|
9
10
|
id: string;
|
|
10
11
|
name?: string;
|
|
11
12
|
description?: string;
|
|
13
|
+
group?: string | null;
|
|
14
|
+
groupId?: string | null;
|
|
15
|
+
groupIds?: string[];
|
|
12
16
|
values: Record<string, number | undefined>;
|
|
13
17
|
};
|
|
18
|
+
type PoseBlendMode = "average" | "additive";
|
|
19
|
+
type PoseGroupDefinition = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
blendMode?: PoseBlendMode;
|
|
24
|
+
};
|
|
14
25
|
type PoseRigConfig = {
|
|
15
26
|
version: number;
|
|
16
27
|
faceId?: string | null;
|
|
17
28
|
title?: string;
|
|
18
29
|
description?: string;
|
|
30
|
+
poseGroups?: PoseGroupDefinition[];
|
|
31
|
+
crossGroupBlendMode?: PoseBlendMode;
|
|
19
32
|
neutralInputs: Record<string, number>;
|
|
20
33
|
poses: PoseDefinition[];
|
|
21
|
-
metadata?: Record<string, unknown
|
|
22
|
-
|
|
34
|
+
metadata?: Record<string, unknown> | {
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
};
|
|
23
39
|
};
|
|
24
40
|
type RootBounds = {
|
|
25
41
|
center: {
|
|
@@ -43,22 +59,42 @@ type VizijGlbAsset = {
|
|
|
43
59
|
rootBounds?: RootBounds;
|
|
44
60
|
} | {
|
|
45
61
|
kind: "world";
|
|
46
|
-
world: World
|
|
47
|
-
animatables: Record<string, AnimatableValue>;
|
|
62
|
+
world: World | Record<string, unknown>;
|
|
63
|
+
animatables: Record<string, AnimatableValue> | Record<string, unknown>;
|
|
48
64
|
bundle?: VizijBundleExtension | null;
|
|
49
65
|
};
|
|
50
66
|
type VizijGraphAsset = {
|
|
51
67
|
id: string;
|
|
52
|
-
spec
|
|
68
|
+
spec?: GraphRegistrationConfig["spec"];
|
|
69
|
+
ir?: IrGraph | null;
|
|
53
70
|
subscriptions?: Partial<GraphSubscriptions>;
|
|
71
|
+
inputMetadata?: VizijInputMetadata[];
|
|
72
|
+
};
|
|
73
|
+
type VizijInputMetadata = {
|
|
74
|
+
id?: string;
|
|
75
|
+
path: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
source?: string;
|
|
78
|
+
root?: string;
|
|
79
|
+
defaultValue?: number;
|
|
80
|
+
range?: {
|
|
81
|
+
min?: number;
|
|
82
|
+
max?: number;
|
|
83
|
+
};
|
|
84
|
+
[key: string]: unknown;
|
|
54
85
|
};
|
|
55
86
|
type AnimationKeyframeLike = {
|
|
56
87
|
time?: number;
|
|
57
88
|
value?: number;
|
|
89
|
+
inTangent?: number | null;
|
|
90
|
+
outTangent?: number | null;
|
|
91
|
+
[key: string]: unknown;
|
|
58
92
|
};
|
|
59
93
|
type AnimationTrackLike = {
|
|
60
94
|
channel: string;
|
|
61
95
|
keyframes?: AnimationKeyframeLike[];
|
|
96
|
+
interpolation?: "linear" | "step" | "cubic" | string;
|
|
97
|
+
[key: string]: unknown;
|
|
62
98
|
};
|
|
63
99
|
type AnimationClipLike = {
|
|
64
100
|
id?: string;
|
|
@@ -73,6 +109,13 @@ type VizijAnimationAsset = {
|
|
|
73
109
|
setup?: Partial<AnimationSetup>;
|
|
74
110
|
weight?: number;
|
|
75
111
|
};
|
|
112
|
+
type VizijProgramAsset = {
|
|
113
|
+
id: string;
|
|
114
|
+
label?: string;
|
|
115
|
+
graph: VizijGraphAsset;
|
|
116
|
+
resetValues?: Record<string, number>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
};
|
|
76
119
|
type VizijAssetBundle = {
|
|
77
120
|
namespace?: string;
|
|
78
121
|
faceId?: string;
|
|
@@ -84,6 +127,7 @@ type VizijAssetBundle = {
|
|
|
84
127
|
stageNeutralFilter?: (id: string, path: string) => boolean;
|
|
85
128
|
};
|
|
86
129
|
animations?: VizijAnimationAsset[];
|
|
130
|
+
programs?: VizijProgramAsset[];
|
|
87
131
|
initialInputs?: Record<string, ValueJSON>;
|
|
88
132
|
metadata?: Record<string, unknown>;
|
|
89
133
|
bundle?: VizijBundleExtension | null;
|
|
@@ -102,7 +146,10 @@ type VizijRuntimeStatus = {
|
|
|
102
146
|
namespace: string;
|
|
103
147
|
faceId?: string;
|
|
104
148
|
rootId?: string | null;
|
|
149
|
+
/** Namespaced output signal paths emitted by registered graphs. */
|
|
105
150
|
outputPaths: string[];
|
|
151
|
+
/** Approximate current stepping rate in Hz (smoothed). */
|
|
152
|
+
stepHz?: number;
|
|
106
153
|
controllers: {
|
|
107
154
|
graphs: string[];
|
|
108
155
|
anims: string[];
|
|
@@ -119,6 +166,22 @@ type PlayAnimationOptions = {
|
|
|
119
166
|
speed?: number;
|
|
120
167
|
reset?: boolean;
|
|
121
168
|
};
|
|
169
|
+
type StopAnimationOptions = {
|
|
170
|
+
clearOutputs?: boolean;
|
|
171
|
+
};
|
|
172
|
+
type AnimationPlaybackState = {
|
|
173
|
+
time: number;
|
|
174
|
+
duration: number;
|
|
175
|
+
playing: boolean;
|
|
176
|
+
loop: boolean;
|
|
177
|
+
speed: number;
|
|
178
|
+
};
|
|
179
|
+
type StopProgramOptions = {
|
|
180
|
+
resetOutputs?: boolean;
|
|
181
|
+
};
|
|
182
|
+
type ProgramPlaybackState = {
|
|
183
|
+
state: "playing" | "paused" | "stopped";
|
|
184
|
+
};
|
|
122
185
|
type InputDriverLifecycle = {
|
|
123
186
|
start: () => void;
|
|
124
187
|
stop: () => void;
|
|
@@ -131,48 +194,149 @@ type InputDriverContext = {
|
|
|
131
194
|
faceId?: string;
|
|
132
195
|
};
|
|
133
196
|
type InputDriverFactory = (ctx: InputDriverContext) => InputDriverLifecycle;
|
|
197
|
+
type RuntimeOutputWrite = {
|
|
198
|
+
id: string;
|
|
199
|
+
namespace: string;
|
|
200
|
+
value: RawValue;
|
|
201
|
+
currentValue?: RawValue;
|
|
202
|
+
};
|
|
134
203
|
type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
135
204
|
namespaceOverride?: string;
|
|
136
205
|
};
|
|
137
206
|
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
138
207
|
assetBundle: VizijAssetBundle;
|
|
139
208
|
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
209
|
+
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
|
+
tier?: "auto" | "assets" | "graphs";
|
|
211
|
+
}) => void;
|
|
140
212
|
setValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
141
213
|
stagePoseNeutral: (force?: boolean) => void;
|
|
142
214
|
animateValue: (path: string, target: ValueJSON, options?: AnimateValueOptions) => Promise<void>;
|
|
143
215
|
cancelAnimation: (path: string) => void;
|
|
144
216
|
registerInputDriver: (id: string, factory: InputDriverFactory) => InputDriverLifecycle;
|
|
145
217
|
playAnimation: (id: string, options?: PlayAnimationOptions) => Promise<void>;
|
|
146
|
-
|
|
147
|
-
|
|
218
|
+
pauseAnimation: (id: string) => void;
|
|
219
|
+
seekAnimation: (id: string, timeSeconds: number) => void;
|
|
220
|
+
setAnimationLoop: (id: string, enabled: boolean) => void;
|
|
221
|
+
getAnimationState: (id: string) => AnimationPlaybackState | null;
|
|
222
|
+
stopAnimation: (id: string, options?: StopAnimationOptions) => void;
|
|
223
|
+
playProgram: (id: string) => void;
|
|
224
|
+
pauseProgram: (id: string) => void;
|
|
225
|
+
stopProgram: (id: string, options?: StopProgramOptions) => void;
|
|
226
|
+
getProgramState: (id: string) => ProgramPlaybackState | null;
|
|
227
|
+
setAnimationActive: (active: boolean) => void;
|
|
228
|
+
isAnimationActive: () => boolean;
|
|
229
|
+
step: (dt: number, opts?: {
|
|
230
|
+
forceRuntime?: boolean;
|
|
231
|
+
}) => void;
|
|
148
232
|
advanceAnimations: (dt: number) => void;
|
|
233
|
+
inputConstraints: Record<string, {
|
|
234
|
+
min?: number;
|
|
235
|
+
max?: number;
|
|
236
|
+
defaultValue?: number;
|
|
237
|
+
}>;
|
|
149
238
|
};
|
|
150
239
|
type VizijRuntimeProviderProps = {
|
|
151
240
|
assetBundle: VizijAssetBundle;
|
|
152
241
|
children: ReactNode;
|
|
153
242
|
namespace?: string;
|
|
154
243
|
faceId?: string;
|
|
244
|
+
updateTier?: RuntimeUpdateTier;
|
|
155
245
|
autoCreate?: boolean;
|
|
156
246
|
createOptions?: CreateOrchOptions;
|
|
157
247
|
autostart?: boolean;
|
|
248
|
+
driveOrchestrator?: boolean;
|
|
158
249
|
mergeStrategy?: MergeStrategyOptions;
|
|
159
250
|
onRegisterControllers?: (ids: {
|
|
160
251
|
graphs: string[];
|
|
161
252
|
anims: string[];
|
|
162
253
|
}) => void;
|
|
163
254
|
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
|
+
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
256
|
+
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
257
|
+
};
|
|
258
|
+
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
|
+
type RuntimeUpdatePlan = {
|
|
260
|
+
reloadAssets: boolean;
|
|
261
|
+
reregisterGraphs: boolean;
|
|
262
|
+
};
|
|
263
|
+
type RuntimeGraphBundle = {
|
|
264
|
+
rig?: VizijGraphAsset;
|
|
265
|
+
pose?: VizijAssetBundle["pose"];
|
|
266
|
+
animations?: VizijAnimationAsset[];
|
|
267
|
+
programs?: VizijProgramAsset[];
|
|
164
268
|
};
|
|
165
269
|
|
|
166
270
|
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
167
|
-
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, autoCreate, createOptions, autostart, mergeStrategy, onRegisterControllers, onStatusChange, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
271
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
168
272
|
|
|
169
273
|
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
170
274
|
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
|
171
275
|
|
|
172
276
|
declare function useVizijRuntime(): VizijRuntimeContextValue;
|
|
173
277
|
|
|
278
|
+
declare function useOptionalVizijRuntime(): VizijRuntimeContextValue | null;
|
|
279
|
+
|
|
174
280
|
declare function useVizijOutputs(paths: string[]): Record<string, RawValue | undefined>;
|
|
175
281
|
|
|
176
282
|
declare function useRigInput(path: string): [RawValue | undefined, (value: ValueJSON, shape?: ShapeJSON) => void];
|
|
177
283
|
|
|
178
|
-
|
|
284
|
+
declare function resolveRuntimeUpdatePlan(previous: VizijAssetBundle | null, next: VizijAssetBundle, tier: RuntimeUpdateTier): RuntimeUpdatePlan;
|
|
285
|
+
|
|
286
|
+
declare const POSE_WEIGHT_INPUT_PATH_PREFIX = "/poses/";
|
|
287
|
+
declare const VISEME_POSE_KEYS: readonly ["a", "at", "b", "e", "e_2", "f", "i", "k", "m", "o", "o_2", "p", "r", "s", "t", "t_2", "u"];
|
|
288
|
+
declare const EXPRESSIVE_EMOTION_POSE_KEYS: readonly ["concerned", "happy", "sad", "sleepy", "surprise"];
|
|
289
|
+
declare const EMOTION_POSE_KEYS: readonly ["concerned", "happy", "neutral", "sad", "sleepy", "surprise", "angry"];
|
|
290
|
+
type PoseSemanticKind = "emotion" | "viseme" | "other";
|
|
291
|
+
declare function buildRigInputPath(faceId: string, path: string): string;
|
|
292
|
+
declare function buildPoseWeightInputPathSegment(poseId: string | null | undefined): string;
|
|
293
|
+
declare function buildPoseWeightRelativePath(poseId: string | null | undefined): string;
|
|
294
|
+
declare function buildPoseWeightPathMap(poses: PoseDefinition[], faceId: string | null | undefined): Map<string, string>;
|
|
295
|
+
declare function normalizePoseSemanticKey(value: string | null | undefined): string | null;
|
|
296
|
+
declare function getPoseSemanticKey(pose: Pick<PoseDefinition, "id" | "name">): string | null;
|
|
297
|
+
declare function resolvePoseMembership(pose: Pick<PoseDefinition, "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
298
|
+
groupIds: string[];
|
|
299
|
+
primaryGroupId: string | null;
|
|
300
|
+
primaryGroupPath: string | null;
|
|
301
|
+
groupPathsById: Record<string, string>;
|
|
302
|
+
};
|
|
303
|
+
declare function resolvePoseSemantics(pose: Pick<PoseDefinition, "id" | "name" | "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
304
|
+
key: string | null;
|
|
305
|
+
kind: PoseSemanticKind;
|
|
306
|
+
membership: ReturnType<typeof resolvePoseMembership>;
|
|
307
|
+
};
|
|
308
|
+
declare function filterPosesBySemanticKind(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, kind: PoseSemanticKind): PoseDefinition[];
|
|
309
|
+
declare function buildSemanticPoseWeightPathMap(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, faceId: string | null | undefined, kind: Exclude<PoseSemanticKind, "other">): Map<string, string>;
|
|
310
|
+
|
|
311
|
+
type InputConstraint = {
|
|
312
|
+
min?: number;
|
|
313
|
+
max?: number;
|
|
314
|
+
defaultValue?: number;
|
|
315
|
+
};
|
|
316
|
+
type FaceScalarControl = {
|
|
317
|
+
path: string;
|
|
318
|
+
min: number;
|
|
319
|
+
max: number;
|
|
320
|
+
defaultValue: number;
|
|
321
|
+
};
|
|
322
|
+
type ResolvedFaceControls = {
|
|
323
|
+
faceId: string;
|
|
324
|
+
gazeSource: "standard-vizij" | "standard" | "propsrig" | "coupled-gaze" | "none";
|
|
325
|
+
blinkSource: "lids" | "blink" | "none";
|
|
326
|
+
eyes: {
|
|
327
|
+
leftX: FaceScalarControl | null;
|
|
328
|
+
leftY: FaceScalarControl | null;
|
|
329
|
+
rightX: FaceScalarControl | null;
|
|
330
|
+
rightY: FaceScalarControl | null;
|
|
331
|
+
};
|
|
332
|
+
eyelids: {
|
|
333
|
+
leftUpper: FaceScalarControl | null;
|
|
334
|
+
rightUpper: FaceScalarControl | null;
|
|
335
|
+
};
|
|
336
|
+
blink: FaceScalarControl | null;
|
|
337
|
+
};
|
|
338
|
+
declare function resolveFaceControls(assetBundle: VizijAssetBundle, runtimeFaceId?: string | null, inputConstraints?: Record<string, InputConstraint>): ResolvedFaceControls;
|
|
339
|
+
declare function mapNormalizedControlValue(control: FaceScalarControl, normalizedValue: number): number;
|
|
340
|
+
declare function mapUnitControlValue(control: FaceScalarControl, unitValue: number): number;
|
|
341
|
+
|
|
342
|
+
export { type AnimateValueOptions, type AnimationClipLike, type AnimationKeyframeLike, type AnimationPlaybackState, type AnimationTrackLike, EMOTION_POSE_KEYS, EXPRESSIVE_EMOTION_POSE_KEYS, type FaceScalarControl, type InputDriverContext, type InputDriverFactory, type InputDriverLifecycle, POSE_WEIGHT_INPUT_PATH_PREFIX, type PlayAnimationOptions, type PoseDefinition, type PoseGroupDefinition, type PoseRigConfig, type ProgramPlaybackState, type RootBounds, type RuntimeGraphBundle, type RuntimeOutputWrite, type RuntimeUpdatePlan, type RuntimeUpdateTier, type StopProgramOptions, VISEME_POSE_KEYS, type VizijAnimationAsset, type VizijAssetBundle, type VizijGlbAsset, type VizijGraphAsset, type VizijProgramAsset, VizijRuntimeFace, type VizijRuntimeFaceProps, VizijRuntimeProvider, type VizijRuntimeProviderProps, type VizijRuntimeStatus, buildPoseWeightInputPathSegment, buildPoseWeightPathMap, buildPoseWeightRelativePath, buildRigInputPath, buildSemanticPoseWeightPathMap, filterPosesBySemanticKind, getPoseSemanticKey, mapNormalizedControlValue, mapUnitControlValue, normalizePoseSemanticKey, resolveFaceControls, resolvePoseMembership, resolvePoseSemantics, resolveRuntimeUpdatePlan, useOptionalVizijRuntime, useRigInput, useVizijOutputs, useVizijRuntime };
|