@vizij/animation-react 0.0.3 → 0.0.7

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 CHANGED
@@ -46,6 +46,27 @@ yarn add @vizij/animation-react @vizij/animation-wasm react react-dom
46
46
 
47
47
  During local development with linked WASM packages, ensure your bundler preserves symlinks and excludes `@vizij/animation-wasm` from pre-bundling (see the [`vizij-web` README](../../README.md#local-wasm-development) for a Vite example).
48
48
 
49
+ > **Bundler note:** `@vizij/animation-react` depends on `@vizij/animation-wasm`, which emits a `.wasm` artefact. Enable async WebAssembly and treat `.wasm` files as emitted assets in your bundler. For Next.js:
50
+ >
51
+ > ```js
52
+ > // next.config.js
53
+ > module.exports = {
54
+ > webpack: (config) => {
55
+ > config.experiments = {
56
+ > ...(config.experiments ?? {}),
57
+ > asyncWebAssembly: true,
58
+ > };
59
+ > config.module.rules.push({
60
+ > test: /\.wasm$/,
61
+ > type: "asset/resource",
62
+ > });
63
+ > return config;
64
+ > },
65
+ > };
66
+ > ```
67
+ >
68
+ > When overriding the wasm location, call `init("https://.../vizij_animation_wasm_bg.wasm")` with a string URL so Webpack does not wrap it in `RelativeURL`.
69
+
49
70
  ---
50
71
 
51
72
  ## Peer Dependencies
package/dist/index.cjs CHANGED
@@ -220,7 +220,8 @@ function AnimationProvider({
220
220
  autostart = true,
221
221
  updateHz,
222
222
  engineConfig,
223
- onOutputs
223
+ onOutputs,
224
+ wasmInitInput
224
225
  }) {
225
226
  const engineRef = (0, import_react2.useRef)(null);
226
227
  const storeRef = (0, import_react2.useRef)(createAnimationStore());
@@ -353,7 +354,7 @@ function AnimationProvider({
353
354
  let cancelled = false;
354
355
  (async () => {
355
356
  try {
356
- await (0, import_animation_wasm.init)();
357
+ await (0, import_animation_wasm.init)(wasmInitInput);
357
358
  } catch (err) {
358
359
  console.error("Failed to init @vizij/animation-wasm", err);
359
360
  return;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { StoredAnimation, Config, OutputsWithDerivatives, Value as Value$1, Inputs, InstanceUpdate, AnimationInfo, PlayerInfo, InstanceInfo, BakingConfig, BakedAnimationData, BakedAnimationBundle, listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
3
+ import { StoredAnimation, Config, OutputsWithDerivatives, InitInput, Value as Value$1, Inputs, InstanceUpdate, AnimationInfo, PlayerInfo, InstanceInfo, BakingConfig, BakedAnimationData, BakedAnimationBundle, listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
4
4
  export { listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
5
5
  import { NormalizedTransform } from '@vizij/value-json';
6
6
 
@@ -34,6 +34,8 @@ type AnimationProviderProps = {
34
34
  engineConfig?: Config;
35
35
  /** Optional callback to receive raw Outputs each update (includes events and derivatives). */
36
36
  onOutputs?: (out: OutputsWithDerivatives) => void;
37
+ /** Optional init input passed to @vizij/animation-wasm.init for tests and SSR. */
38
+ wasmInitInput?: InitInput;
37
39
  };
38
40
  type AnimationContextValue = {
39
41
  ready: boolean;
@@ -101,7 +103,7 @@ type AnimationContextValue = {
101
103
  players: Record<string, number>;
102
104
  };
103
105
 
104
- declare function AnimationProvider({ children, animations, instances, prebind, autostart, updateHz, engineConfig, onOutputs, }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
106
+ declare function AnimationProvider({ children, animations, instances, prebind, autostart, updateHz, engineConfig, onOutputs, wasmInitInput, }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
105
107
 
106
108
  declare function useAnimation(): AnimationContextValue;
107
109
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { StoredAnimation, Config, OutputsWithDerivatives, Value as Value$1, Inputs, InstanceUpdate, AnimationInfo, PlayerInfo, InstanceInfo, BakingConfig, BakedAnimationData, BakedAnimationBundle, listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
3
+ import { StoredAnimation, Config, OutputsWithDerivatives, InitInput, Value as Value$1, Inputs, InstanceUpdate, AnimationInfo, PlayerInfo, InstanceInfo, BakingConfig, BakedAnimationData, BakedAnimationBundle, listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
4
4
  export { listAnimationFixtures, loadAnimationFixture, loadAnimationJson, resolveAnimationPath } from '@vizij/animation-wasm';
5
5
  import { NormalizedTransform } from '@vizij/value-json';
6
6
 
@@ -34,6 +34,8 @@ type AnimationProviderProps = {
34
34
  engineConfig?: Config;
35
35
  /** Optional callback to receive raw Outputs each update (includes events and derivatives). */
36
36
  onOutputs?: (out: OutputsWithDerivatives) => void;
37
+ /** Optional init input passed to @vizij/animation-wasm.init for tests and SSR. */
38
+ wasmInitInput?: InitInput;
37
39
  };
38
40
  type AnimationContextValue = {
39
41
  ready: boolean;
@@ -101,7 +103,7 @@ type AnimationContextValue = {
101
103
  players: Record<string, number>;
102
104
  };
103
105
 
104
- declare function AnimationProvider({ children, animations, instances, prebind, autostart, updateHz, engineConfig, onOutputs, }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
106
+ declare function AnimationProvider({ children, animations, instances, prebind, autostart, updateHz, engineConfig, onOutputs, wasmInitInput, }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
105
107
 
106
108
  declare function useAnimation(): AnimationContextValue;
107
109
 
package/dist/index.js CHANGED
@@ -186,7 +186,8 @@ function AnimationProvider({
186
186
  autostart = true,
187
187
  updateHz,
188
188
  engineConfig,
189
- onOutputs
189
+ onOutputs,
190
+ wasmInitInput
190
191
  }) {
191
192
  const engineRef = useRef(null);
192
193
  const storeRef = useRef(createAnimationStore());
@@ -319,7 +320,7 @@ function AnimationProvider({
319
320
  let cancelled = false;
320
321
  (async () => {
321
322
  try {
322
- await init();
323
+ await init(wasmInitInput);
323
324
  } catch (err) {
324
325
  console.error("Failed to init @vizij/animation-wasm", err);
325
326
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizij/animation-react",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "README.md"
24
24
  ],
25
25
  "dependencies": {
26
- "@vizij/animation-wasm": "^0.3.1",
26
+ "@vizij/animation-wasm": "^0.3.5",
27
27
  "@vizij/value-json": "^0.1.0"
28
28
  },
29
29
  "peerDependencies": {