@mymosdk/avatar 0.1.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.
Files changed (51) hide show
  1. package/dist/Avatar-DEkBZdcp.js +2583 -0
  2. package/dist/Avatar-DEkBZdcp.js.map +1 -0
  3. package/dist/Avatar-Ok6vAXs6.cjs +10 -0
  4. package/dist/Avatar-Ok6vAXs6.cjs.map +1 -0
  5. package/dist/Avatar.d.ts +77 -0
  6. package/dist/Avatar.d.ts.map +1 -0
  7. package/dist/animation/AnimationEngine.d.ts +58 -0
  8. package/dist/animation/AnimationEngine.d.ts.map +1 -0
  9. package/dist/audio/AudioEngine.d.ts +19 -0
  10. package/dist/audio/AudioEngine.d.ts.map +1 -0
  11. package/dist/audio/LipSync.d.ts +14 -0
  12. package/dist/audio/LipSync.d.ts.map +1 -0
  13. package/dist/events/EventEmitter.d.ts +9 -0
  14. package/dist/events/EventEmitter.d.ts.map +1 -0
  15. package/dist/index.d.ts +4 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/loader/AssetLoader.d.ts +18 -0
  18. package/dist/loader/AssetLoader.d.ts.map +1 -0
  19. package/dist/mymo-avatar.cjs +2 -0
  20. package/dist/mymo-avatar.cjs.map +1 -0
  21. package/dist/mymo-avatar.js +5 -0
  22. package/dist/mymo-avatar.js.map +1 -0
  23. package/dist/mymo-avatar.umd.js +992 -0
  24. package/dist/mymo-avatar.umd.js.map +1 -0
  25. package/dist/plugins/PluginSystem.d.ts +7 -0
  26. package/dist/plugins/PluginSystem.d.ts.map +1 -0
  27. package/dist/react/AvatarWidget.d.ts +4 -0
  28. package/dist/react/AvatarWidget.d.ts.map +1 -0
  29. package/dist/react/index.d.ts +4 -0
  30. package/dist/react/index.d.ts.map +1 -0
  31. package/dist/react/useAvatar.d.ts +3 -0
  32. package/dist/react/useAvatar.d.ts.map +1 -0
  33. package/dist/react.cjs +2 -0
  34. package/dist/react.cjs.map +1 -0
  35. package/dist/react.js +19 -0
  36. package/dist/react.js.map +1 -0
  37. package/dist/renderer/Renderer.d.ts +46 -0
  38. package/dist/renderer/Renderer.d.ts.map +1 -0
  39. package/dist/types/index.d.ts +69 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/vue/AvatarWidget.d.ts +4 -0
  42. package/dist/vue/AvatarWidget.d.ts.map +1 -0
  43. package/dist/vue/index.d.ts +3 -0
  44. package/dist/vue/index.d.ts.map +1 -0
  45. package/dist/vue/useAvatar.d.ts +4 -0
  46. package/dist/vue/useAvatar.d.ts.map +1 -0
  47. package/dist/vue.cjs +2 -0
  48. package/dist/vue.cjs.map +1 -0
  49. package/dist/vue.js +41 -0
  50. package/dist/vue.js.map +1 -0
  51. package/package.json +71 -0
@@ -0,0 +1,7 @@
1
+ import { AvatarApi, AvatarPlugin } from '../types/index.js';
2
+ export declare class PluginSystem {
3
+ private installed;
4
+ use(plugin: AvatarPlugin, avatar: AvatarApi, options?: Record<string, unknown>): void;
5
+ has(name: string): boolean;
6
+ }
7
+ //# sourceMappingURL=PluginSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginSystem.d.ts","sourceRoot":"","sources":["../../src/plugins/PluginSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhE,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAkC;IAEnD,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMrF,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B"}
@@ -0,0 +1,4 @@
1
+ import { Avatar, AvatarOptions } from '../index.js';
2
+ export type AvatarWidgetProps = AvatarOptions;
3
+ export declare const AvatarWidget: import('react').ForwardRefExoticComponent<AvatarOptions & import('react').RefAttributes<Avatar | null>>;
4
+ //# sourceMappingURL=AvatarWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarWidget.d.ts","sourceRoot":"","sources":["../../src/react/AvatarWidget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAExD,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAA;AAE7C,eAAO,MAAM,YAAY,yGAQxB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { useAvatar } from './useAvatar.js';
2
+ export { AvatarWidget } from './AvatarWidget.js';
3
+ export type { AvatarWidgetProps } from './AvatarWidget.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Avatar, AvatarOptions } from '../index.js';
2
+ export declare function useAvatar(options: AvatarOptions): React.RefObject<Avatar | null>;
3
+ //# sourceMappingURL=useAvatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAvatar.d.ts","sourceRoot":"","sources":["../../src/react/useAvatar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAYhF"}
package/dist/react.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),c=require("./Avatar-Ok6vAXs6.cjs");function a(t){const e=r.useRef(null);return r.useEffect(()=>(e.current=new c.Avatar(t),()=>{e.current?.destroy(),e.current=null}),[]),e}const o=r.forwardRef(function(e,n){const u=a(e);return r.useImperativeHandle(n,()=>u.current),null});exports.AvatarWidget=o;exports.useAvatar=a;
2
+ //# sourceMappingURL=react.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.cjs","sources":["../src/react/useAvatar.ts","../src/react/AvatarWidget.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\"\nimport { Avatar } from \"../index.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nexport function useAvatar(options: AvatarOptions): React.RefObject<Avatar | null> {\n const ref = useRef<Avatar | null>(null)\n\n useEffect(() => {\n ref.current = new Avatar(options)\n return () => {\n ref.current?.destroy()\n ref.current = null\n }\n }, [])\n\n return ref\n}\n","import { forwardRef, useImperativeHandle } from \"react\"\nimport { useAvatar } from \"./useAvatar.js\"\nimport type { Avatar, AvatarOptions } from \"../index.js\"\n\nexport type AvatarWidgetProps = AvatarOptions\n\nexport const AvatarWidget = forwardRef<Avatar | null, AvatarWidgetProps>(\n function AvatarWidget(props, ref) {\n const avatarRef = useAvatar(props)\n\n useImperativeHandle(ref, () => avatarRef.current!)\n\n return null\n },\n)\n"],"names":["useAvatar","options","ref","useRef","useEffect","Avatar","AvatarWidget","forwardRef","props","avatarRef","useImperativeHandle"],"mappings":"4IAIO,SAASA,EAAUC,EAAwD,CAChF,MAAMC,EAAMC,EAAAA,OAAsB,IAAI,EAEtCC,OAAAA,EAAAA,UAAU,KACRF,EAAI,QAAU,IAAIG,EAAAA,OAAOJ,CAAO,EACzB,IAAM,CACXC,EAAI,SAAS,QAAA,EACbA,EAAI,QAAU,IAChB,GACC,CAAA,CAAE,EAEEA,CACT,CCVO,MAAMI,EAAeC,EAAAA,WAC1B,SAAsBC,EAAON,EAAK,CAChC,MAAMO,EAAYT,EAAUQ,CAAK,EAEjCE,OAAAA,EAAAA,oBAAoBR,EAAK,IAAMO,EAAU,OAAQ,EAE1C,IACT,CACF"}
package/dist/react.js ADDED
@@ -0,0 +1,19 @@
1
+ import { useRef as u, useEffect as a, forwardRef as o, useImperativeHandle as f } from "react";
2
+ import { A as c } from "./Avatar-DEkBZdcp.js";
3
+ function s(t) {
4
+ const r = u(null);
5
+ return a(() => (r.current = new c(t), () => {
6
+ r.current?.destroy(), r.current = null;
7
+ }), []), r;
8
+ }
9
+ const v = o(
10
+ function(r, e) {
11
+ const n = s(r);
12
+ return f(e, () => n.current), null;
13
+ }
14
+ );
15
+ export {
16
+ v as AvatarWidget,
17
+ s as useAvatar
18
+ };
19
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sources":["../src/react/useAvatar.ts","../src/react/AvatarWidget.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\"\nimport { Avatar } from \"../index.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nexport function useAvatar(options: AvatarOptions): React.RefObject<Avatar | null> {\n const ref = useRef<Avatar | null>(null)\n\n useEffect(() => {\n ref.current = new Avatar(options)\n return () => {\n ref.current?.destroy()\n ref.current = null\n }\n }, [])\n\n return ref\n}\n","import { forwardRef, useImperativeHandle } from \"react\"\nimport { useAvatar } from \"./useAvatar.js\"\nimport type { Avatar, AvatarOptions } from \"../index.js\"\n\nexport type AvatarWidgetProps = AvatarOptions\n\nexport const AvatarWidget = forwardRef<Avatar | null, AvatarWidgetProps>(\n function AvatarWidget(props, ref) {\n const avatarRef = useAvatar(props)\n\n useImperativeHandle(ref, () => avatarRef.current!)\n\n return null\n },\n)\n"],"names":["useAvatar","options","ref","useRef","useEffect","Avatar","AvatarWidget","forwardRef","props","avatarRef","useImperativeHandle"],"mappings":";;AAIO,SAASA,EAAUC,GAAwD;AAChF,QAAMC,IAAMC,EAAsB,IAAI;AAEtC,SAAAC,EAAU,OACRF,EAAI,UAAU,IAAIG,EAAOJ,CAAO,GACzB,MAAM;AACX,IAAAC,EAAI,SAAS,QAAA,GACbA,EAAI,UAAU;AAAA,EAChB,IACC,CAAA,CAAE,GAEEA;AACT;ACVO,MAAMI,IAAeC;AAAA,EAC1B,SAAsBC,GAAON,GAAK;AAChC,UAAMO,IAAYT,EAAUQ,CAAK;AAEjC,WAAAE,EAAoBR,GAAK,MAAMO,EAAU,OAAQ,GAE1C;AAAA,EACT;AACF;"}
@@ -0,0 +1,46 @@
1
+ import { AvatarOptions, AvatarPosition, AvatarFraming, FramingSliceConfig, ThemeConfig } from '../types/index.js';
2
+ import * as THREE from "three";
3
+ type TickCallback = (delta: number) => void;
4
+ export declare class Renderer {
5
+ readonly scene: THREE.Scene;
6
+ readonly camera: THREE.PerspectiveCamera;
7
+ private webgl;
8
+ private container;
9
+ private clock;
10
+ private rafId;
11
+ private tickCallbacks;
12
+ private currentModel;
13
+ private currentFraming;
14
+ private currentTheme;
15
+ private modelFraming;
16
+ private userSliceConfig;
17
+ private userThemeConfig;
18
+ constructor();
19
+ setup(options: Required<AvatarOptions>): void;
20
+ private _setupLights;
21
+ private _createContainer;
22
+ setTheme(theme: string): void;
23
+ setThemeConfig(config: ThemeConfig): void;
24
+ private _applyTheme;
25
+ private _applyPosition;
26
+ private _startLoop;
27
+ private _makeDraggable;
28
+ addTickCallback(fn: TickCallback): void;
29
+ private _skeletonHelper;
30
+ setModel(model: THREE.Object3D): void;
31
+ debugBones(visible?: boolean): void;
32
+ private _computeFraming;
33
+ private _autoFit;
34
+ private _applyFraming;
35
+ show(): void;
36
+ hide(): void;
37
+ setFraming(framing: AvatarFraming): void;
38
+ setFramingConfig(config: FramingSliceConfig): void;
39
+ setPosition(preset: AvatarPosition): void;
40
+ setSize(px: number): void;
41
+ moveTo(x: number, y: number): void;
42
+ getContainer(): HTMLDivElement;
43
+ dispose(): void;
44
+ }
45
+ export {};
46
+ //# sourceMappingURL=Renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../src/renderer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E,OAAO,GAAG,IAAI;IAenC,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,aAAa;IAQrB,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKxC,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAQlD,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIzC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMzB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAOlC,YAAY,IAAI,cAAc;IAI9B,OAAO,IAAI,IAAI;CAMhB"}
@@ -0,0 +1,69 @@
1
+ export type AvatarPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
2
+ export type AvatarFraming = "full" | "half" | "bust" | "face";
3
+ export type AvatarTheme = "light" | "dark" | "transparent";
4
+ export type Expression = "idle" | "smile" | "sad" | "happy" | "angry" | "surprised" | "thinking" | "confused" | "sleep";
5
+ export type Gesture = "wave" | "nod" | "shakeHead" | "clap" | "jump" | "dance" | "yes" | "no" | "thumbsUp";
6
+ export type AvatarState = "loading" | "success" | "error" | "warning" | "typing" | "listening" | "processing" | "complete";
7
+ export type AvatarEvent = "click" | "loaded" | "animationStart" | "animationEnd" | "speechStart" | "speechEnd" | "modelLoaded";
8
+ export type AvatarEventCallback = (event: AvatarEvent, data?: unknown) => void;
9
+ /** Per-mode framing tuning. from/to: vertical slice of the model (0=feet, 1=top of head).
10
+ * lookBias: where in the slice the camera aims (0.5=center, lower=more headroom above). */
11
+ export interface FramingModeConfig {
12
+ /** Bottom of the visible slice as a fraction of model height (0–1) */
13
+ from?: number;
14
+ /** Top of the visible slice as a fraction of model height (0–1, default 1.0) */
15
+ to?: number;
16
+ /** Where in the slice the camera aims: 0.5 = center, 0.35 = lower → more room above */
17
+ lookBias?: number;
18
+ }
19
+ export type FramingSliceConfig = Partial<Record<AvatarFraming, FramingModeConfig>>;
20
+ export interface ThemeModeConfig {
21
+ background?: string;
22
+ boxShadow?: string;
23
+ }
24
+ export type ThemeConfig = Partial<Record<"light" | "dark", ThemeModeConfig>>;
25
+ export interface AvatarOptions {
26
+ model?: string;
27
+ position?: AvatarPosition;
28
+ size?: number;
29
+ theme?: AvatarTheme;
30
+ framing?: AvatarFraming;
31
+ draggable?: boolean;
32
+ shadows?: boolean;
33
+ idle?: boolean;
34
+ idleInterval?: number;
35
+ blink?: boolean;
36
+ blinkInterval?: number;
37
+ lipSync?: boolean;
38
+ followMouse?: boolean;
39
+ autoHide?: boolean;
40
+ zIndex?: number;
41
+ /** Override per-mode framing slices to fine-tune for your specific model */
42
+ framingConfig?: FramingSliceConfig;
43
+ /** Override background/shadow for light and dark themes */
44
+ themeConfig?: ThemeConfig;
45
+ }
46
+ export interface AvatarApi {
47
+ on(event: AvatarEvent, callback: AvatarEventCallback): this;
48
+ off(event: AvatarEvent, callback: AvatarEventCallback): this;
49
+ show(): this;
50
+ hide(): this;
51
+ destroy(): void;
52
+ expression(expr: Expression, intensity?: number): this;
53
+ setState(state: AvatarState): this;
54
+ clearState(): this;
55
+ talk(audio: AudioBuffer | ArrayBuffer | string): Promise<this>;
56
+ startTalking(): this;
57
+ stopTalking(): this;
58
+ setViseme(viseme: string): this;
59
+ setVolume(volume: number): this;
60
+ play(name: string): this;
61
+ stop(): this;
62
+ load(model: string): Promise<this>;
63
+ setFramingConfig(config: FramingSliceConfig): this;
64
+ }
65
+ export interface AvatarPlugin {
66
+ name: string;
67
+ install(avatar: AvatarApi, options?: Record<string, unknown>): void;
68
+ }
69
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,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AC,IAAI,CAAC,CAAA;IAC9D,YAAY,IAAI,IAAI,CAAA;IACpB,WAAW,IAAI,IAAI,CAAA;IACnB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,IAAI,IAAI,IAAI,CAAA;IACZ,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAA;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CACpE"}
@@ -0,0 +1,4 @@
1
+ export declare const AvatarWidget: import('vue').DefineComponent<import('vue').ExtractPropTypes<Record<string, null>>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
2
+ [key: string]: any;
3
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<Record<string, null>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ //# sourceMappingURL=AvatarWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarWidget.d.ts","sourceRoot":"","sources":["../../src/vue/AvatarWidget.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY;;6RAQvB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { useAvatar } from './useAvatar.js';
2
+ export { AvatarWidget } from './AvatarWidget.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { ShallowRef } from 'vue';
2
+ import { Avatar, AvatarOptions } from '../index.js';
3
+ export declare function useAvatar(options: AvatarOptions): ShallowRef<Avatar | null>;
4
+ //# sourceMappingURL=useAvatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAvatar.d.ts","sourceRoot":"","sources":["../../src/vue/useAvatar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,CAa3E"}
package/dist/vue.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),r=require("./Avatar-Ok6vAXs6.cjs");function n(t){const e=a.shallowRef(null);return a.onMounted(()=>{e.value=new r.Avatar(t)}),a.onUnmounted(()=>{e.value?.destroy(),e.value=null}),e}const l=["model","position","size","theme","themeConfig","framing","framingConfig","draggable","shadows","idle","idleInterval","blink","blinkInterval","lipSync","followMouse","autoHide","zIndex"],i=a.defineComponent({name:"AvatarWidget",props:l,setup(t,{expose:e}){const o=n(t);return e({avatar:o}),()=>a.h("span",{style:"display:none"})}});exports.AvatarWidget=i;exports.useAvatar=n;
2
+ //# sourceMappingURL=vue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.cjs","sources":["../src/vue/useAvatar.ts","../src/vue/AvatarWidget.ts"],"sourcesContent":["import { shallowRef, onMounted, onUnmounted, type ShallowRef } from \"vue\"\nimport { Avatar } from \"../index.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nexport function useAvatar(options: AvatarOptions): ShallowRef<Avatar | null> {\n const avatar = shallowRef<Avatar | null>(null)\n\n onMounted(() => {\n avatar.value = new Avatar(options)\n })\n\n onUnmounted(() => {\n avatar.value?.destroy()\n avatar.value = null\n })\n\n return avatar\n}\n","import { defineComponent, h } from \"vue\"\nimport { useAvatar } from \"./useAvatar.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nconst avatarProps = [\n \"model\", \"position\", \"size\", \"theme\", \"themeConfig\", \"framing\", \"framingConfig\",\n \"draggable\", \"shadows\", \"idle\", \"idleInterval\", \"blink\", \"blinkInterval\",\n \"lipSync\", \"followMouse\", \"autoHide\", \"zIndex\",\n] as const\n\nexport const AvatarWidget = defineComponent({\n name: \"AvatarWidget\",\n props: avatarProps as unknown as Record<string, null>,\n setup(props, { expose }) {\n const avatar = useAvatar(props as AvatarOptions)\n expose({ avatar })\n return () => h(\"span\", { style: \"display:none\" })\n },\n})\n"],"names":["useAvatar","options","avatar","shallowRef","onMounted","Avatar","onUnmounted","avatarProps","AvatarWidget","defineComponent","props","expose","h"],"mappings":"0IAIO,SAASA,EAAUC,EAAmD,CAC3E,MAAMC,EAASC,EAAAA,WAA0B,IAAI,EAE7CC,OAAAA,EAAAA,UAAU,IAAM,CACdF,EAAO,MAAQ,IAAIG,EAAAA,OAAOJ,CAAO,CACnC,CAAC,EAEDK,EAAAA,YAAY,IAAM,CAChBJ,EAAO,OAAO,QAAA,EACdA,EAAO,MAAQ,IACjB,CAAC,EAEMA,CACT,CCbA,MAAMK,EAAc,CAClB,QAAS,WAAY,OAAQ,QAAS,cAAe,UAAW,gBAChE,YAAa,UAAW,OAAQ,eAAgB,QAAS,gBACzD,UAAW,cAAe,WAAY,QACxC,EAEaC,EAAeC,EAAAA,gBAAgB,CAC1C,KAAM,eACN,MAAOF,EACP,MAAMG,EAAO,CAAE,OAAAC,GAAU,CACvB,MAAMT,EAASF,EAAUU,CAAsB,EAC/C,OAAAC,EAAO,CAAE,OAAAT,EAAQ,EACV,IAAMU,EAAAA,EAAE,OAAQ,CAAE,MAAO,eAAgB,CAClD,CACF,CAAC"}
package/dist/vue.js ADDED
@@ -0,0 +1,41 @@
1
+ import { shallowRef as o, onMounted as t, onUnmounted as r, defineComponent as l, h as i } from "vue";
2
+ import { A as s } from "./Avatar-DEkBZdcp.js";
3
+ function d(n) {
4
+ const e = o(null);
5
+ return t(() => {
6
+ e.value = new s(n);
7
+ }), r(() => {
8
+ e.value?.destroy(), e.value = null;
9
+ }), e;
10
+ }
11
+ const u = [
12
+ "model",
13
+ "position",
14
+ "size",
15
+ "theme",
16
+ "themeConfig",
17
+ "framing",
18
+ "framingConfig",
19
+ "draggable",
20
+ "shadows",
21
+ "idle",
22
+ "idleInterval",
23
+ "blink",
24
+ "blinkInterval",
25
+ "lipSync",
26
+ "followMouse",
27
+ "autoHide",
28
+ "zIndex"
29
+ ], v = l({
30
+ name: "AvatarWidget",
31
+ props: u,
32
+ setup(n, { expose: e }) {
33
+ const a = d(n);
34
+ return e({ avatar: a }), () => i("span", { style: "display:none" });
35
+ }
36
+ });
37
+ export {
38
+ v as AvatarWidget,
39
+ d as useAvatar
40
+ };
41
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","sources":["../src/vue/useAvatar.ts","../src/vue/AvatarWidget.ts"],"sourcesContent":["import { shallowRef, onMounted, onUnmounted, type ShallowRef } from \"vue\"\nimport { Avatar } from \"../index.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nexport function useAvatar(options: AvatarOptions): ShallowRef<Avatar | null> {\n const avatar = shallowRef<Avatar | null>(null)\n\n onMounted(() => {\n avatar.value = new Avatar(options)\n })\n\n onUnmounted(() => {\n avatar.value?.destroy()\n avatar.value = null\n })\n\n return avatar\n}\n","import { defineComponent, h } from \"vue\"\nimport { useAvatar } from \"./useAvatar.js\"\nimport type { AvatarOptions } from \"../index.js\"\n\nconst avatarProps = [\n \"model\", \"position\", \"size\", \"theme\", \"themeConfig\", \"framing\", \"framingConfig\",\n \"draggable\", \"shadows\", \"idle\", \"idleInterval\", \"blink\", \"blinkInterval\",\n \"lipSync\", \"followMouse\", \"autoHide\", \"zIndex\",\n] as const\n\nexport const AvatarWidget = defineComponent({\n name: \"AvatarWidget\",\n props: avatarProps as unknown as Record<string, null>,\n setup(props, { expose }) {\n const avatar = useAvatar(props as AvatarOptions)\n expose({ avatar })\n return () => h(\"span\", { style: \"display:none\" })\n },\n})\n"],"names":["useAvatar","options","avatar","shallowRef","onMounted","Avatar","onUnmounted","avatarProps","AvatarWidget","defineComponent","props","expose","h"],"mappings":";;AAIO,SAASA,EAAUC,GAAmD;AAC3E,QAAMC,IAASC,EAA0B,IAAI;AAE7C,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAO,QAAQ,IAAIG,EAAOJ,CAAO;AAAA,EACnC,CAAC,GAEDK,EAAY,MAAM;AAChB,IAAAJ,EAAO,OAAO,QAAA,GACdA,EAAO,QAAQ;AAAA,EACjB,CAAC,GAEMA;AACT;ACbA,MAAMK,IAAc;AAAA,EAClB;AAAA,EAAS;AAAA,EAAY;AAAA,EAAQ;AAAA,EAAS;AAAA,EAAe;AAAA,EAAW;AAAA,EAChE;AAAA,EAAa;AAAA,EAAW;AAAA,EAAQ;AAAA,EAAgB;AAAA,EAAS;AAAA,EACzD;AAAA,EAAW;AAAA,EAAe;AAAA,EAAY;AACxC,GAEaC,IAAeC,EAAgB;AAAA,EAC1C,MAAM;AAAA,EACN,OAAOF;AAAA,EACP,MAAMG,GAAO,EAAE,QAAAC,KAAU;AACvB,UAAMT,IAASF,EAAUU,CAAsB;AAC/C,WAAAC,EAAO,EAAE,QAAAT,GAAQ,GACV,MAAMU,EAAE,QAAQ,EAAE,OAAO,gBAAgB;AAAA,EAClD;AACF,CAAC;"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@mymosdk/avatar",
3
+ "version": "0.1.0",
4
+ "description": "Lightweight animated avatar SDK for any web application",
5
+ "keywords": [
6
+ "avatar",
7
+ "animation",
8
+ "3d",
9
+ "sdk",
10
+ "webgl",
11
+ "three.js"
12
+ ],
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "main": "./dist/mymo-avatar.cjs",
16
+ "module": "./dist/mymo-avatar.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/mymo-avatar.js",
21
+ "require": "./dist/mymo-avatar.cjs",
22
+ "types": "./dist/index.d.ts"
23
+ },
24
+ "./react": {
25
+ "import": "./dist/react.js",
26
+ "require": "./dist/react.cjs",
27
+ "types": "./dist/react/index.d.ts"
28
+ },
29
+ "./vue": {
30
+ "import": "./dist/vue.js",
31
+ "require": "./dist/vue.cjs",
32
+ "types": "./dist/vue/index.d.ts"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "scripts": {
39
+ "build": "vite build && vite build --config vite.umd.config.ts && tsc -p tsconfig.json --emitDeclarationOnly",
40
+ "dev": "vite build --watch",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit",
42
+ "test": "vitest run",
43
+ "test:watch": "vitest",
44
+ "lint": "eslint src --ext .ts",
45
+ "docs": "typedoc --options typedoc.json"
46
+ },
47
+ "peerDependencies": {
48
+ "three": ">=0.165.0",
49
+ "react": ">=18.0.0",
50
+ "vue": ">=3.0.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "react": { "optional": true },
54
+ "vue": { "optional": true }
55
+ },
56
+ "devDependencies": {
57
+ "@types/react": "^18.0.0",
58
+ "@types/three": "^0.165.0",
59
+ "jsdom": "^29.1.1",
60
+ "react": "^18.0.0",
61
+ "three": "^0.165.0",
62
+ "typedoc": "^0.28.19",
63
+ "vite": "^5.4.0",
64
+ "vite-plugin-dts": "^4.0.0",
65
+ "vitest": "^2.0.0",
66
+ "vue": "^3.0.0"
67
+ },
68
+ "dependencies": {
69
+ "@pixiv/three-vrm": "^3.5.4"
70
+ }
71
+ }