@staylift-tech/conv-widget 0.0.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/README.md +220 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-BDscJkkF.js +1464 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/staylift-orb.cjs.entry.js +117 -0
- package/dist/cjs/staylift-widget.cjs.entry.js +26479 -0
- package/dist/cjs/staylift-widget.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/staylift-orb/staylift-orb.css +15 -0
- package/dist/collection/components/staylift-orb/staylift-orb.js +229 -0
- package/dist/collection/components/staylift-widget/staylift-widget.css +578 -0
- package/dist/collection/components/staylift-widget/staylift-widget.js +898 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/types.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-DnOZjbwA.js +1 -0
- package/dist/components/staylift-orb.d.ts +11 -0
- package/dist/components/staylift-orb.js +1 -0
- package/dist/components/staylift-widget.d.ts +11 -0
- package/dist/components/staylift-widget.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-DAtfDq5B.js +1456 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/staylift-orb.entry.js +115 -0
- package/dist/esm/staylift-widget.entry.js +26477 -0
- package/dist/esm/staylift-widget.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/staylift-widget/index.esm.js +1 -0
- package/dist/staylift-widget/p-37510f2e.entry.js +1 -0
- package/dist/staylift-widget/p-94923740.entry.js +1 -0
- package/dist/staylift-widget/p-DAtfDq5B.js +2 -0
- package/dist/staylift-widget/p-DQuL1Twl.js +1 -0
- package/dist/staylift-widget/staylift-widget.esm.js +1 -0
- package/dist/types/components/staylift-orb/staylift-orb.d.ts +19 -0
- package/dist/types/components/staylift-widget/staylift-widget.d.ts +80 -0
- package/dist/types/components.d.ts +212 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +1839 -0
- package/dist/types/types.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +58 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { b as bootstrapLazy } from './index-DAtfDq5B.js';
|
|
2
|
+
export { s as setNonce } from './index-DAtfDq5B.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
|
+
|
|
5
|
+
const defineCustomElements = async (win, options) => {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
await globalScripts();
|
|
8
|
+
return bootstrapLazy([["staylift-orb",[[1,"staylift-orb",{"inputVolume":[2,"input-volume"],"outputVolume":[2,"output-volume"],"isActive":[4,"is-active"],"primaryColor":[1,"primary-color"],"size":[8],"animationFrame":[32]}]]],["staylift-widget",[[1,"staylift-widget",{"agentId":[1,"agent-id"],"positionX":[1,"position-x"],"positionY":[1,"position-y"],"variant":[1],"mode":[1],"primaryColor":[1,"primary-color"],"brandName":[1,"brand-name"],"language":[1],"autoExpand":[4,"auto-expand"],"showBranding":[4,"show-branding"],"avatarUrl":[1,"avatar-url"],"fabPrompt":[1,"fab-prompt"],"fabButtonText":[1,"fab-button-text"],"status":[32],"isExpanded":[32],"termsAccepted":[32],"errorMessage":[32],"inputVolume":[32],"outputVolume":[32],"messages":[32],"inputText":[32],"copiedIndex":[32],"startConversation":[64],"endConversation":[64],"getStatus":[64],"sendMessage":[64]}]]]], options);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { defineCustomElements };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-DAtfDq5B.js';
|
|
2
|
+
|
|
3
|
+
const stayliftOrbCss = () => `:host{display:block}.orb-container{position:relative;border-radius:50%;overflow:hidden;background:linear-gradient(145deg, #f8f9fa, #e9ecef)}canvas{display:block;border-radius:50%}`;
|
|
4
|
+
|
|
5
|
+
const StayliftOrb = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.inputVolume = 0;
|
|
9
|
+
this.outputVolume = 0;
|
|
10
|
+
this.isActive = false;
|
|
11
|
+
this.primaryColor = '#6366f1';
|
|
12
|
+
this.size = 'medium';
|
|
13
|
+
this.animationFrame = 0;
|
|
14
|
+
this.rafId = null;
|
|
15
|
+
this.ctx = null;
|
|
16
|
+
}
|
|
17
|
+
componentDidLoad() {
|
|
18
|
+
this.setupCanvas();
|
|
19
|
+
this.startAnimation();
|
|
20
|
+
}
|
|
21
|
+
disconnectedCallback() {
|
|
22
|
+
if (this.rafId)
|
|
23
|
+
cancelAnimationFrame(this.rafId);
|
|
24
|
+
}
|
|
25
|
+
setupCanvas() {
|
|
26
|
+
if (!this.canvasRef)
|
|
27
|
+
return;
|
|
28
|
+
const dpr = window.devicePixelRatio || 1;
|
|
29
|
+
const rect = this.canvasRef.getBoundingClientRect();
|
|
30
|
+
this.canvasRef.width = rect.width * dpr;
|
|
31
|
+
this.canvasRef.height = rect.height * dpr;
|
|
32
|
+
this.ctx = this.canvasRef.getContext('2d');
|
|
33
|
+
if (this.ctx)
|
|
34
|
+
this.ctx.scale(dpr, dpr);
|
|
35
|
+
}
|
|
36
|
+
startAnimation() {
|
|
37
|
+
const animate = () => {
|
|
38
|
+
this.drawOrb();
|
|
39
|
+
this.rafId = requestAnimationFrame(animate);
|
|
40
|
+
};
|
|
41
|
+
animate();
|
|
42
|
+
}
|
|
43
|
+
drawOrb() {
|
|
44
|
+
if (!this.ctx || !this.canvasRef)
|
|
45
|
+
return;
|
|
46
|
+
const width = this.canvasRef.clientWidth;
|
|
47
|
+
const height = this.canvasRef.clientHeight;
|
|
48
|
+
const centerX = width / 2;
|
|
49
|
+
const centerY = height / 2;
|
|
50
|
+
const baseRadius = Math.min(width, height) / 2 - 4;
|
|
51
|
+
this.ctx.clearRect(0, 0, width, height);
|
|
52
|
+
const combinedVolume = Math.max(this.inputVolume, this.outputVolume);
|
|
53
|
+
const pulse = this.isActive ? 1 + combinedVolume * 0.15 : 1;
|
|
54
|
+
const radius = baseRadius * pulse;
|
|
55
|
+
const color = this.hexToRgb(this.primaryColor || '#10b981');
|
|
56
|
+
if (this.isActive && combinedVolume > 0.1) {
|
|
57
|
+
const glowRadius = radius + 10 + combinedVolume * 20;
|
|
58
|
+
const gradient = this.ctx.createRadialGradient(centerX, centerY, radius, centerX, centerY, glowRadius);
|
|
59
|
+
gradient.addColorStop(0, `rgba(${color.r}, ${color.g}, ${color.b}, ${0.3 * combinedVolume})`);
|
|
60
|
+
gradient.addColorStop(1, `rgba(${color.r}, ${color.g}, ${color.b}, 0)`);
|
|
61
|
+
this.ctx.beginPath();
|
|
62
|
+
this.ctx.arc(centerX, centerY, glowRadius, 0, Math.PI * 2);
|
|
63
|
+
this.ctx.fillStyle = gradient;
|
|
64
|
+
this.ctx.fill();
|
|
65
|
+
}
|
|
66
|
+
const orbGradient = this.ctx.createRadialGradient(centerX - radius * 0.3, centerY - radius * 0.3, 0, centerX, centerY, radius);
|
|
67
|
+
if (this.isActive) {
|
|
68
|
+
orbGradient.addColorStop(0, `rgba(${color.r + 40}, ${color.g + 40}, ${color.b + 40}, 1)`);
|
|
69
|
+
orbGradient.addColorStop(0.5, `rgba(${color.r}, ${color.g}, ${color.b}, 1)`);
|
|
70
|
+
orbGradient.addColorStop(1, `rgba(${Math.max(0, color.r - 30)}, ${Math.max(0, color.g - 30)}, ${Math.max(0, color.b - 30)}, 1)`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
orbGradient.addColorStop(0, '#6b7280');
|
|
74
|
+
orbGradient.addColorStop(0.5, '#4b5563');
|
|
75
|
+
orbGradient.addColorStop(1, '#374151');
|
|
76
|
+
}
|
|
77
|
+
this.ctx.beginPath();
|
|
78
|
+
this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
79
|
+
this.ctx.fillStyle = orbGradient;
|
|
80
|
+
this.ctx.fill();
|
|
81
|
+
const highlightGradient = this.ctx.createRadialGradient(centerX - radius * 0.3, centerY - radius * 0.3, 0, centerX - radius * 0.3, centerY - radius * 0.3, radius * 0.6);
|
|
82
|
+
highlightGradient.addColorStop(0, 'rgba(255, 255, 255, 0.4)');
|
|
83
|
+
highlightGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
|
84
|
+
this.ctx.beginPath();
|
|
85
|
+
this.ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
86
|
+
this.ctx.fillStyle = highlightGradient;
|
|
87
|
+
this.ctx.fill();
|
|
88
|
+
if (this.isActive) {
|
|
89
|
+
this.animationFrame++;
|
|
90
|
+
for (let i = 0; i < 3; i++) {
|
|
91
|
+
const phase = (this.animationFrame * 0.02 + i / 3) % 1;
|
|
92
|
+
const ringRadius = radius + phase * 30;
|
|
93
|
+
const alpha = (1 - phase) * 0.3 * combinedVolume;
|
|
94
|
+
this.ctx.beginPath();
|
|
95
|
+
this.ctx.arc(centerX, centerY, ringRadius, 0, Math.PI * 2);
|
|
96
|
+
this.ctx.strokeStyle = `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
|
|
97
|
+
this.ctx.lineWidth = 2;
|
|
98
|
+
this.ctx.stroke();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
hexToRgb(hex) {
|
|
103
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
104
|
+
return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : { r: 16, g: 185, b: 129 };
|
|
105
|
+
}
|
|
106
|
+
render() {
|
|
107
|
+
const sizeClass = typeof this.size === 'number' ? '' : `orb--${this.size}`;
|
|
108
|
+
const customStyle = typeof this.size === 'number' ? { width: `${this.size}px`, height: `${this.size}px` } : {};
|
|
109
|
+
return (h("div", { key: '4ef2605968e04b6dc287db398f5ad730e63c08d3', class: `orb ${sizeClass} ${this.isActive ? 'orb--active' : ''}`, style: customStyle }, h("canvas", { key: '7875d17618d38a4ac0e693bb73d4502d6a66151b', ref: (el) => (this.canvasRef = el), class: "orb__canvas" })));
|
|
110
|
+
}
|
|
111
|
+
get el() { return getElement(this); }
|
|
112
|
+
};
|
|
113
|
+
StayliftOrb.style = stayliftOrbCss();
|
|
114
|
+
|
|
115
|
+
export { StayliftOrb as staylift_orb };
|