@oneworks/avatar-react 0.0.0-onboarding.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present One Works contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @oneworks/avatar-react
2
+
3
+ [English](README.md) | [简体中文](README.zh-Hans.md)
4
+
5
+ React renderer and embeddable full editor for OneWorks 3D Avatar.
6
+
7
+ ```tsx
8
+ import { Avatar, AvatarEditor } from '@oneworks/avatar-react'
9
+ import '@oneworks/avatar-react/style.css'
10
+
11
+ <Avatar definition={avatar} animationLibraries={[supportAnimations]} />
12
+ <AvatarEditor definition={avatar} animationLibraries={[supportAnimations]} />
13
+ ```
14
+
15
+ See the [Avatar Runtime guide](https://oneworks.cloud/docs/en/usage/avatar-runtime#react).
@@ -0,0 +1,15 @@
1
+ # @oneworks/avatar-react
2
+
3
+ [English](README.md) | [简体中文](README.zh-Hans.md)
4
+
5
+ OneWorks 3D Avatar 的 React 渲染组件与可嵌入完整编辑器。
6
+
7
+ ```tsx
8
+ import { Avatar, AvatarEditor } from '@oneworks/avatar-react'
9
+ import '@oneworks/avatar-react/style.css'
10
+
11
+ <Avatar definition={avatar} animationLibraries={[supportAnimations]} />
12
+ <AvatarEditor definition={avatar} animationLibraries={[supportAnimations]} />
13
+ ```
14
+
15
+ 完整说明见 [Avatar Runtime 指南](https://oneworks.cloud/docs/usage/avatar-runtime#react)。
@@ -0,0 +1,55 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { AvatarAnimationClip, AvatarAnimationLibrary, AvatarAnimationRef, AvatarDefinition } from '@oneworks/avatar';
3
+ export type { AvatarAnimationClip, AvatarAnimationGroup, AvatarAnimationKeyframe, AvatarAnimationLibrary, AvatarAnimationRef, AvatarDefinition } from '@oneworks/avatar';
4
+ export type AvatarTheme = 'dark' | 'light' | 'system';
5
+ export type AvatarLocale = 'en' | 'zh-Hans';
6
+ export type AvatarCaptureOptions = {
7
+ readonly background?: string | 'transparent';
8
+ readonly format: 'png' | 'svg';
9
+ readonly frame?: 'circle' | 'rounded' | 'square';
10
+ readonly size: 128 | 256 | 512;
11
+ };
12
+ export interface AvatarPlayOptions {
13
+ readonly playback?: 'loop' | 'once';
14
+ readonly speed?: number;
15
+ }
16
+ export interface AvatarHandle {
17
+ capture(options: AvatarCaptureOptions): Promise<Blob>;
18
+ getDefinition(): AvatarDefinition;
19
+ pause(): void;
20
+ play(animation: AvatarAnimationClip | AvatarAnimationRef, options?: AvatarPlayOptions): Promise<void>;
21
+ resume(): void;
22
+ seek(timeMs: number): void;
23
+ setDefinition(definition: AvatarDefinition): void;
24
+ stop(options?: {
25
+ readonly reset?: boolean;
26
+ }): void;
27
+ }
28
+ export interface AvatarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onError'> {
29
+ readonly animation?: AvatarAnimationClip | AvatarAnimationRef | null;
30
+ readonly animationLibraries?: readonly AvatarAnimationLibrary[];
31
+ readonly autoplay?: boolean;
32
+ readonly definition?: AvatarDefinition;
33
+ readonly interactive?: boolean;
34
+ readonly onAnimationEnd?: () => void;
35
+ readonly onAnimationLoop?: () => void;
36
+ readonly onAnimationStart?: () => void;
37
+ readonly onDefinitionChange?: (definition: AvatarDefinition) => void;
38
+ readonly onError?: (error: Error) => void;
39
+ readonly theme?: AvatarTheme;
40
+ }
41
+ export declare const Avatar: import('react').ForwardRefExoticComponent<AvatarProps & import('react').RefAttributes<AvatarHandle>>;
42
+ export interface AvatarEditorHandle {
43
+ focus(): void;
44
+ getDefinition(): AvatarDefinition;
45
+ setDefinition(definition: AvatarDefinition): void;
46
+ }
47
+ export interface AvatarEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
48
+ readonly animationLibraries?: readonly AvatarAnimationLibrary[];
49
+ readonly defaultDefinition?: AvatarDefinition;
50
+ readonly definition?: AvatarDefinition;
51
+ readonly locale?: AvatarLocale;
52
+ readonly onDefinitionChange?: (definition: AvatarDefinition) => void;
53
+ readonly theme?: AvatarTheme;
54
+ }
55
+ export declare const AvatarEditor: import('react').ForwardRefExoticComponent<AvatarEditorProps & import('react').RefAttributes<AvatarEditorHandle>>;