@callpromn/rtc-kit 0.0.2
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.txt +32 -0
- package/README.md +367 -0
- package/dist/index.d.mts +102 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +426 -0
- package/dist/index.mjs +426 -0
- package/package.json +48 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
var o=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}static get observedAttributes(){return ["to-phone-number","disabled","style","theme"]}attributeChangedCallback(r,t,e){r==="disabled"&&this.updateDisabledState(),r==="style"&&this.updateStyle(),r==="theme"&&this.render();}connectedCallback(){this.render();}disconnectedCallback(){}updateDisabledState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-call-btn");r&&(r.disabled=this.hasAttribute("disabled"));}updateStyle(){var t;let r=this.getAttribute("style");if(r){let e=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-call-btn");e&&(e.style.cssText=r);}}render(){if(!this.shadowRoot)return;let t=(this.getAttribute("theme")||"dark")==="dark";this.shadowRoot.innerHTML=`
|
|
2
|
+
<style>
|
|
3
|
+
.rtc-call-btn {
|
|
4
|
+
background-color: #03c400;
|
|
5
|
+
color: white;
|
|
6
|
+
border: none;
|
|
7
|
+
border-radius: 50%;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
transition: all 0.3s ease;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
box-shadow: ${t?"0 4px 15px rgba(3, 196, 0, 0.3)":"0 4px 15px rgba(3, 196, 0, 0.2)"};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.rtc-call-btn:hover {
|
|
19
|
+
background-color: #03d100;
|
|
20
|
+
transform: translateY(-1px);
|
|
21
|
+
box-shadow: ${t?"0 6px 20px rgba(3, 196, 0, 0.4)":"0 6px 20px rgba(3, 196, 0, 0.3)"};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rtc-call-btn:active {
|
|
25
|
+
transform: translateY(1px);
|
|
26
|
+
box-shadow: ${t?"0 2px 10px rgba(3, 196, 0, 0.3)":"0 2px 10px rgba(3, 196, 0, 0.2)"};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.rtc-call-btn:disabled {
|
|
30
|
+
background-color: ${t?"#6c757d":"#adb5bd"};
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
box-shadow: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.phone-icon {
|
|
36
|
+
width: 16px;
|
|
37
|
+
height: 16px;
|
|
38
|
+
fill: none;
|
|
39
|
+
stroke: currentColor;
|
|
40
|
+
stroke-width: 2;
|
|
41
|
+
stroke-linecap: round;
|
|
42
|
+
stroke-linejoin: round;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
|
|
46
|
+
<button class="rtc-call-btn" part="call-button" aria-label="Call button">
|
|
47
|
+
<svg class="phone-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
48
|
+
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
|
|
49
|
+
</svg>
|
|
50
|
+
</button>
|
|
51
|
+
`,this.updateDisabledState(),this.updateStyle();}};customElements.define("call-button",o);var p=o;var i=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}static get observedAttributes(){return ["disabled","style"]}attributeChangedCallback(r,t,e){r==="disabled"&&this.updateDisabledState(),r==="style"&&this.updateStyle();}connectedCallback(){this.render();}disconnectedCallback(){}updateDisabledState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-decline-btn");r&&(r.disabled=this.hasAttribute("disabled"));}updateStyle(){var t;let r=this.getAttribute("style");if(r){let e=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-decline-btn");e&&(e.style.cssText=e.style.cssText+r);}}render(){this.shadowRoot&&(this.shadowRoot.innerHTML=`
|
|
52
|
+
<style>
|
|
53
|
+
.rtc-decline-btn {
|
|
54
|
+
background-color: #dc3545;
|
|
55
|
+
color: white;
|
|
56
|
+
border: none;
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
padding: 20px;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
font-size: 16px;
|
|
61
|
+
transition: background-color 0.3s ease;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rtc-decline-btn:hover {
|
|
69
|
+
background-color: #c82333;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rtc-decline-btn:active {
|
|
73
|
+
transform: translateY(1px);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.rtc-decline-btn:disabled {
|
|
77
|
+
background-color: #6c757d;
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.phone-icon {
|
|
82
|
+
width: 16px;
|
|
83
|
+
height: 16px;
|
|
84
|
+
fill: none;
|
|
85
|
+
stroke: currentColor;
|
|
86
|
+
stroke-width: 2;
|
|
87
|
+
stroke-linecap: round;
|
|
88
|
+
stroke-linejoin: round;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
91
|
+
|
|
92
|
+
<button class="rtc-decline-btn" part="decline-button" aria-label="Decline button">
|
|
93
|
+
<svg class="phone-icon" viewBox="0 0 24 24">
|
|
94
|
+
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
|
|
95
|
+
</svg>
|
|
96
|
+
</button>
|
|
97
|
+
`,this.updateDisabledState(),this.updateStyle());}};customElements.define("decline-button",i);var g=i;var a=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}static get observedAttributes(){return ["disabled","style"]}attributeChangedCallback(r,t,e){r==="disabled"&&this.updateDisabledState(),r==="style"&&this.updateStyle();}connectedCallback(){this.render();}disconnectedCallback(){}updateDisabledState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-end-btn");r&&(r.disabled=this.hasAttribute("disabled"));}updateStyle(){var t;let r=this.getAttribute("style");if(r){let e=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-end-btn");e&&(e.style.cssText=e.style.cssText+r);}}render(){this.shadowRoot&&(this.shadowRoot.innerHTML=`
|
|
98
|
+
<style>
|
|
99
|
+
.rtc-end-btn {
|
|
100
|
+
background-color: #dc3545;
|
|
101
|
+
color: white;
|
|
102
|
+
border: none;
|
|
103
|
+
border-radius: 50%;
|
|
104
|
+
padding: 20px;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
font-size: 16px;
|
|
107
|
+
transition: background-color 0.3s ease;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
gap: 8px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.rtc-end-btn:hover {
|
|
115
|
+
background-color: #c82333;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rtc-end-btn:active {
|
|
119
|
+
transform: translateY(1px);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.rtc-end-btn:disabled {
|
|
123
|
+
background-color: #6c757d;
|
|
124
|
+
cursor: not-allowed;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.phone-icon {
|
|
128
|
+
width: 16px;
|
|
129
|
+
height: 16px;
|
|
130
|
+
fill: none;
|
|
131
|
+
stroke: currentColor;
|
|
132
|
+
stroke-width: 2;
|
|
133
|
+
stroke-linecap: round;
|
|
134
|
+
stroke-linejoin: round;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
137
|
+
|
|
138
|
+
<button class="rtc-end-btn" part="end-button" aria-label="End button">
|
|
139
|
+
<svg class="phone-icon" viewBox="0 0 24 24">
|
|
140
|
+
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
|
|
141
|
+
</svg>
|
|
142
|
+
</button>
|
|
143
|
+
`,this.updateDisabledState(),this.updateStyle());}};customElements.define("endcall-button",a);var m=a;var l=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}static get observedAttributes(){return ["disabled","style","theme"]}attributeChangedCallback(r,t,e){r==="disabled"&&this.updateDisabledState(),r==="style"&&this.updateStyle(),r==="theme"&&this.render();}connectedCallback(){this.render();}disconnectedCallback(){}updateDisabledState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-accept-btn");r&&(r.disabled=this.hasAttribute("disabled"));}updateStyle(){var t;let r=this.getAttribute("style");if(r){let e=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-accept-btn");e&&(e.style.cssText=e.style.cssText+r);}}render(){if(!this.shadowRoot)return;let t=(this.getAttribute("theme")||"dark")==="dark";this.shadowRoot.innerHTML=`
|
|
144
|
+
<style>
|
|
145
|
+
.rtc-accept-btn {
|
|
146
|
+
background-color: #28a745;
|
|
147
|
+
color: white;
|
|
148
|
+
border: none;
|
|
149
|
+
border-radius: 50%;
|
|
150
|
+
padding: 20px;
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
transition: all 0.3s ease;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
gap: 8px;
|
|
158
|
+
box-shadow: ${t?"0 4px 15px rgba(40, 167, 69, 0.3)":"0 4px 15px rgba(40, 167, 69, 0.2)"};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.rtc-accept-btn:hover {
|
|
162
|
+
background-color: #218838;
|
|
163
|
+
transform: translateY(-1px);
|
|
164
|
+
box-shadow: ${t?"0 6px 20px rgba(40, 167, 69, 0.4)":"0 6px 20px rgba(40, 167, 69, 0.3)"};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.rtc-accept-btn:active {
|
|
168
|
+
transform: translateY(1px);
|
|
169
|
+
box-shadow: ${t?"0 2px 10px rgba(40, 167, 69, 0.3)":"0 2px 10px rgba(40, 167, 69, 0.2)"};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.rtc-accept-btn:disabled {
|
|
173
|
+
background-color: ${t?"#6c757d":"#adb5bd"};
|
|
174
|
+
cursor: not-allowed;
|
|
175
|
+
box-shadow: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.phone-icon {
|
|
179
|
+
width: 16px;
|
|
180
|
+
height: 16px;
|
|
181
|
+
fill: none;
|
|
182
|
+
stroke: currentColor;
|
|
183
|
+
stroke-width: 2;
|
|
184
|
+
stroke-linecap: round;
|
|
185
|
+
stroke-linejoin: round;
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
188
|
+
|
|
189
|
+
<button class="rtc-accept-btn" part="accept-button" aria-label="Accept button">
|
|
190
|
+
<svg class="phone-icon" viewBox="0 0 24 24">
|
|
191
|
+
<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>
|
|
192
|
+
</svg>
|
|
193
|
+
</button>
|
|
194
|
+
`,this.updateDisabledState(),this.updateStyle();}};customElements.define("accept-button",l);var x=l;var d=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});}static get observedAttributes(){return ["disabled","style","mic-on"]}attributeChangedCallback(r,t,e){r==="disabled"&&this.updateDisabledState(),r==="style"&&this.updateStyle(),r==="mic-on"&&this.updateMicState();}connectedCallback(){this.render();}disconnectedCallback(){}updateDisabledState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-mic-btn");r&&(r.disabled=this.hasAttribute("disabled"));}updateMicState(){var t;let r=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-mic-btn");r&&(this.hasAttribute("mic-on")?(r.classList.remove("mic-off"),r.classList.add("mic-on")):(r.classList.remove("mic-on"),r.classList.add("mic-off")));}updateStyle(){var t;let r=this.getAttribute("style");if(r){let e=(t=this.shadowRoot)==null?void 0:t.querySelector(".rtc-mic-btn");e&&(e.style.cssText=e.style.cssText+r);}}render(){this.shadowRoot&&(this.shadowRoot.innerHTML=`
|
|
195
|
+
<style>
|
|
196
|
+
.rtc-mic-btn {
|
|
197
|
+
background-color: #f6d200;
|
|
198
|
+
color: white;
|
|
199
|
+
border: none;
|
|
200
|
+
border-radius: 50%;
|
|
201
|
+
padding: 20px;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
font-size: 16px;
|
|
204
|
+
transition: background-color 0.3s ease;
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
gap: 8px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.rtc-mic-btn:hover {
|
|
212
|
+
background-color: #FFBF00;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.rtc-mic-btn:active {
|
|
216
|
+
transform: translateY(1px);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.rtc-mic-btn:disabled {
|
|
220
|
+
background-color: #6c757d;
|
|
221
|
+
cursor: not-allowed;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.rtc-mic-btn.mic-on {
|
|
225
|
+
background-color: #f6d200;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.rtc-mic-btn.mic-on:hover {
|
|
229
|
+
background-color: #FFBF00;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.rtc-mic-btn.mic-off {
|
|
233
|
+
background-color: #6c757d;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.rtc-mic-btn.mic-off:hover {
|
|
238
|
+
background-color: #5a6268;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.rtc-mic-btn.mic-off .mic-icon {
|
|
242
|
+
opacity: 0.7;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.mic-icon {
|
|
246
|
+
width: 16px;
|
|
247
|
+
height: 16px;
|
|
248
|
+
fill: none;
|
|
249
|
+
stroke: currentColor;
|
|
250
|
+
stroke-width: 2;
|
|
251
|
+
stroke-linecap: round;
|
|
252
|
+
stroke-linejoin: round;
|
|
253
|
+
}
|
|
254
|
+
</style>
|
|
255
|
+
|
|
256
|
+
<button class="rtc-mic-btn" part="mic-button" aria-label="Mic button">
|
|
257
|
+
<svg class="mic-icon" viewBox="0 0 24 24">
|
|
258
|
+
<rect x="9" y="2" width="6" height="12" rx="3" />
|
|
259
|
+
<path d="M5 10v2a7 7 0 0 0 14 0v-2" />
|
|
260
|
+
<line x1="12" y1="22" x2="12" y2="18" />
|
|
261
|
+
<line x1="8" y1="22" x2="16" y2="22" />
|
|
262
|
+
</svg>
|
|
263
|
+
</button>
|
|
264
|
+
`,this.updateDisabledState(),this.updateMicState(),this.updateStyle());}};customElements.define("mic-button",d);var f=d;var c=class extends HTMLElement{constructor(){super();this.phoneNumber="";this.pressedKey=null;this.maxLength=8;this.shadow=this.attachShadow({mode:"open"}),this.render(),this.setupEventListeners();}static get observedAttributes(){return ["phone-number","max-length","theme"]}attributeChangedCallback(t,e,s){if(t==="phone-number"&&(this.phoneNumber=s||""),t==="max-length"&&(this.maxLength=parseInt(s)||8),t==="theme"){this.render();return}this.render();}setupEventListeners(){this.shadow.addEventListener("click",t=>{let e=t.target.closest("button");e&&e.dataset.value&&this.handleClick(e.dataset.value);}),this.shadow.addEventListener("mousedown",t=>{let e=t.target.closest("button");e&&e.dataset.value&&this.setPressedKey(e.dataset.value);}),this.shadow.addEventListener("mouseup",()=>{this.setPressedKey(null);}),this.shadow.addEventListener("mouseleave",()=>{this.setPressedKey(null);});}handleClick(t){this.setPressedKey(t),this.phoneNumber.length<this.maxLength&&(this.phoneNumber+=t,this.setAttribute("phone-number",this.phoneNumber),this.dispatchEvent(new CustomEvent("number-click",{detail:{value:t,phoneNumber:this.phoneNumber},bubbles:true})));}setPressedKey(t){this.pressedKey=t,this.updateButtonStates();}updateButtonStates(){this.shadow.querySelectorAll("button").forEach(e=>{e.dataset.value===this.pressedKey?(e.style.transform="translateY(2px) scale(0.95)",e.style.backgroundColor="rgba(255, 255, 255, 0.3)",e.style.boxShadow="0 4px 15px rgba(0, 0, 0, 0.2), inset 0 2px 5px rgba(0, 0, 0, 0.2)"):(e.style.transform="",e.style.backgroundColor="",e.style.boxShadow="0 8px 25px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.1)");});}render(){let e=(this.getAttribute("theme")||"dark")==="dark",s=["1","2","3","4","5","6","7","8","9","*","0","#"];this.shadow.innerHTML=`
|
|
265
|
+
<style>
|
|
266
|
+
.numpad-container {
|
|
267
|
+
display: flex;
|
|
268
|
+
justify-content: center;
|
|
269
|
+
align-items: center;
|
|
270
|
+
padding: 15px;
|
|
271
|
+
width: 250px;
|
|
272
|
+
height: 300px;
|
|
273
|
+
border-radius: 12px;
|
|
274
|
+
background: ${e?"rgba(255, 255, 255, 0.05)":"rgba(255, 255, 255, 0.6)"};
|
|
275
|
+
backdrop-filter: blur(10px);
|
|
276
|
+
border: 1px solid ${e?"rgba(255, 255, 255, 0.1)":"rgba(59, 130, 246, 0.2)"};
|
|
277
|
+
max-width: 24rem;
|
|
278
|
+
margin: 0 auto;
|
|
279
|
+
transition: all 0.3s ease;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.grid {
|
|
283
|
+
display: grid;
|
|
284
|
+
grid-template-columns: repeat(3, 1fr);
|
|
285
|
+
gap: 12px;
|
|
286
|
+
width: 100%;
|
|
287
|
+
place-items: center;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.number-button {
|
|
291
|
+
position: relative;
|
|
292
|
+
width: 60px;
|
|
293
|
+
height: 60px;
|
|
294
|
+
border-radius: 20%;
|
|
295
|
+
border: none;
|
|
296
|
+
background: ${e?"rgba(255, 255, 255, 0.15)":"rgba(255, 255, 255, 0.8)"};
|
|
297
|
+
backdrop-filter: blur(10px);
|
|
298
|
+
color: ${e?"white":"#1f2937"};
|
|
299
|
+
font-size: 18px;
|
|
300
|
+
font-weight: 600;
|
|
301
|
+
cursor: pointer;
|
|
302
|
+
overflow: hidden;
|
|
303
|
+
outline: none;
|
|
304
|
+
border: 1px solid ${e?"rgba(255, 255, 255, 0.2)":"rgba(59, 130, 246, 0.3)"};
|
|
305
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
306
|
+
box-shadow: ${e?"0 4px 15px rgba(255, 255, 255, 0.1)":"0 4px 15px rgba(59, 130, 246, 0.1)"};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.number-button:hover {
|
|
310
|
+
transform: translateY(-2px) scale(1.05);
|
|
311
|
+
background: ${e?"rgba(255, 255, 255, 0.25)":"rgba(255, 255, 255, 0.95)"};
|
|
312
|
+
box-shadow: ${e?"0 6px 20px rgba(255, 255, 255, 0.15)":"0 6px 20px rgba(59, 130, 246, 0.15)"};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.number-button:active {
|
|
316
|
+
transform: translateY(2px) scale(0.95);
|
|
317
|
+
box-shadow: ${e?"0 2px 10px rgba(255, 255, 255, 0.1)":"0 2px 10px rgba(59, 130, 246, 0.1)"};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.button-text {
|
|
321
|
+
position: relative;
|
|
322
|
+
z-index: 10;
|
|
323
|
+
}
|
|
324
|
+
</style>
|
|
325
|
+
|
|
326
|
+
<div class="numpad-container">
|
|
327
|
+
<div class="grid">
|
|
328
|
+
${s.map((u,k)=>`
|
|
329
|
+
<button
|
|
330
|
+
class="number-button"
|
|
331
|
+
data-value="${u}"
|
|
332
|
+
>
|
|
333
|
+
<span class="button-text">${u}</span>
|
|
334
|
+
</button>
|
|
335
|
+
`).join("")}
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
`;}getPhoneNumber(){return this.phoneNumber}setPhoneNumber(t){this.phoneNumber=t,this.setAttribute("phone-number",t);}clearPhoneNumber(){this.phoneNumber="",this.setAttribute("phone-number","");}};customElements.define("rtc-numpad",c);var v=c;var b=class extends HTMLElement{constructor(){super();this.phoneNumber="";this.shadow=this.attachShadow({mode:"open"}),this.render();}static get observedAttributes(){return ["phone-number","theme"]}attributeChangedCallback(t,e,s){t==="phone-number"&&(this.phoneNumber=s||"",this.render()),t==="theme"&&this.render();}render(){let e=(this.getAttribute("theme")||"dark")==="dark";this.shadow.innerHTML=`
|
|
339
|
+
<style>
|
|
340
|
+
.number-field-container {
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: row;
|
|
343
|
+
align-items: center;
|
|
344
|
+
gap: 1rem;
|
|
345
|
+
padding: 0.75rem 1rem;
|
|
346
|
+
border-radius: 12px;
|
|
347
|
+
width: 250px;
|
|
348
|
+
display: flex;
|
|
349
|
+
align-items: center;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
overflow: hidden;
|
|
352
|
+
background: ${e?"rgba(255, 255, 255, 0.1)":"rgba(255, 255, 255, 0.8)"};
|
|
353
|
+
backdrop-filter: blur(10px);
|
|
354
|
+
border: 1px solid ${e?"rgba(255, 255, 255, 0.2)":"rgba(59, 130, 246, 0.3)"};
|
|
355
|
+
transition: all 0.3s ease;
|
|
356
|
+
box-shadow: ${e?"0 4px 15px rgba(0, 0, 0, 0.1)":"0 4px 15px rgba(59, 130, 246, 0.1)"};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.phone-number-display {
|
|
360
|
+
color: ${e?"white":"#1f2937"};
|
|
361
|
+
font-size: 18px;
|
|
362
|
+
font-weight: 600;
|
|
363
|
+
min-height: 1.75rem;
|
|
364
|
+
display: flex;
|
|
365
|
+
align-items: center;
|
|
366
|
+
letter-spacing: 0.5px;
|
|
367
|
+
text-shadow: ${e?"0 1px 2px rgba(0, 0, 0, 0.1)":"none"};
|
|
368
|
+
transition: color 0.3s ease;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.phone-number-display:empty::before {
|
|
372
|
+
content: "\u0417\u0430\u043B\u0433\u0430\u0445 \u0434\u0443\u0433\u0430\u0430\u0440 \u043E\u0440\u0443\u0443\u043B\u043D\u0430 \u0443\u0443.";
|
|
373
|
+
color: ${e?"rgba(255, 255, 255, 0.5)":"rgba(107, 114, 128, 0.7)"};
|
|
374
|
+
font-style: italic;
|
|
375
|
+
font-size: 14px;
|
|
376
|
+
}
|
|
377
|
+
</style>
|
|
378
|
+
|
|
379
|
+
<div class="number-field-container">
|
|
380
|
+
<span class="phone-number-display">${this.phoneNumber}</span>
|
|
381
|
+
</div>
|
|
382
|
+
`;}getPhoneNumber(){return this.phoneNumber}setPhoneNumber(t){this.phoneNumber=t,this.setAttribute("phone-number",t);}clearPhoneNumber(){this.phoneNumber="",this.setAttribute("phone-number","");}};customElements.define("rtc-number-field",b);var w=b;var h=class extends HTMLElement{constructor(){super();this.phoneNumber="";this.visible=false;this.shadow=this.attachShadow({mode:"open"}),this.render(),this.setupEventListeners();}static get observedAttributes(){return ["phone-number","visible","theme"]}attributeChangedCallback(t,e,s){t==="phone-number"&&(this.phoneNumber=s||"",this.visible=this.phoneNumber.length>0,this.render()),t==="visible"&&(this.visible=s==="true",this.render()),t==="theme"&&this.render();}setupEventListeners(){this.shadow.addEventListener("click",t=>{t.target.closest("button")&&this.handleDeleteClick();});}handleDeleteClick(){this.dispatchEvent(new CustomEvent("delete-click",{detail:{phoneNumber:this.phoneNumber},bubbles:true}));}render(){if(!this.visible){this.shadow.innerHTML="";return}let e=(this.getAttribute("theme")||"dark")==="dark";this.shadow.innerHTML=`
|
|
383
|
+
<style>
|
|
384
|
+
.delete-button {
|
|
385
|
+
color: white;
|
|
386
|
+
font-size: 16px;
|
|
387
|
+
background-color: #ef4444;
|
|
388
|
+
padding: 15px;
|
|
389
|
+
border-radius: 50%;
|
|
390
|
+
border: none;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
display: flex;
|
|
393
|
+
align-items: center;
|
|
394
|
+
justify-content: center;
|
|
395
|
+
transition: all 0.3s ease;
|
|
396
|
+
box-shadow: ${e?"0 4px 15px rgba(239, 68, 68, 0.3)":"0 4px 15px rgba(239, 68, 68, 0.2)"};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.delete-button:hover {
|
|
400
|
+
background-color: #dc2626;
|
|
401
|
+
transform: translateY(-2px) scale(1.05);
|
|
402
|
+
box-shadow: ${e?"0 6px 20px rgba(239, 68, 68, 0.4)":"0 6px 20px rgba(239, 68, 68, 0.3)"};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.delete-button:active {
|
|
406
|
+
transform: translateY(1px) scale(0.95);
|
|
407
|
+
box-shadow: ${e?"0 2px 10px rgba(239, 68, 68, 0.3)":"0 2px 10px rgba(239, 68, 68, 0.2)"};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.delete-icon {
|
|
411
|
+
width: 18px;
|
|
412
|
+
height: 18px;
|
|
413
|
+
fill: white;
|
|
414
|
+
stroke: white;
|
|
415
|
+
stroke-width: 2;
|
|
416
|
+
stroke-linecap: round;
|
|
417
|
+
stroke-linejoin: round;
|
|
418
|
+
}
|
|
419
|
+
</style>
|
|
420
|
+
|
|
421
|
+
<button class="delete-button" aria-label="Delete last digit">
|
|
422
|
+
<svg class="delete-icon" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
423
|
+
<path d="M22.6663 5.32031H13.7063C11.8263 5.32031 10.0396 6.10698 8.77292 7.50698L4.06625 12.6803C2.18625 14.747 2.18625 17.8936 4.06625 19.9603L8.77292 25.1336C10.0396 26.5203 11.8263 27.3203 13.7063 27.3203H22.6663C26.3463 27.3203 29.3329 24.3336 29.3329 20.6536V11.987C29.3329 8.30698 26.3463 5.32031 22.6663 5.32031ZM22.0396 18.907C22.4263 19.2936 22.4263 19.9336 22.0396 20.3203C21.8396 20.5203 21.5863 20.6136 21.3329 20.6136C21.0796 20.6136 20.8263 20.5203 20.6263 20.3203L18.0396 17.7336L15.4529 20.3203C15.2529 20.5203 14.9996 20.6136 14.7463 20.6136C14.4929 20.6136 14.2396 20.5203 14.0396 20.3203C13.6529 19.9336 13.6529 19.2936 14.0396 18.907L16.6263 16.3203L14.0396 13.7336C13.6529 13.347 13.6529 12.707 14.0396 12.3203C14.4263 11.9336 15.0663 11.9336 15.4529 12.3203L18.0396 14.907L20.6263 12.3203C21.0129 11.9336 21.6529 11.9336 22.0396 12.3203C22.4263 12.707 22.4263 13.347 22.0396 13.7336L19.4529 16.3203L22.0396 18.907Z" fill="none"/>
|
|
424
|
+
</svg>
|
|
425
|
+
</button>
|
|
426
|
+
`;}getPhoneNumber(){return this.phoneNumber}setPhoneNumber(t){this.phoneNumber=t,this.visible=t.length>0,this.setAttribute("phone-number",t);}setVisible(t){this.visible=t,this.setAttribute("visible",t.toString());}};customElements.define("rtc-number-delete-button",h);var y=h;export{x as AcceptButton,p as CallButton,g as DeclineButton,m as EndButton,f as MicButton,y as NumberDeleteButton,w as NumberField,v as Numpad};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@callpromn/rtc-kit",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsup",
|
|
10
|
+
"pk": "sudo npm run build && sudo npm link",
|
|
11
|
+
"pack:check": "npm pack && tar -tzf $(ls -t *.tgz | head -1)",
|
|
12
|
+
"clean": "rimraf dist"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"wep-component",
|
|
16
|
+
"ui",
|
|
17
|
+
"components",
|
|
18
|
+
"rtc",
|
|
19
|
+
"calling",
|
|
20
|
+
"voip",
|
|
21
|
+
"callpro"
|
|
22
|
+
],
|
|
23
|
+
"author": "CallPro LLC",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"description": "CallPro Web Components Kit for Web",
|
|
26
|
+
"exports": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"require": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^24.1.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
40
|
+
"eslint": "^9.32.0",
|
|
41
|
+
"eslint-config-prettier": "^10.1.8",
|
|
42
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
43
|
+
"prettier": "^3.6.2",
|
|
44
|
+
"tsup": "^8.5.0",
|
|
45
|
+
"typescript": "^5.8.3",
|
|
46
|
+
"rimraf": "^6.0.1"
|
|
47
|
+
}
|
|
48
|
+
}
|