@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/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizij/runtime-react",
|
|
3
3
|
"description": "Runtime provider that bridges Vizij renderer assets with orchestrator controllers for React apps.",
|
|
4
|
-
"version": "0.0
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"module": "dist/index.
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.
|
|
13
|
-
"require": "./dist/index.
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@vizij/
|
|
28
|
-
"@vizij/
|
|
29
|
-
"@vizij/
|
|
27
|
+
"@vizij/node-graph-authoring": "0.1.1",
|
|
28
|
+
"@vizij/orchestrator-react": "0.1.1",
|
|
29
|
+
"@vizij/render": "0.1.1",
|
|
30
|
+
"@vizij/utils": "0.1.0",
|
|
30
31
|
"@vizij/value-json": "^0.1.2"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
@@ -34,9 +35,11 @@
|
|
|
34
35
|
"react-dom": ">=18"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@types/react": "^
|
|
38
|
-
"@types/react-dom": "^
|
|
38
|
+
"@types/react": "^19.2.7",
|
|
39
|
+
"@types/react-dom": "^19.2.3",
|
|
39
40
|
"prettier": "^3.4.2",
|
|
41
|
+
"react": "^19.2.3",
|
|
42
|
+
"react-dom": "^19.2.3",
|
|
40
43
|
"tsup": "^8.0.1",
|
|
41
44
|
"typescript": "^5.5.0",
|
|
42
45
|
"vitest": "^3.2.4"
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
"publishConfig": {
|
|
45
48
|
"access": "public"
|
|
46
49
|
},
|
|
50
|
+
"type": "module",
|
|
47
51
|
"scripts": {
|
|
48
52
|
"build": "tsup src/index.ts --format esm,cjs --dts src/index.ts --external react,react-dom",
|
|
49
53
|
"dev": "tsup src/index.ts --format esm,cjs --watch --dts src/index.ts --external react,react-dom",
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"lint:fix": "pnpm --filter \"$npm_package_name\" exec eslint --ext .js,.jsx,.ts,.tsx --fix -- .",
|
|
53
57
|
"prettier:check": "prettier --check .",
|
|
54
58
|
"prettier:write": "prettier --write .",
|
|
55
|
-
"test": "vitest --run --passWithNoTests",
|
|
59
|
+
"test": "NODE_ENV=test vitest --run --passWithNoTests",
|
|
56
60
|
"clean": "rm -rf dist .turbo coverage tsconfig.tsbuildinfo",
|
|
57
61
|
"reset": "rm -rf node_modules",
|
|
58
62
|
"reset:hard": "pnpm run reset && rm -f pnpm-lock.yaml package-lock.json yarn.lock"
|
package/dist/index.d.mts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
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 { AnimatableValue, RawValue } from '@vizij/utils';
|
|
6
|
-
import { World, VizijBundleExtension, VizijProps } from '@vizij/render';
|
|
7
|
-
|
|
8
|
-
type PoseDefinition = {
|
|
9
|
-
id: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
values: Record<string, number | undefined>;
|
|
13
|
-
};
|
|
14
|
-
type PoseRigConfig = {
|
|
15
|
-
version: number;
|
|
16
|
-
faceId?: string | null;
|
|
17
|
-
title?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
neutralInputs: Record<string, number>;
|
|
20
|
-
poses: PoseDefinition[];
|
|
21
|
-
metadata?: Record<string, unknown>;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
type RootBounds = {
|
|
25
|
-
center: {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
};
|
|
29
|
-
size: {
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
type VizijGlbAsset = {
|
|
35
|
-
kind: "url";
|
|
36
|
-
src: string;
|
|
37
|
-
aggressiveImport?: boolean;
|
|
38
|
-
rootBounds?: RootBounds;
|
|
39
|
-
} | {
|
|
40
|
-
kind: "blob";
|
|
41
|
-
blob: Blob;
|
|
42
|
-
aggressiveImport?: boolean;
|
|
43
|
-
rootBounds?: RootBounds;
|
|
44
|
-
} | {
|
|
45
|
-
kind: "world";
|
|
46
|
-
world: World;
|
|
47
|
-
animatables: Record<string, AnimatableValue>;
|
|
48
|
-
bundle?: VizijBundleExtension | null;
|
|
49
|
-
};
|
|
50
|
-
type VizijGraphAsset = {
|
|
51
|
-
id: string;
|
|
52
|
-
spec: GraphRegistrationConfig["spec"];
|
|
53
|
-
subscriptions?: Partial<GraphSubscriptions>;
|
|
54
|
-
};
|
|
55
|
-
type AnimationKeyframeLike = {
|
|
56
|
-
time?: number;
|
|
57
|
-
value?: number;
|
|
58
|
-
};
|
|
59
|
-
type AnimationTrackLike = {
|
|
60
|
-
channel: string;
|
|
61
|
-
keyframes?: AnimationKeyframeLike[];
|
|
62
|
-
};
|
|
63
|
-
type AnimationClipLike = {
|
|
64
|
-
id?: string;
|
|
65
|
-
name?: string;
|
|
66
|
-
duration?: number;
|
|
67
|
-
tracks?: AnimationTrackLike[];
|
|
68
|
-
[key: string]: unknown;
|
|
69
|
-
};
|
|
70
|
-
type VizijAnimationAsset = {
|
|
71
|
-
id: string;
|
|
72
|
-
clip: AnimationClipLike;
|
|
73
|
-
setup?: Partial<AnimationSetup>;
|
|
74
|
-
weight?: number;
|
|
75
|
-
};
|
|
76
|
-
type VizijAssetBundle = {
|
|
77
|
-
namespace?: string;
|
|
78
|
-
faceId?: string;
|
|
79
|
-
glb: VizijGlbAsset;
|
|
80
|
-
rig?: VizijGraphAsset;
|
|
81
|
-
pose?: {
|
|
82
|
-
graph?: VizijGraphAsset;
|
|
83
|
-
config?: PoseRigConfig;
|
|
84
|
-
stageNeutralFilter?: (id: string, path: string) => boolean;
|
|
85
|
-
};
|
|
86
|
-
animations?: VizijAnimationAsset[];
|
|
87
|
-
initialInputs?: Record<string, ValueJSON>;
|
|
88
|
-
metadata?: Record<string, unknown>;
|
|
89
|
-
bundle?: VizijBundleExtension | null;
|
|
90
|
-
};
|
|
91
|
-
type RuntimeError = {
|
|
92
|
-
message: string;
|
|
93
|
-
cause?: unknown;
|
|
94
|
-
phase?: "assets" | "orchestrator" | "registration" | "animation" | "bridge" | "driver" | "unknown";
|
|
95
|
-
timestamp: number;
|
|
96
|
-
};
|
|
97
|
-
type VizijRuntimeStatus = {
|
|
98
|
-
loading: boolean;
|
|
99
|
-
ready: boolean;
|
|
100
|
-
error: RuntimeError | null;
|
|
101
|
-
errors: RuntimeError[];
|
|
102
|
-
namespace: string;
|
|
103
|
-
faceId?: string;
|
|
104
|
-
rootId?: string | null;
|
|
105
|
-
outputPaths: string[];
|
|
106
|
-
controllers: {
|
|
107
|
-
graphs: string[];
|
|
108
|
-
anims: string[];
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
type AnimateValueOptions = {
|
|
112
|
-
duration?: number;
|
|
113
|
-
easing?: ((t: number) => number) | "linear" | "easeInOut" | "easeOut" | "easeIn";
|
|
114
|
-
namespace?: string;
|
|
115
|
-
coordinate?: "input" | "renderer";
|
|
116
|
-
};
|
|
117
|
-
type PlayAnimationOptions = {
|
|
118
|
-
weight?: number;
|
|
119
|
-
speed?: number;
|
|
120
|
-
reset?: boolean;
|
|
121
|
-
};
|
|
122
|
-
type InputDriverLifecycle = {
|
|
123
|
-
start: () => void;
|
|
124
|
-
stop: () => void;
|
|
125
|
-
dispose: () => void;
|
|
126
|
-
};
|
|
127
|
-
type InputDriverContext = {
|
|
128
|
-
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
129
|
-
setRendererValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
130
|
-
namespace: string;
|
|
131
|
-
faceId?: string;
|
|
132
|
-
};
|
|
133
|
-
type InputDriverFactory = (ctx: InputDriverContext) => InputDriverLifecycle;
|
|
134
|
-
type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
135
|
-
namespaceOverride?: string;
|
|
136
|
-
};
|
|
137
|
-
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
138
|
-
assetBundle: VizijAssetBundle;
|
|
139
|
-
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
140
|
-
setValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
141
|
-
stagePoseNeutral: (force?: boolean) => void;
|
|
142
|
-
animateValue: (path: string, target: ValueJSON, options?: AnimateValueOptions) => Promise<void>;
|
|
143
|
-
cancelAnimation: (path: string) => void;
|
|
144
|
-
registerInputDriver: (id: string, factory: InputDriverFactory) => InputDriverLifecycle;
|
|
145
|
-
playAnimation: (id: string, options?: PlayAnimationOptions) => Promise<void>;
|
|
146
|
-
stopAnimation: (id: string) => void;
|
|
147
|
-
step: (dt: number) => void;
|
|
148
|
-
advanceAnimations: (dt: number) => void;
|
|
149
|
-
};
|
|
150
|
-
type VizijRuntimeProviderProps = {
|
|
151
|
-
assetBundle: VizijAssetBundle;
|
|
152
|
-
children: ReactNode;
|
|
153
|
-
namespace?: string;
|
|
154
|
-
faceId?: string;
|
|
155
|
-
autoCreate?: boolean;
|
|
156
|
-
createOptions?: CreateOrchOptions;
|
|
157
|
-
autostart?: boolean;
|
|
158
|
-
mergeStrategy?: MergeStrategyOptions;
|
|
159
|
-
onRegisterControllers?: (ids: {
|
|
160
|
-
graphs: string[];
|
|
161
|
-
anims: string[];
|
|
162
|
-
}) => void;
|
|
163
|
-
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
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;
|
|
168
|
-
|
|
169
|
-
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
170
|
-
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
|
171
|
-
|
|
172
|
-
declare function useVizijRuntime(): VizijRuntimeContextValue;
|
|
173
|
-
|
|
174
|
-
declare function useVizijOutputs(paths: string[]): Record<string, RawValue | undefined>;
|
|
175
|
-
|
|
176
|
-
declare function useRigInput(path: string): [RawValue | undefined, (value: ValueJSON, shape?: ShapeJSON) => void];
|
|
177
|
-
|
|
178
|
-
export { type AnimateValueOptions, type AnimationClipLike, type AnimationKeyframeLike, type AnimationTrackLike, type InputDriverContext, type InputDriverFactory, type InputDriverLifecycle, type PlayAnimationOptions, type PoseDefinition, type PoseRigConfig, type RootBounds, type VizijAnimationAsset, type VizijAssetBundle, type VizijGlbAsset, type VizijGraphAsset, VizijRuntimeFace, type VizijRuntimeFaceProps, VizijRuntimeProvider, type VizijRuntimeProviderProps, type VizijRuntimeStatus, useRigInput, useVizijOutputs, useVizijRuntime };
|