@vizij/render 0.0.7 → 0.1.1

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ComponentProps, ReactNode, RefObject } from 'react';
3
+ import { CSSProperties, ComponentProps, ReactNode, RefObject, MouseEvent } from 'react';
4
4
  import { Canvas, ThreeEvent } from '@react-three/fiber';
5
5
  import * as zustand from 'zustand';
6
6
  import * as THREE from 'three';
@@ -8,11 +8,12 @@ import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry, AnimationClip, O
8
8
  import { RawValue, AnimatableValue, RawVector2 } from '@vizij/utils';
9
9
 
10
10
  interface VizijProps {
11
- style?: React.CSSProperties;
11
+ style?: CSSProperties;
12
12
  className?: string;
13
13
  rootId: string;
14
14
  namespace?: string;
15
15
  showSafeArea?: boolean;
16
+ showSelectionGlow?: boolean;
16
17
  onPointerMissed?: ComponentProps<typeof Canvas>["onPointerMissed"];
17
18
  }
18
19
  /**
@@ -30,7 +31,7 @@ interface VizijProps {
30
31
  *
31
32
  * @returns The rendered ReactNode.
32
33
  */
33
- declare function Vizij({ style, className, rootId, namespace, showSafeArea, onPointerMissed, }: VizijProps): ReactNode;
34
+ declare function Vizij({ style, className, rootId, namespace, showSafeArea, showSelectionGlow, onPointerMissed, }: VizijProps): ReactNode;
34
35
  interface InnerVizijProps {
35
36
  rootId: string;
36
37
  namespace: string;
@@ -40,8 +41,9 @@ interface InnerVizijProps {
40
41
  resolution: number;
41
42
  };
42
43
  showSafeArea?: boolean;
44
+ showSelectionGlow?: boolean;
43
45
  }
44
- declare function InnerVizij({ rootId, namespace, container, showSafeArea, }: InnerVizijProps): react_jsx_runtime.JSX.Element;
46
+ declare function InnerVizij({ rootId, namespace, container, showSafeArea, showSelectionGlow, }: InnerVizijProps): react_jsx_runtime.JSX.Element;
45
47
 
46
48
  /**
47
49
  * A wrapping type to reference an attribute that is animatable.
@@ -298,6 +300,7 @@ interface VizijPoseDefinition {
298
300
  id: VizijPoseId;
299
301
  name?: string;
300
302
  description?: string;
303
+ group?: string | null;
301
304
  values: Record<string, number | undefined>;
302
305
  }
303
306
  interface VizijPoseRigConfig {
@@ -354,12 +357,40 @@ interface VizijBundleAnimationEntry {
354
357
  [key: string]: unknown;
355
358
  };
356
359
  }
360
+ interface VizijSpeechConfig {
361
+ /** TTS voice name (e.g., "Ruth") */
362
+ voice?: string;
363
+ /** Speech mode */
364
+ mode?: "echo" | "conversation";
365
+ /** Agent name for LLM system prompt */
366
+ agentName?: string;
367
+ /** Custom system prompt (supports {{agent_name}} template) */
368
+ systemPrompt?: string;
369
+ /** Input path for avatar-speaking state (default: /speech/speaking) */
370
+ speakingInputPath?: string;
371
+ /** Input path for user-speaking state (default: /speech/user_speaking) */
372
+ userSpeakingInputPath?: string;
373
+ /** Input path for thinking state (default: /speech/thinking) */
374
+ thinkingInputPath?: string;
375
+ /** Pose group ID for viseme mapping */
376
+ visemeGroupId?: string;
377
+ /** Pose group ID for emotion mapping */
378
+ emotionGroupId?: string;
379
+ /** TTS API base URL */
380
+ apiBaseUrl?: string;
381
+ /** Auto-activate microphone when speech is ready (default: false) */
382
+ autoActivateMic?: boolean;
383
+ }
357
384
  interface VizijBundleExtension {
358
385
  version: VizijBundleVersion;
359
386
  exportedAt?: string;
360
387
  graphs?: VizijBundleGraphEntry[];
361
388
  poses?: VizijBundlePoseSection | null;
362
389
  animations?: VizijBundleAnimationEntry[];
390
+ /**
391
+ * Bundle-level metadata. May include `speechConfig: VizijSpeechConfig`
392
+ * for configuring the STT/LLM/TTS speech pipeline.
393
+ */
363
394
  metadata?: Record<string, unknown>;
364
395
  }
365
396
 
@@ -420,6 +451,11 @@ interface VizijData {
420
451
  }
421
452
  interface VizijActions {
422
453
  setValue: (id: string, namespace: string, value: RawValue | ((current: RawValue | undefined) => RawValue | undefined)) => void;
454
+ setValues: (writes: Array<{
455
+ id: string;
456
+ namespace: string;
457
+ value: RawValue;
458
+ }>) => void;
423
459
  setWorldElementName: (id: string, value: string) => void;
424
460
  setVizij: (scene: World, animatables: Record<string, AnimatableValue>) => void;
425
461
  setSlot: (parentId: string, parentNamespace: string, childId: string, childNamespace: string) => void;
@@ -471,6 +507,11 @@ declare const VizijSlice: (set: VizijStoreSetter, get: VizijStoreGetter) => {
471
507
  getExportableBodies: (filterIds?: string[]) => THREE.Group<THREE.Object3DEventMap>[];
472
508
  setGeometry: (id: string, geometry: THREE.BufferGeometry) => void;
473
509
  setValue: (id: string, namespace: string, value: RawValue | ((current: RawValue | undefined) => RawValue | undefined)) => void;
510
+ setValues: (writes?: Array<{
511
+ id: string;
512
+ namespace: string;
513
+ value: RawValue;
514
+ }>) => void;
474
515
  setWorldElementName: (id: string, value: string) => void;
475
516
  setParent: (id: string, parent: string) => void;
476
517
  setChild: (id: string, child: string) => void;
@@ -558,6 +599,12 @@ declare function useVizijStoreGetter(): () => VizijData & VizijActions;
558
599
  declare class EmptyModelError extends Error {
559
600
  constructor(message: string);
560
601
  }
602
+ type ParserJsonFallbackSource = {
603
+ url?: string;
604
+ blob?: Blob;
605
+ arrayBuffer?: ArrayBuffer;
606
+ };
607
+ declare function parseGlbJsonChunk(buffer: ArrayBuffer): unknown | undefined;
561
608
  declare function loadGLTF(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
562
609
  center: RawVector2;
563
610
  size: RawVector2;
@@ -571,11 +618,12 @@ type LoadedVizijAsset = {
571
618
  animatables: Record<string, AnimatableValue>;
572
619
  bundle: VizijBundleExtension | null;
573
620
  animations: VizijAnimationClipData[];
621
+ scene: Group$1;
574
622
  };
575
623
  declare function loadGLTFWithBundle(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
576
624
  center: RawVector2;
577
625
  size: RawVector2;
578
- }): Promise<LoadedVizijAsset>;
626
+ }, parserJsonFallback?: ParserJsonFallbackSource): Promise<LoadedVizijAsset>;
579
627
  declare function loadGLTFFromBlobWithBundle(blob: Blob, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
580
628
  center: RawVector2;
581
629
  size: RawVector2;
@@ -594,10 +642,12 @@ type ExportSceneOptions = {
594
642
  bundle?: VizijBundleExtension | null;
595
643
  animations?: AnimationClip[];
596
644
  binary?: boolean;
645
+ onError?: (error: Error) => void;
646
+ onComplete?: () => void;
597
647
  };
598
648
  declare function exportScene(data: Group$1, fileNameOrOptions?: string | ExportSceneOptions): void;
599
649
 
600
650
  declare function extractVizijBundle(object: Object3D, parserJson?: unknown): VizijBundleExtension | null;
601
651
  declare function applyVizijBundle(object: Object3D, bundle: VizijBundleExtension | null): () => void;
602
652
 
603
- export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationClipData, type VizijAnimationId, type VizijAnimationTrackData, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };
653
+ export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationClipData, type VizijAnimationId, type VizijAnimationTrackData, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijSpeechConfig, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, parseGlbJsonChunk, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ComponentProps, ReactNode, RefObject } from 'react';
3
+ import { CSSProperties, ComponentProps, ReactNode, RefObject, MouseEvent } from 'react';
4
4
  import { Canvas, ThreeEvent } from '@react-three/fiber';
5
5
  import * as zustand from 'zustand';
6
6
  import * as THREE from 'three';
@@ -8,11 +8,12 @@ import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry, AnimationClip, O
8
8
  import { RawValue, AnimatableValue, RawVector2 } from '@vizij/utils';
9
9
 
10
10
  interface VizijProps {
11
- style?: React.CSSProperties;
11
+ style?: CSSProperties;
12
12
  className?: string;
13
13
  rootId: string;
14
14
  namespace?: string;
15
15
  showSafeArea?: boolean;
16
+ showSelectionGlow?: boolean;
16
17
  onPointerMissed?: ComponentProps<typeof Canvas>["onPointerMissed"];
17
18
  }
18
19
  /**
@@ -30,7 +31,7 @@ interface VizijProps {
30
31
  *
31
32
  * @returns The rendered ReactNode.
32
33
  */
33
- declare function Vizij({ style, className, rootId, namespace, showSafeArea, onPointerMissed, }: VizijProps): ReactNode;
34
+ declare function Vizij({ style, className, rootId, namespace, showSafeArea, showSelectionGlow, onPointerMissed, }: VizijProps): ReactNode;
34
35
  interface InnerVizijProps {
35
36
  rootId: string;
36
37
  namespace: string;
@@ -40,8 +41,9 @@ interface InnerVizijProps {
40
41
  resolution: number;
41
42
  };
42
43
  showSafeArea?: boolean;
44
+ showSelectionGlow?: boolean;
43
45
  }
44
- declare function InnerVizij({ rootId, namespace, container, showSafeArea, }: InnerVizijProps): react_jsx_runtime.JSX.Element;
46
+ declare function InnerVizij({ rootId, namespace, container, showSafeArea, showSelectionGlow, }: InnerVizijProps): react_jsx_runtime.JSX.Element;
45
47
 
46
48
  /**
47
49
  * A wrapping type to reference an attribute that is animatable.
@@ -298,6 +300,7 @@ interface VizijPoseDefinition {
298
300
  id: VizijPoseId;
299
301
  name?: string;
300
302
  description?: string;
303
+ group?: string | null;
301
304
  values: Record<string, number | undefined>;
302
305
  }
303
306
  interface VizijPoseRigConfig {
@@ -354,12 +357,40 @@ interface VizijBundleAnimationEntry {
354
357
  [key: string]: unknown;
355
358
  };
356
359
  }
360
+ interface VizijSpeechConfig {
361
+ /** TTS voice name (e.g., "Ruth") */
362
+ voice?: string;
363
+ /** Speech mode */
364
+ mode?: "echo" | "conversation";
365
+ /** Agent name for LLM system prompt */
366
+ agentName?: string;
367
+ /** Custom system prompt (supports {{agent_name}} template) */
368
+ systemPrompt?: string;
369
+ /** Input path for avatar-speaking state (default: /speech/speaking) */
370
+ speakingInputPath?: string;
371
+ /** Input path for user-speaking state (default: /speech/user_speaking) */
372
+ userSpeakingInputPath?: string;
373
+ /** Input path for thinking state (default: /speech/thinking) */
374
+ thinkingInputPath?: string;
375
+ /** Pose group ID for viseme mapping */
376
+ visemeGroupId?: string;
377
+ /** Pose group ID for emotion mapping */
378
+ emotionGroupId?: string;
379
+ /** TTS API base URL */
380
+ apiBaseUrl?: string;
381
+ /** Auto-activate microphone when speech is ready (default: false) */
382
+ autoActivateMic?: boolean;
383
+ }
357
384
  interface VizijBundleExtension {
358
385
  version: VizijBundleVersion;
359
386
  exportedAt?: string;
360
387
  graphs?: VizijBundleGraphEntry[];
361
388
  poses?: VizijBundlePoseSection | null;
362
389
  animations?: VizijBundleAnimationEntry[];
390
+ /**
391
+ * Bundle-level metadata. May include `speechConfig: VizijSpeechConfig`
392
+ * for configuring the STT/LLM/TTS speech pipeline.
393
+ */
363
394
  metadata?: Record<string, unknown>;
364
395
  }
365
396
 
@@ -420,6 +451,11 @@ interface VizijData {
420
451
  }
421
452
  interface VizijActions {
422
453
  setValue: (id: string, namespace: string, value: RawValue | ((current: RawValue | undefined) => RawValue | undefined)) => void;
454
+ setValues: (writes: Array<{
455
+ id: string;
456
+ namespace: string;
457
+ value: RawValue;
458
+ }>) => void;
423
459
  setWorldElementName: (id: string, value: string) => void;
424
460
  setVizij: (scene: World, animatables: Record<string, AnimatableValue>) => void;
425
461
  setSlot: (parentId: string, parentNamespace: string, childId: string, childNamespace: string) => void;
@@ -471,6 +507,11 @@ declare const VizijSlice: (set: VizijStoreSetter, get: VizijStoreGetter) => {
471
507
  getExportableBodies: (filterIds?: string[]) => THREE.Group<THREE.Object3DEventMap>[];
472
508
  setGeometry: (id: string, geometry: THREE.BufferGeometry) => void;
473
509
  setValue: (id: string, namespace: string, value: RawValue | ((current: RawValue | undefined) => RawValue | undefined)) => void;
510
+ setValues: (writes?: Array<{
511
+ id: string;
512
+ namespace: string;
513
+ value: RawValue;
514
+ }>) => void;
474
515
  setWorldElementName: (id: string, value: string) => void;
475
516
  setParent: (id: string, parent: string) => void;
476
517
  setChild: (id: string, child: string) => void;
@@ -558,6 +599,12 @@ declare function useVizijStoreGetter(): () => VizijData & VizijActions;
558
599
  declare class EmptyModelError extends Error {
559
600
  constructor(message: string);
560
601
  }
602
+ type ParserJsonFallbackSource = {
603
+ url?: string;
604
+ blob?: Blob;
605
+ arrayBuffer?: ArrayBuffer;
606
+ };
607
+ declare function parseGlbJsonChunk(buffer: ArrayBuffer): unknown | undefined;
561
608
  declare function loadGLTF(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
562
609
  center: RawVector2;
563
610
  size: RawVector2;
@@ -571,11 +618,12 @@ type LoadedVizijAsset = {
571
618
  animatables: Record<string, AnimatableValue>;
572
619
  bundle: VizijBundleExtension | null;
573
620
  animations: VizijAnimationClipData[];
621
+ scene: Group$1;
574
622
  };
575
623
  declare function loadGLTFWithBundle(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
576
624
  center: RawVector2;
577
625
  size: RawVector2;
578
- }): Promise<LoadedVizijAsset>;
626
+ }, parserJsonFallback?: ParserJsonFallbackSource): Promise<LoadedVizijAsset>;
579
627
  declare function loadGLTFFromBlobWithBundle(blob: Blob, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
580
628
  center: RawVector2;
581
629
  size: RawVector2;
@@ -594,10 +642,12 @@ type ExportSceneOptions = {
594
642
  bundle?: VizijBundleExtension | null;
595
643
  animations?: AnimationClip[];
596
644
  binary?: boolean;
645
+ onError?: (error: Error) => void;
646
+ onComplete?: () => void;
597
647
  };
598
648
  declare function exportScene(data: Group$1, fileNameOrOptions?: string | ExportSceneOptions): void;
599
649
 
600
650
  declare function extractVizijBundle(object: Object3D, parserJson?: unknown): VizijBundleExtension | null;
601
651
  declare function applyVizijBundle(object: Object3D, bundle: VizijBundleExtension | null): () => void;
602
652
 
603
- export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationClipData, type VizijAnimationId, type VizijAnimationTrackData, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };
653
+ export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationClipData, type VizijAnimationId, type VizijAnimationTrackData, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijSpeechConfig, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, parseGlbJsonChunk, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };