@asiyst/sdk 0.1.27 → 0.1.28
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.cjs +170 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +170 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -530,7 +530,8 @@ declare class FbxRenderer {
|
|
|
530
530
|
mount(container: HTMLElement, asset: LoadedFbxAsset | LoadedGlbAsset, options?: FbxMountOptions): Promise<FbxRenderMetrics>;
|
|
531
531
|
setFacing(direction: "left" | "right"): void;
|
|
532
532
|
setPose(pose: AvatarPose): void;
|
|
533
|
-
|
|
533
|
+
startInitialIdleAnimation(config?: Partial<ProjectConfig>): boolean;
|
|
534
|
+
loadExternalAnimations(animations: AvatarAnimation[], targetAnimationName?: string): Promise<void>;
|
|
534
535
|
retargetClip(clip: THREE.AnimationClip, targetObject: THREE.Object3D): THREE.AnimationClip | null;
|
|
535
536
|
playAnimation(nameOrIntent: string, loopMode?: string, crossFadeDuration?: number): boolean;
|
|
536
537
|
isRendered(): boolean;
|
|
@@ -580,7 +581,7 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
580
581
|
applyConfig(config: ProjectConfig): void;
|
|
581
582
|
setPanelOpen(open: boolean): void;
|
|
582
583
|
loadAsset(config: ProjectConfig): Promise<boolean>;
|
|
583
|
-
|
|
584
|
+
renderLoader(): void;
|
|
584
585
|
private renderLoadedAsset;
|
|
585
586
|
private renderFallback;
|
|
586
587
|
setPosition(x: number, y: number, animate: boolean): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -530,7 +530,8 @@ declare class FbxRenderer {
|
|
|
530
530
|
mount(container: HTMLElement, asset: LoadedFbxAsset | LoadedGlbAsset, options?: FbxMountOptions): Promise<FbxRenderMetrics>;
|
|
531
531
|
setFacing(direction: "left" | "right"): void;
|
|
532
532
|
setPose(pose: AvatarPose): void;
|
|
533
|
-
|
|
533
|
+
startInitialIdleAnimation(config?: Partial<ProjectConfig>): boolean;
|
|
534
|
+
loadExternalAnimations(animations: AvatarAnimation[], targetAnimationName?: string): Promise<void>;
|
|
534
535
|
retargetClip(clip: THREE.AnimationClip, targetObject: THREE.Object3D): THREE.AnimationClip | null;
|
|
535
536
|
playAnimation(nameOrIntent: string, loopMode?: string, crossFadeDuration?: number): boolean;
|
|
536
537
|
isRendered(): boolean;
|
|
@@ -580,7 +581,7 @@ declare class CssAvatarRenderer implements AvatarRenderer {
|
|
|
580
581
|
applyConfig(config: ProjectConfig): void;
|
|
581
582
|
setPanelOpen(open: boolean): void;
|
|
582
583
|
loadAsset(config: ProjectConfig): Promise<boolean>;
|
|
583
|
-
|
|
584
|
+
renderLoader(): void;
|
|
584
585
|
private renderLoadedAsset;
|
|
585
586
|
private renderFallback;
|
|
586
587
|
setPosition(x: number, y: number, animate: boolean): void;
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var ALL_ACTION_KINDS = [
|
|
|
75
75
|
// src/core/constants.ts
|
|
76
76
|
function resolveSdkVersion() {
|
|
77
77
|
{
|
|
78
|
-
return "0.1.
|
|
78
|
+
return "0.1.28";
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
var SDK_VERSION = resolveSdkVersion();
|
|
@@ -2220,6 +2220,7 @@ var FbxRenderer = class {
|
|
|
2220
2220
|
this.canvas.setAttribute("role", "presentation");
|
|
2221
2221
|
this.canvas.style.opacity = "0";
|
|
2222
2222
|
this.canvas.style.transition = "opacity 0.25s ease";
|
|
2223
|
+
this.canvas.style.background = "transparent";
|
|
2223
2224
|
const glContext = this.canvas.getContext("webgl2") || this.canvas.getContext("webgl");
|
|
2224
2225
|
if (!glContext) {
|
|
2225
2226
|
throw new Error("WebGLRenderingContext is not available or supported in this browser environment");
|
|
@@ -2239,6 +2240,7 @@ var FbxRenderer = class {
|
|
|
2239
2240
|
antialias: true,
|
|
2240
2241
|
powerPreference: "high-performance"
|
|
2241
2242
|
});
|
|
2243
|
+
this.renderer.setClearColor(0, 0);
|
|
2242
2244
|
this.renderer.setPixelRatio(Math.min(dpr, 2));
|
|
2243
2245
|
this.renderer.setSize(width, height, false);
|
|
2244
2246
|
this.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
@@ -2336,13 +2338,23 @@ var FbxRenderer = class {
|
|
|
2336
2338
|
this.rawObject = rawObject;
|
|
2337
2339
|
this.mixer = new THREE.AnimationMixer(rawObject);
|
|
2338
2340
|
this.allAnimations = [...modelAnimations];
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2341
|
+
const externalAnims = options?.config?.animations || options?.config?.avatar?.animations || [];
|
|
2342
|
+
if (externalAnims.length > 0) {
|
|
2343
|
+
try {
|
|
2344
|
+
await Promise.race([
|
|
2345
|
+
this.loadExternalAnimations(externalAnims, options?.config?.animation),
|
|
2346
|
+
new Promise((resolve) => setTimeout(resolve, 8e3))
|
|
2347
|
+
]);
|
|
2348
|
+
} catch (animErr) {
|
|
2349
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
2350
|
+
console.warn("[asiyst] External animation loading notice:", animErr);
|
|
2351
|
+
}
|
|
2344
2352
|
}
|
|
2345
2353
|
}
|
|
2354
|
+
this.startInitialIdleAnimation(options?.config);
|
|
2355
|
+
if (this.mixer) {
|
|
2356
|
+
this.mixer.update(0);
|
|
2357
|
+
}
|
|
2346
2358
|
container.replaceChildren();
|
|
2347
2359
|
container.appendChild(this.canvas);
|
|
2348
2360
|
try {
|
|
@@ -2358,9 +2370,6 @@ var FbxRenderer = class {
|
|
|
2358
2370
|
this.startLoop();
|
|
2359
2371
|
this.setFacing(this.facing);
|
|
2360
2372
|
this.setPose(this.currentPose);
|
|
2361
|
-
if (options?.config?.animations && options.config.animations.length > 0) {
|
|
2362
|
-
void this.loadExternalAnimations(options.config.animations);
|
|
2363
|
-
}
|
|
2364
2373
|
if (typeof window !== "undefined") {
|
|
2365
2374
|
this.resizeListener = () => this.handleResize();
|
|
2366
2375
|
window.addEventListener("resize", this.resizeListener);
|
|
@@ -2368,7 +2377,7 @@ var FbxRenderer = class {
|
|
|
2368
2377
|
return {
|
|
2369
2378
|
meshCount,
|
|
2370
2379
|
vertexCount: totalVertices,
|
|
2371
|
-
animationCount:
|
|
2380
|
+
animationCount: this.allAnimations.length
|
|
2372
2381
|
};
|
|
2373
2382
|
}
|
|
2374
2383
|
setFacing(direction) {
|
|
@@ -2379,11 +2388,10 @@ var FbxRenderer = class {
|
|
|
2379
2388
|
}
|
|
2380
2389
|
setPose(pose) {
|
|
2381
2390
|
this.currentPose = pose;
|
|
2382
|
-
if (!this.modelRoot) return;
|
|
2383
2391
|
if (this.playAnimation(pose)) {
|
|
2384
2392
|
return;
|
|
2385
2393
|
}
|
|
2386
|
-
if (this.mixer && this.allAnimations.length >
|
|
2394
|
+
if (this.mixer && this.allAnimations.length > 0) {
|
|
2387
2395
|
let targetClip;
|
|
2388
2396
|
if (pose === "speak") {
|
|
2389
2397
|
targetClip = this.allAnimations.find(
|
|
@@ -2394,7 +2402,7 @@ var FbxRenderer = class {
|
|
|
2394
2402
|
(c) => c.name.toLowerCase().includes("think")
|
|
2395
2403
|
);
|
|
2396
2404
|
} else {
|
|
2397
|
-
targetClip = this.allAnimations.find((c) => c.name.toLowerCase().includes("idle")) || this.allAnimations[0];
|
|
2405
|
+
targetClip = this.allAnimations.find((c) => c.name.toLowerCase().includes("idle")) || this.animationMetadataList[0]?.clip || this.allAnimations[0];
|
|
2398
2406
|
}
|
|
2399
2407
|
if (targetClip) {
|
|
2400
2408
|
const newAction = this.mixer.clipAction(targetClip);
|
|
@@ -2405,9 +2413,14 @@ var FbxRenderer = class {
|
|
|
2405
2413
|
}
|
|
2406
2414
|
this.currentAction = newAction;
|
|
2407
2415
|
return;
|
|
2416
|
+
} else if (!this.currentAction?.isRunning()) {
|
|
2417
|
+
this.currentAction?.play();
|
|
2418
|
+
return;
|
|
2408
2419
|
}
|
|
2420
|
+
return;
|
|
2409
2421
|
}
|
|
2410
2422
|
}
|
|
2423
|
+
if (!this.modelRoot) return;
|
|
2411
2424
|
switch (pose) {
|
|
2412
2425
|
case "point":
|
|
2413
2426
|
this.modelRoot.rotation.z = -0.15;
|
|
@@ -2433,7 +2446,55 @@ var FbxRenderer = class {
|
|
|
2433
2446
|
break;
|
|
2434
2447
|
}
|
|
2435
2448
|
}
|
|
2436
|
-
|
|
2449
|
+
startInitialIdleAnimation(config) {
|
|
2450
|
+
if (!this.mixer) return false;
|
|
2451
|
+
const targetQuery = config?.animation?.trim();
|
|
2452
|
+
if (targetQuery && this.playAnimation(targetQuery)) {
|
|
2453
|
+
return true;
|
|
2454
|
+
}
|
|
2455
|
+
const idleByIntent = this.animationMetadataList.find(
|
|
2456
|
+
(m) => m.intent?.toLowerCase() === "idle"
|
|
2457
|
+
);
|
|
2458
|
+
if (idleByIntent && this.playAnimation(idleByIntent.id || idleByIntent.name)) {
|
|
2459
|
+
return true;
|
|
2460
|
+
}
|
|
2461
|
+
const idleByName = this.animationMetadataList.find(
|
|
2462
|
+
(m) => m.name.toLowerCase().includes("idle") || m.clipName && m.clipName.toLowerCase().includes("idle")
|
|
2463
|
+
);
|
|
2464
|
+
if (idleByName && this.playAnimation(idleByName.id || idleByName.name)) {
|
|
2465
|
+
return true;
|
|
2466
|
+
}
|
|
2467
|
+
const embeddedIdle = this.allAnimations.find(
|
|
2468
|
+
(c) => c.name.toLowerCase().includes("idle")
|
|
2469
|
+
);
|
|
2470
|
+
if (embeddedIdle) {
|
|
2471
|
+
const action = this.mixer.clipAction(embeddedIdle);
|
|
2472
|
+
if (this.currentAction !== action) {
|
|
2473
|
+
action.reset().fadeIn(0.25).play();
|
|
2474
|
+
if (this.currentAction) this.currentAction.fadeOut(0.25);
|
|
2475
|
+
this.currentAction = action;
|
|
2476
|
+
}
|
|
2477
|
+
return true;
|
|
2478
|
+
}
|
|
2479
|
+
if (this.animationMetadataList.length > 0) {
|
|
2480
|
+
const firstMeta = this.animationMetadataList[0];
|
|
2481
|
+
if (this.playAnimation(firstMeta.id || firstMeta.name)) {
|
|
2482
|
+
return true;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
if (this.allAnimations.length > 0) {
|
|
2486
|
+
const firstClip = this.allAnimations[0];
|
|
2487
|
+
const action = this.mixer.clipAction(firstClip);
|
|
2488
|
+
if (this.currentAction !== action) {
|
|
2489
|
+
action.reset().fadeIn(0.25).play();
|
|
2490
|
+
if (this.currentAction) this.currentAction.fadeOut(0.25);
|
|
2491
|
+
this.currentAction = action;
|
|
2492
|
+
}
|
|
2493
|
+
return true;
|
|
2494
|
+
}
|
|
2495
|
+
return false;
|
|
2496
|
+
}
|
|
2497
|
+
async loadExternalAnimations(animations, targetAnimationName) {
|
|
2437
2498
|
if (!this.rawObject || !this.mixer) return;
|
|
2438
2499
|
for (const anim of animations) {
|
|
2439
2500
|
if (!anim.assetUrl) continue;
|
|
@@ -2471,11 +2532,6 @@ var FbxRenderer = class {
|
|
|
2471
2532
|
loopMode: anim.loopMode,
|
|
2472
2533
|
clip: retargeted
|
|
2473
2534
|
});
|
|
2474
|
-
const animIntent = anim.intent?.toLowerCase();
|
|
2475
|
-
const animName = anim.name.toLowerCase();
|
|
2476
|
-
if (animIntent === this.currentPose || this.currentPose === "idle" && (animIntent === "idle" || animName === "idle")) {
|
|
2477
|
-
this.playAnimation(anim.id || anim.name || this.currentPose, anim.loopMode);
|
|
2478
|
-
}
|
|
2479
2535
|
}
|
|
2480
2536
|
} catch (err) {
|
|
2481
2537
|
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
@@ -2484,37 +2540,66 @@ var FbxRenderer = class {
|
|
|
2484
2540
|
}
|
|
2485
2541
|
}
|
|
2486
2542
|
}
|
|
2543
|
+
if (this.currentPose === "idle" || targetAnimationName) {
|
|
2544
|
+
this.startInitialIdleAnimation({ animation: targetAnimationName });
|
|
2545
|
+
if (this.mixer) {
|
|
2546
|
+
this.mixer.update(0);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2487
2549
|
}
|
|
2488
2550
|
retargetClip(clip, targetObject) {
|
|
2489
2551
|
const targetNodeNames = /* @__PURE__ */ new Set();
|
|
2490
|
-
const
|
|
2552
|
+
const boneLookup = /* @__PURE__ */ new Map();
|
|
2553
|
+
const cleanBoneName = (name) => {
|
|
2554
|
+
return name.replace(/^.*[:|/]/, "").replace(/^(mixamorig\d*|bip01|armature|root)[:_ ]?/i, "").replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
2555
|
+
};
|
|
2491
2556
|
targetObject.traverse((node) => {
|
|
2492
2557
|
if (node.name) {
|
|
2493
2558
|
targetNodeNames.add(node.name);
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2496
|
-
|
|
2559
|
+
const lower = node.name.toLowerCase();
|
|
2560
|
+
const simpleClean = node.name.replace(/^.*[:|/]/, "").toLowerCase();
|
|
2561
|
+
const stripped = cleanBoneName(node.name);
|
|
2562
|
+
if (!boneLookup.has(lower)) boneLookup.set(lower, node.name);
|
|
2563
|
+
if (!boneLookup.has(simpleClean)) boneLookup.set(simpleClean, node.name);
|
|
2564
|
+
if (stripped && !boneLookup.has(stripped)) boneLookup.set(stripped, node.name);
|
|
2497
2565
|
}
|
|
2498
2566
|
});
|
|
2567
|
+
const isRootOrHips = (name) => {
|
|
2568
|
+
const clean = cleanBoneName(name);
|
|
2569
|
+
return clean === "hips" || clean === "pelvis" || clean === "root";
|
|
2570
|
+
};
|
|
2499
2571
|
const validTracks = [];
|
|
2500
2572
|
for (const track of clip.tracks) {
|
|
2501
2573
|
const dotIdx = track.name.lastIndexOf(".");
|
|
2502
2574
|
if (dotIdx === -1) continue;
|
|
2503
2575
|
const nodePart = track.name.substring(0, dotIdx);
|
|
2504
2576
|
const propPart = track.name.substring(dotIdx);
|
|
2577
|
+
let matchedNodeName;
|
|
2505
2578
|
if (targetNodeNames.has(nodePart)) {
|
|
2506
|
-
|
|
2579
|
+
matchedNodeName = nodePart;
|
|
2507
2580
|
} else {
|
|
2508
|
-
const
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2581
|
+
const lower = nodePart.toLowerCase();
|
|
2582
|
+
const simpleClean = nodePart.replace(/^.*[:|/]/, "").toLowerCase();
|
|
2583
|
+
const stripped = cleanBoneName(nodePart);
|
|
2584
|
+
matchedNodeName = boneLookup.get(lower) || boneLookup.get(simpleClean) || boneLookup.get(stripped);
|
|
2585
|
+
}
|
|
2586
|
+
if (matchedNodeName) {
|
|
2587
|
+
if (propPart.toLowerCase().startsWith(".position") && !isRootOrHips(matchedNodeName)) {
|
|
2588
|
+
continue;
|
|
2589
|
+
}
|
|
2590
|
+
if (matchedNodeName === nodePart) {
|
|
2591
|
+
validTracks.push(track);
|
|
2592
|
+
} else {
|
|
2511
2593
|
const clonedTrack = track.clone();
|
|
2512
|
-
clonedTrack.name = `${
|
|
2594
|
+
clonedTrack.name = `${matchedNodeName}${propPart}`;
|
|
2513
2595
|
validTracks.push(clonedTrack);
|
|
2514
2596
|
}
|
|
2515
2597
|
}
|
|
2516
2598
|
}
|
|
2517
|
-
if (validTracks.length === 0) {
|
|
2599
|
+
if (validTracks.length === 0 || clip.duration <= 0) {
|
|
2600
|
+
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
2601
|
+
console.warn(`[asiyst] External animation "${clip.name}" has no compatible bone tracks for this avatar skeleton.`);
|
|
2602
|
+
}
|
|
2518
2603
|
return null;
|
|
2519
2604
|
}
|
|
2520
2605
|
return new THREE.AnimationClip(clip.name, clip.duration, validTracks);
|
|
@@ -2559,6 +2644,8 @@ var FbxRenderer = class {
|
|
|
2559
2644
|
this.currentAction.fadeOut(crossFadeDuration);
|
|
2560
2645
|
}
|
|
2561
2646
|
this.currentAction = action;
|
|
2647
|
+
} else if (!action.isRunning()) {
|
|
2648
|
+
action.reset().play();
|
|
2562
2649
|
}
|
|
2563
2650
|
return true;
|
|
2564
2651
|
}
|
|
@@ -2699,20 +2786,23 @@ var AVATAR_CSS = `
|
|
|
2699
2786
|
transition: left 420ms cubic-bezier(0.22, 1, 0.36, 1), top 420ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
2700
2787
|
}
|
|
2701
2788
|
.asiyst-figure {
|
|
2702
|
-
border-radius: 28px;
|
|
2703
2789
|
display: grid;
|
|
2704
2790
|
place-items: center;
|
|
2705
|
-
color: #fff;
|
|
2706
|
-
font: 700 14px/1.2 system-ui, sans-serif;
|
|
2707
|
-
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
|
|
2708
2791
|
position: relative;
|
|
2709
|
-
overflow: hidden;
|
|
2710
2792
|
cursor: pointer;
|
|
2711
2793
|
border: none;
|
|
2712
2794
|
padding: 0;
|
|
2713
2795
|
outline: none;
|
|
2796
|
+
background: transparent;
|
|
2797
|
+
overflow: visible;
|
|
2798
|
+
}
|
|
2799
|
+
.asiyst-figure.asiyst-compact-launcher {
|
|
2800
|
+
border-radius: 28px;
|
|
2801
|
+
color: #fff;
|
|
2802
|
+
font: 700 14px/1.2 system-ui, sans-serif;
|
|
2803
|
+
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
|
|
2804
|
+
overflow: hidden;
|
|
2714
2805
|
background: #2563eb;
|
|
2715
|
-
transition: width 0.3s ease, height 0.3s ease, background 0.3s ease;
|
|
2716
2806
|
}
|
|
2717
2807
|
.asiyst-figure.asiyst-3d-active {
|
|
2718
2808
|
width: 240px !important;
|
|
@@ -2879,7 +2969,7 @@ var AVATAR_CSS = `
|
|
|
2879
2969
|
var CssAvatarRenderer = class {
|
|
2880
2970
|
constructor() {
|
|
2881
2971
|
this.size = 96;
|
|
2882
|
-
this.hidden =
|
|
2972
|
+
this.hidden = true;
|
|
2883
2973
|
this.facing = "right";
|
|
2884
2974
|
this.pose = "idle";
|
|
2885
2975
|
this.accentColor = "#2563eb";
|
|
@@ -2901,6 +2991,9 @@ var CssAvatarRenderer = class {
|
|
|
2901
2991
|
this.root = doc.createElement("div");
|
|
2902
2992
|
this.root.className = "asiyst-avatar asiyst-animate";
|
|
2903
2993
|
this.root.setAttribute("role", "img");
|
|
2994
|
+
if (this.hidden) {
|
|
2995
|
+
this.root.style.display = "none";
|
|
2996
|
+
}
|
|
2904
2997
|
this.nameTagEl = doc.createElement("div");
|
|
2905
2998
|
this.nameTagEl.className = "asiyst-name-tag";
|
|
2906
2999
|
const sparkle = doc.createElement("span");
|
|
@@ -2963,7 +3056,7 @@ var CssAvatarRenderer = class {
|
|
|
2963
3056
|
this.size = config.size;
|
|
2964
3057
|
this.accentColor = config.theme.accent ?? "#2563eb";
|
|
2965
3058
|
this.avatarName = config.avatarName;
|
|
2966
|
-
const has3dAsset = Boolean(config.assetUrl || config.thumbnailUrl);
|
|
3059
|
+
const has3dAsset = Boolean(config.assetUrl || config.thumbnailUrl || config.avatarId);
|
|
2967
3060
|
this.has3dAssetConfigured = has3dAsset;
|
|
2968
3061
|
if (config.assetUrl || config.thumbnailUrl) {
|
|
2969
3062
|
this.activeAssetUrl = config.assetUrl ?? config.thumbnailUrl ?? void 0;
|
|
@@ -2983,10 +3076,14 @@ var CssAvatarRenderer = class {
|
|
|
2983
3076
|
if (has3dAsset) {
|
|
2984
3077
|
if (this.figure) {
|
|
2985
3078
|
this.figure.classList.add("asiyst-3d-active");
|
|
3079
|
+
this.figure.classList.remove("asiyst-compact-launcher");
|
|
2986
3080
|
this.figure.style.width = "";
|
|
2987
3081
|
this.figure.style.height = "";
|
|
2988
3082
|
this.figure.style.background = "transparent";
|
|
2989
3083
|
}
|
|
3084
|
+
if (this.nameTagEl) {
|
|
3085
|
+
this.nameTagEl.style.display = this.isAssetLoadedFlag ? "inline-flex" : "none";
|
|
3086
|
+
}
|
|
2990
3087
|
if (this.chatActionBtn) {
|
|
2991
3088
|
this.chatActionBtn.style.display = this.isAssetLoadedFlag && !this.isPanelOpen ? "inline-flex" : "none";
|
|
2992
3089
|
}
|
|
@@ -2994,16 +3091,20 @@ var CssAvatarRenderer = class {
|
|
|
2994
3091
|
if (this.renderState === "error") {
|
|
2995
3092
|
this.renderFallback(true);
|
|
2996
3093
|
} else {
|
|
2997
|
-
this.
|
|
3094
|
+
this.viewport.replaceChildren();
|
|
2998
3095
|
}
|
|
2999
3096
|
}
|
|
3000
3097
|
} else {
|
|
3001
3098
|
if (this.figure) {
|
|
3002
3099
|
this.figure.classList.remove("asiyst-3d-active");
|
|
3100
|
+
this.figure.classList.add("asiyst-compact-launcher");
|
|
3003
3101
|
this.figure.style.width = `${config.size}px`;
|
|
3004
3102
|
this.figure.style.height = `${config.size}px`;
|
|
3005
3103
|
this.figure.style.background = this.accentColor;
|
|
3006
3104
|
}
|
|
3105
|
+
if (this.nameTagEl) {
|
|
3106
|
+
this.nameTagEl.style.display = "none";
|
|
3107
|
+
}
|
|
3007
3108
|
if (this.chatActionBtn) {
|
|
3008
3109
|
this.chatActionBtn.style.display = "none";
|
|
3009
3110
|
}
|
|
@@ -3035,11 +3136,20 @@ var CssAvatarRenderer = class {
|
|
|
3035
3136
|
if (this.figure) {
|
|
3036
3137
|
this.figure.setAttribute("data-state", "loading");
|
|
3037
3138
|
this.figure.classList.add("asiyst-3d-active");
|
|
3139
|
+
this.figure.classList.remove("asiyst-compact-launcher");
|
|
3038
3140
|
this.figure.style.width = "";
|
|
3039
3141
|
this.figure.style.height = "";
|
|
3040
3142
|
this.figure.style.background = "transparent";
|
|
3041
3143
|
}
|
|
3042
|
-
this.
|
|
3144
|
+
if (this.nameTagEl) {
|
|
3145
|
+
this.nameTagEl.style.display = "none";
|
|
3146
|
+
}
|
|
3147
|
+
if (this.chatActionBtn) {
|
|
3148
|
+
this.chatActionBtn.style.display = "none";
|
|
3149
|
+
}
|
|
3150
|
+
if (this.viewport) {
|
|
3151
|
+
this.renderLoader();
|
|
3152
|
+
}
|
|
3043
3153
|
try {
|
|
3044
3154
|
const asset = await this.assetLoader.load(assetUrl, { timeoutMs: 6e4 });
|
|
3045
3155
|
await this.renderLoadedAsset(asset, config);
|
|
@@ -3050,10 +3160,14 @@ var CssAvatarRenderer = class {
|
|
|
3050
3160
|
if (this.figure) {
|
|
3051
3161
|
this.figure.setAttribute("data-state", "ready");
|
|
3052
3162
|
this.figure.classList.add("asiyst-3d-active");
|
|
3163
|
+
this.figure.classList.remove("asiyst-compact-launcher");
|
|
3053
3164
|
this.figure.style.width = "";
|
|
3054
3165
|
this.figure.style.height = "";
|
|
3055
3166
|
this.figure.style.background = "transparent";
|
|
3056
3167
|
}
|
|
3168
|
+
if (this.nameTagEl) {
|
|
3169
|
+
this.nameTagEl.style.display = "inline-flex";
|
|
3170
|
+
}
|
|
3057
3171
|
if (this.chatActionBtn) {
|
|
3058
3172
|
this.chatActionBtn.style.display = this.isPanelOpen ? "none" : "inline-flex";
|
|
3059
3173
|
}
|
|
@@ -3066,6 +3180,14 @@ var CssAvatarRenderer = class {
|
|
|
3066
3180
|
this.isFallbackFlag = true;
|
|
3067
3181
|
if (this.figure) {
|
|
3068
3182
|
this.figure.setAttribute("data-state", "error");
|
|
3183
|
+
this.figure.classList.remove("asiyst-3d-active");
|
|
3184
|
+
this.figure.classList.add("asiyst-compact-launcher");
|
|
3185
|
+
this.figure.style.width = `${this.size}px`;
|
|
3186
|
+
this.figure.style.height = `${this.size}px`;
|
|
3187
|
+
this.figure.style.background = this.accentColor;
|
|
3188
|
+
}
|
|
3189
|
+
if (this.nameTagEl) {
|
|
3190
|
+
this.nameTagEl.style.display = "none";
|
|
3069
3191
|
}
|
|
3070
3192
|
if (this.chatActionBtn) {
|
|
3071
3193
|
this.chatActionBtn.style.display = "none";
|
|
@@ -4527,7 +4649,6 @@ var AsiystRuntime = class {
|
|
|
4527
4649
|
this.movement.start();
|
|
4528
4650
|
this.analytics.start();
|
|
4529
4651
|
this.rescan();
|
|
4530
|
-
this.avatar.show();
|
|
4531
4652
|
const figure = this.renderer.getFigure();
|
|
4532
4653
|
if (figure) {
|
|
4533
4654
|
this.figureClickListener = () => this.open();
|
|
@@ -4552,7 +4673,6 @@ var AsiystRuntime = class {
|
|
|
4552
4673
|
return;
|
|
4553
4674
|
}
|
|
4554
4675
|
this.avatar.applyConfig(cfg);
|
|
4555
|
-
this.avatar.show();
|
|
4556
4676
|
this.movement.goToAnchor();
|
|
4557
4677
|
this.lifecycle.emit("sdk.verification_started", {
|
|
4558
4678
|
projectId: this.options.projectId,
|
|
@@ -4578,7 +4698,15 @@ var AsiystRuntime = class {
|
|
|
4578
4698
|
});
|
|
4579
4699
|
const assetTarget = cfg.assetUrl ?? cfg.thumbnailUrl;
|
|
4580
4700
|
if (assetTarget) {
|
|
4581
|
-
|
|
4701
|
+
try {
|
|
4702
|
+
await this.loadAvatarAsset(cfg, assetTarget);
|
|
4703
|
+
} finally {
|
|
4704
|
+
this.avatar.show();
|
|
4705
|
+
this.movement.goToAnchor();
|
|
4706
|
+
}
|
|
4707
|
+
} else {
|
|
4708
|
+
this.avatar.show();
|
|
4709
|
+
this.movement.goToAnchor();
|
|
4582
4710
|
}
|
|
4583
4711
|
this.startConfigRevalidationScheduler();
|
|
4584
4712
|
}
|