@16x/webphone-sdk 3.0.1 → 3.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.
- package/CHANGELOG.md +39 -22
- package/LICENSE +1 -2
- package/README.md +113 -113
- package/dist/{CCBarClient-BdbynNBi.js → CCBarClient-CcPfEToZ.js} +431 -179
- package/dist/CCBarClient-DCQ8XjcL.cjs +1 -0
- package/dist/{Diagnostics-BYVvmxil.cjs → Diagnostics-D38Hm3NT.cjs} +1 -1
- package/dist/{Diagnostics-Cw2HVrCD.js → Diagnostics-Di049OpT.js} +9 -9
- package/dist/JsSipAdapter-BBRrDaM4.cjs +1 -0
- package/dist/{JsSipAdapter-GHzVSCDh.js → JsSipAdapter-Bke1Qjfe.js} +37 -25
- package/dist/SharedWorkerProtocol-39dch6xL.cjs +1 -0
- package/dist/{SharedWorkerProtocol-BqUafs8d.js → SharedWorkerProtocol-DKVQ5-po.js} +31 -17
- package/dist/core/CCBarClient.d.ts +36 -4
- package/dist/core/CallManager.d.ts +2 -0
- package/dist/{createJsSipFactory-yttVU3d6.js → createJsSipFactory-9CPsweDR.js} +4 -1
- package/dist/{createJsSipFactory-2X4FBIU2.cjs → createJsSipFactory-Dr8HbLl-.cjs} +1 -1
- package/dist/diagnostics/Diagnostics.d.ts +1 -0
- package/dist/diagnostics/index.cjs +1 -1
- package/dist/diagnostics/index.d.ts +1 -1
- package/dist/diagnostics/index.js +3 -6
- package/dist/errors/CCBarError.d.ts +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +9 -139
- package/dist/index.umd.js +17 -17
- package/dist/legacy/index.cjs +1 -1
- package/dist/legacy/index.js +2 -2
- package/dist/shared/SharedWorkerProtocol.d.ts +2 -0
- package/dist/shared-worker.cjs +1 -1
- package/dist/shared-worker.js +13 -6
- package/dist/styles.css +7 -7
- package/dist/types.d.ts +5 -0
- package/dist/ui/XCallCCBarElement.d.ts +2 -0
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.js +138 -130
- package/dist/version.d.ts +1 -0
- package/package.json +111 -107
- package/dist/CCBarClient-DKWdvgf5.cjs +0 -1
- package/dist/CCBarError-CIqJE8zK.cjs +0 -1
- package/dist/CCBarError-DSbPw2dA.js +0 -14
- package/dist/JsSipAdapter-jtGdoXrm.cjs +0 -1
- package/dist/SharedWorkerProtocol-CYN0AprP.cjs +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -654,74 +654,82 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
654
654
|
];
|
|
655
655
|
}
|
|
656
656
|
#e;
|
|
657
|
-
#t =
|
|
658
|
-
#n =
|
|
659
|
-
#r = "
|
|
660
|
-
#i;
|
|
661
|
-
#a
|
|
662
|
-
#o =
|
|
657
|
+
#t = !1;
|
|
658
|
+
#n = [];
|
|
659
|
+
#r = "idle";
|
|
660
|
+
#i = "unknown";
|
|
661
|
+
#a;
|
|
662
|
+
#o = /* @__PURE__ */ new Set();
|
|
663
663
|
#s = "";
|
|
664
|
-
#c = "
|
|
665
|
-
#l =
|
|
664
|
+
#c = "";
|
|
665
|
+
#l = "offline";
|
|
666
666
|
#u = !1;
|
|
667
|
-
#d =
|
|
668
|
-
#f;
|
|
669
|
-
#p
|
|
667
|
+
#d = !1;
|
|
668
|
+
#f = Promise.resolve();
|
|
669
|
+
#p;
|
|
670
670
|
#m = !1;
|
|
671
|
-
#h;
|
|
671
|
+
#h = !1;
|
|
672
672
|
#g;
|
|
673
673
|
#_;
|
|
674
674
|
#v;
|
|
675
675
|
#y;
|
|
676
|
+
#b;
|
|
676
677
|
get messageResolver() {
|
|
677
|
-
return this.#
|
|
678
|
+
return this.#y;
|
|
678
679
|
}
|
|
679
680
|
set messageResolver(e) {
|
|
680
|
-
this.#
|
|
681
|
+
this.#y = e, this.shadowRoot !== null && this.render();
|
|
681
682
|
}
|
|
682
683
|
get client() {
|
|
683
684
|
return this.#e;
|
|
684
685
|
}
|
|
685
686
|
set client(e) {
|
|
686
|
-
this.#
|
|
687
|
+
this.#O(), this.#e = e, this.#D(), this.render();
|
|
688
|
+
}
|
|
689
|
+
get ownsClient() {
|
|
690
|
+
return this.#t;
|
|
691
|
+
}
|
|
692
|
+
set ownsClient(e) {
|
|
693
|
+
this.#t = e === !0;
|
|
687
694
|
}
|
|
688
695
|
connectedCallback() {
|
|
689
|
-
this.#
|
|
696
|
+
this.#V(), this.#B(), this.render();
|
|
690
697
|
}
|
|
691
698
|
disconnectedCallback() {
|
|
692
|
-
|
|
699
|
+
let e = this.#e, t = this.#t;
|
|
700
|
+
this.#O(), this.#G(), this.#b?.(), this.#b = void 0, t && (this.#e = void 0, e?.dispose());
|
|
693
701
|
}
|
|
694
702
|
attributeChangedCallback(e) {
|
|
695
|
-
this.#
|
|
703
|
+
this.#V(), e === "theme" && this.#B(), this.shadowRoot !== null && this.render();
|
|
696
704
|
}
|
|
697
705
|
render() {
|
|
698
|
-
let e = this.#
|
|
699
|
-
e !== void 0 && (e.innerHTML = `<style>${B}</style>`, e.append(this.#
|
|
706
|
+
let e = this.#k();
|
|
707
|
+
e !== void 0 && (e.innerHTML = `<style>${B}</style>`, e.append(this.#S(this.#x())));
|
|
700
708
|
}
|
|
701
|
-
#
|
|
709
|
+
#x() {
|
|
702
710
|
let e = this.#e?.getCalls?.().map((e) => ({
|
|
703
711
|
id: e.id,
|
|
704
712
|
state: e.state,
|
|
705
713
|
destination: e.destination,
|
|
706
|
-
direction: this.#
|
|
714
|
+
direction: this.#o.has(e.id) ? "inbound" : "outbound"
|
|
707
715
|
})) ?? [];
|
|
708
716
|
return z({
|
|
709
|
-
connectionState: this.#
|
|
710
|
-
permission: this.#
|
|
717
|
+
connectionState: this.#r,
|
|
718
|
+
permission: this.#i,
|
|
711
719
|
calls: e,
|
|
712
|
-
error: this.#
|
|
720
|
+
error: this.#a
|
|
713
721
|
});
|
|
714
722
|
}
|
|
715
|
-
#
|
|
716
|
-
let t = this.#
|
|
723
|
+
#S(e) {
|
|
724
|
+
let t = this.#z(), n = this.#_ ?? this.#g ?? K(e, t), r = {
|
|
717
725
|
...t,
|
|
718
726
|
status: n
|
|
719
|
-
}, i = this.#
|
|
720
|
-
return i.setAttribute("data-view", this.#
|
|
727
|
+
}, i = this.#C(e, r, n);
|
|
728
|
+
return i.setAttribute("data-view", this.#E() && !this.#m ? "setup" : e.kind), i.hasAttribute("data-layout") || i.setAttribute("data-layout", this.#E() ? "mobile" : "panel"), i;
|
|
721
729
|
}
|
|
722
|
-
#
|
|
723
|
-
if (this.#
|
|
724
|
-
enabling: this.#
|
|
730
|
+
#C(e, t, n) {
|
|
731
|
+
if (this.#E() && !this.#m) return N({
|
|
732
|
+
enabling: this.#h,
|
|
725
733
|
status: n,
|
|
726
734
|
enablePhone: t.enablePhone
|
|
727
735
|
});
|
|
@@ -732,12 +740,12 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
732
740
|
view: e,
|
|
733
741
|
messages: t
|
|
734
742
|
});
|
|
735
|
-
case "incoming": return this.#
|
|
743
|
+
case "incoming": return this.#E() ? P({
|
|
736
744
|
view: { kind: "ready" },
|
|
737
745
|
messages: t,
|
|
738
|
-
destination: this.#
|
|
739
|
-
muted: this.#
|
|
740
|
-
canDial: s(this.#
|
|
746
|
+
destination: this.#s,
|
|
747
|
+
muted: this.#u,
|
|
748
|
+
canDial: s(this.#s, this.#i, this.#r),
|
|
741
749
|
showOutputDevice: this.#e?.media.supportsOutputSelection() === !0
|
|
742
750
|
}) : j({
|
|
743
751
|
view: e,
|
|
@@ -749,121 +757,121 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
749
757
|
case "ready":
|
|
750
758
|
case "active":
|
|
751
759
|
case "held":
|
|
752
|
-
case "dialing": return this.#
|
|
760
|
+
case "dialing": return this.#E() ? P({
|
|
753
761
|
view: e.kind === "held" ? { kind: "ready" } : e,
|
|
754
762
|
messages: t,
|
|
755
|
-
destination: this.#
|
|
756
|
-
muted: this.#
|
|
757
|
-
canDial: s(this.#
|
|
763
|
+
destination: this.#s,
|
|
764
|
+
muted: this.#u,
|
|
765
|
+
canDial: s(this.#s, this.#i, this.#r),
|
|
758
766
|
showOutputDevice: this.#e?.media.supportsOutputSelection() === !0
|
|
759
767
|
}) : _({
|
|
760
|
-
mode: this.#
|
|
768
|
+
mode: this.#T() === "compact" ? "compact" : "panel",
|
|
761
769
|
view: e,
|
|
762
770
|
messages: t,
|
|
763
|
-
destination: this.#
|
|
764
|
-
muted: this.#
|
|
765
|
-
canDial: s(this.#
|
|
766
|
-
moreOpen: this.#
|
|
771
|
+
destination: this.#s,
|
|
772
|
+
muted: this.#u,
|
|
773
|
+
canDial: s(this.#s, this.#i, this.#r),
|
|
774
|
+
moreOpen: this.#d,
|
|
767
775
|
floating: this.hasAttribute("floating"),
|
|
768
|
-
connected: this.#
|
|
769
|
-
agentStatus: this.#
|
|
770
|
-
extension: this.#
|
|
771
|
-
calls: this.#
|
|
776
|
+
connected: this.#r === "connected",
|
|
777
|
+
agentStatus: this.#l,
|
|
778
|
+
extension: this.#c,
|
|
779
|
+
calls: this.#w()
|
|
772
780
|
});
|
|
773
781
|
default: return e;
|
|
774
782
|
}
|
|
775
783
|
}
|
|
776
|
-
#
|
|
784
|
+
#w() {
|
|
777
785
|
let e = this.#e?.getActiveCall?.()?.id;
|
|
778
786
|
return this.#e?.getCalls?.().map((t) => ({
|
|
779
787
|
id: t.id,
|
|
780
788
|
destination: t.destination,
|
|
781
789
|
state: t.state,
|
|
782
|
-
direction: this.#
|
|
790
|
+
direction: this.#o.has(t.id) ? "inbound" : "outbound",
|
|
783
791
|
current: t.id === e
|
|
784
792
|
})) ?? [];
|
|
785
793
|
}
|
|
786
|
-
#
|
|
794
|
+
#T() {
|
|
787
795
|
let e = this.getAttribute("mode");
|
|
788
796
|
return e === "compact" || e === "mobile" ? e : "panel";
|
|
789
797
|
}
|
|
790
|
-
#T() {
|
|
791
|
-
return this.#w() === "mobile";
|
|
792
|
-
}
|
|
793
798
|
#E() {
|
|
799
|
+
return this.#T() === "mobile";
|
|
800
|
+
}
|
|
801
|
+
#D() {
|
|
794
802
|
let e = this.#e;
|
|
795
|
-
e !== void 0 && (this.#
|
|
796
|
-
if (this.#
|
|
803
|
+
e !== void 0 && (this.#n.push(e.on("connection.stateChanged", (t) => {
|
|
804
|
+
if (this.#r = t.state, t.state !== "connected" && (this.#l = "offline"), t.state === "connected") {
|
|
797
805
|
let t = e.getAgent?.()?.extension?.trim();
|
|
798
|
-
t !== void 0 && t !== "" && (this.#
|
|
806
|
+
t !== void 0 && t !== "" && (this.#c = t);
|
|
799
807
|
}
|
|
800
|
-
})), this.#
|
|
801
|
-
(e.status === "available" || e.status === "offline" || e.status === "break") && (this.#
|
|
802
|
-
})), this.#
|
|
803
|
-
this.#
|
|
804
|
-
})), this.#
|
|
805
|
-
this.#
|
|
806
|
-
})), this.#
|
|
807
|
-
this.#
|
|
808
|
-
})), this.#
|
|
809
|
-
this.#
|
|
810
|
-
})), this.#
|
|
811
|
-
this.#
|
|
812
|
-
})), this.#
|
|
813
|
-
this.#
|
|
808
|
+
})), this.#n.push(e.on("agent.statusChanged", (e) => {
|
|
809
|
+
(e.status === "available" || e.status === "offline" || e.status === "break") && (this.#l = e.status);
|
|
810
|
+
})), this.#n.push(e.on("connection.failed", (e) => {
|
|
811
|
+
this.#r = "failed", this.#a = { code: e.error.code };
|
|
812
|
+
})), this.#n.push(e.on("media.permissionChanged", (e) => {
|
|
813
|
+
this.#i = e.permission;
|
|
814
|
+
})), this.#n.push(e.on("error", (e) => {
|
|
815
|
+
this.#a = { code: e.error.code };
|
|
816
|
+
})), this.#n.push(e.on("call.incoming", (e) => {
|
|
817
|
+
this.#o.add(e.callId);
|
|
818
|
+
})), this.#n.push(e.on("call.ended", (e) => {
|
|
819
|
+
this.#o.delete(e.callId), this.#u = !1;
|
|
820
|
+
})), this.#n.push(e.on("call.failed", () => {
|
|
821
|
+
this.#_ = this.#z().statusFailed;
|
|
814
822
|
})), U.forEach((t) => {
|
|
815
|
-
this.#
|
|
816
|
-
}), this.#
|
|
823
|
+
this.#n.push(e.on(t, () => this.render()));
|
|
824
|
+
}), this.#E() && typeof e.recover == "function" && (this.#v = a(e, {
|
|
817
825
|
onChecking: () => {
|
|
818
|
-
this.#
|
|
826
|
+
this.#g = this.#z().foregroundChecking, this.render();
|
|
819
827
|
},
|
|
820
828
|
onRecovered: () => {
|
|
821
|
-
this.#
|
|
829
|
+
this.#g = void 0, this.render();
|
|
822
830
|
},
|
|
823
831
|
onFailed: () => {
|
|
824
|
-
this.#
|
|
832
|
+
this.#g = this.#z().foregroundFailed, this.render();
|
|
825
833
|
}
|
|
826
834
|
})));
|
|
827
835
|
}
|
|
828
|
-
#D() {
|
|
829
|
-
let e = this.#t;
|
|
830
|
-
this.#t = [], e.forEach((e) => e()), this.#n = "idle", this.#r = "unknown", this.#c = "offline", this.#i = void 0, this.#a.clear(), this.#l = !1, this.#u = !1, this.#p = !1, this.#m = !1, this.#h = void 0, this.#_?.(), this.#_ = void 0;
|
|
831
|
-
}
|
|
832
836
|
#O() {
|
|
837
|
+
let e = this.#n;
|
|
838
|
+
this.#n = [], e.forEach((e) => e()), this.#r = "idle", this.#i = "unknown", this.#l = "offline", this.#a = void 0, this.#o.clear(), this.#u = !1, this.#d = !1, this.#m = !1, this.#h = !1, this.#g = void 0, this.#v?.(), this.#v = void 0;
|
|
839
|
+
}
|
|
840
|
+
#k() {
|
|
833
841
|
if (typeof this.attachShadow != "function") return;
|
|
834
842
|
let e = this.shadowRoot ?? this.attachShadow({ mode: "open" });
|
|
835
|
-
return H.has(e) || (H.add(e), e.addEventListener("click", (e) => this.#
|
|
843
|
+
return H.has(e) || (H.add(e), e.addEventListener("click", (e) => this.#A(e)), e.addEventListener("input", (e) => this.#P(e)), e.addEventListener("pointerdown", (e) => this.#H(e))), e;
|
|
836
844
|
}
|
|
837
|
-
#
|
|
845
|
+
#A(e) {
|
|
838
846
|
let t = J(e, this), n = t?.closest("[data-action=\"enable-phone\"]");
|
|
839
|
-
n instanceof HTMLButtonElement && (n.disabled = !0), this.#
|
|
840
|
-
this.#
|
|
847
|
+
n instanceof HTMLButtonElement && (n.disabled = !0), this.#f = this.#f.then(() => this.#F(t)).catch((e) => {
|
|
848
|
+
this.#_ = Y(e), this.render();
|
|
841
849
|
});
|
|
842
850
|
}
|
|
843
|
-
#
|
|
851
|
+
#j() {
|
|
844
852
|
let e = this.shadowRoot?.querySelector("input[name=\"destination\"]");
|
|
845
|
-
return e instanceof HTMLInputElement ? e.value : this.#
|
|
853
|
+
return e instanceof HTMLInputElement ? e.value : this.#s;
|
|
846
854
|
}
|
|
847
|
-
#
|
|
855
|
+
#M() {
|
|
848
856
|
let e = this.shadowRoot?.querySelector("input[name=\"extension\"]");
|
|
849
|
-
return e instanceof HTMLInputElement ? e.value.trim() : this.#
|
|
857
|
+
return e instanceof HTMLInputElement ? e.value.trim() : this.#c;
|
|
850
858
|
}
|
|
851
|
-
#
|
|
859
|
+
#N() {
|
|
852
860
|
let e = this.shadowRoot?.querySelector("input[name=\"transfer-target\"]");
|
|
853
861
|
return e instanceof HTMLInputElement ? e.value : "";
|
|
854
862
|
}
|
|
855
|
-
#
|
|
863
|
+
#P(e) {
|
|
856
864
|
let t = J(e, this);
|
|
857
865
|
if (t instanceof HTMLInputElement && t.name !== "transfer-target") {
|
|
858
866
|
if (t.name === "extension") {
|
|
859
|
-
this.#
|
|
867
|
+
this.#c = t.value.trim();
|
|
860
868
|
return;
|
|
861
869
|
}
|
|
862
|
-
this.#
|
|
870
|
+
this.#s = t.value, this.#L();
|
|
863
871
|
}
|
|
864
872
|
}
|
|
865
|
-
async #
|
|
866
|
-
if (this.#
|
|
873
|
+
async #F(e) {
|
|
874
|
+
if (this.#_ = void 0, e === void 0) return;
|
|
867
875
|
let t = e.closest("[data-call-id]");
|
|
868
876
|
if (t instanceof HTMLElement && t.dataset.callId !== void 0) {
|
|
869
877
|
await this.#e?.setActiveCall(t.dataset.callId);
|
|
@@ -871,7 +879,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
871
879
|
}
|
|
872
880
|
let n = e.closest("[data-digit]");
|
|
873
881
|
if (n instanceof HTMLElement && n.dataset.digit !== void 0) {
|
|
874
|
-
await this.#
|
|
882
|
+
await this.#I(n.dataset.digit);
|
|
875
883
|
return;
|
|
876
884
|
}
|
|
877
885
|
let r = e.closest("[data-action]");
|
|
@@ -880,20 +888,20 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
880
888
|
switch (r.getAttribute("data-action")) {
|
|
881
889
|
case "signin":
|
|
882
890
|
if (this.#e === void 0) return;
|
|
883
|
-
this.#
|
|
891
|
+
this.#c = this.#M(), await this.#e.media?.requestPermission?.(), await this.#e.initialize(), await this.#e.connect(this.#c === "" ? void 0 : { extension: this.#c });
|
|
884
892
|
return;
|
|
885
893
|
case "signout":
|
|
886
894
|
if (this.#e === void 0) return;
|
|
887
|
-
this.#
|
|
895
|
+
this.#l = "offline", await this.#e.disconnect();
|
|
888
896
|
return;
|
|
889
897
|
case "dial":
|
|
890
898
|
case "dial-internal":
|
|
891
|
-
if (this.#
|
|
892
|
-
this.#
|
|
899
|
+
if (this.#s = this.#j(), this.#e === void 0) return;
|
|
900
|
+
this.#i !== "granted" && await this.#e.media?.requestPermission?.(), await c(this.#e, this.#s, r.getAttribute("data-action") === "dial-internal" ? "extension" : void 0);
|
|
893
901
|
return;
|
|
894
902
|
case "mute":
|
|
895
903
|
if (a === void 0) return;
|
|
896
|
-
this.#
|
|
904
|
+
this.#u = await l(a, this.#u), this.#R();
|
|
897
905
|
return;
|
|
898
906
|
case "hold":
|
|
899
907
|
a !== void 0 && await u(a);
|
|
@@ -902,7 +910,7 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
902
910
|
a !== void 0 && await a.resume();
|
|
903
911
|
return;
|
|
904
912
|
case "transfer":
|
|
905
|
-
a !== void 0 && await f(a, this.#
|
|
913
|
+
a !== void 0 && await f(a, this.#N());
|
|
906
914
|
return;
|
|
907
915
|
case "hangup":
|
|
908
916
|
await a?.hangup();
|
|
@@ -914,16 +922,16 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
914
922
|
await a?.reject();
|
|
915
923
|
return;
|
|
916
924
|
case "enable-phone":
|
|
917
|
-
if (this.#e === void 0 || this.#
|
|
918
|
-
this.#
|
|
925
|
+
if (this.#e === void 0 || this.#m) return;
|
|
926
|
+
this.#h = !0;
|
|
919
927
|
try {
|
|
920
|
-
await i(this.#e), this.#
|
|
928
|
+
await i(this.#e), this.#m = !0;
|
|
921
929
|
} finally {
|
|
922
|
-
this.#
|
|
930
|
+
this.#h = !1, this.render();
|
|
923
931
|
}
|
|
924
932
|
return;
|
|
925
933
|
case "more":
|
|
926
|
-
this.#
|
|
934
|
+
this.#d = !this.#d, this.render();
|
|
927
935
|
return;
|
|
928
936
|
case "retry-permission":
|
|
929
937
|
await this.#e?.media.requestPermission();
|
|
@@ -939,32 +947,32 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
939
947
|
default: return;
|
|
940
948
|
}
|
|
941
949
|
}
|
|
942
|
-
async #
|
|
950
|
+
async #I(e) {
|
|
943
951
|
let t = this.#e?.getActiveCall?.();
|
|
944
952
|
if (t !== void 0 && (t.state === "active" || t.state === "held")) {
|
|
945
953
|
await d(t, e);
|
|
946
954
|
return;
|
|
947
955
|
}
|
|
948
|
-
this.#
|
|
956
|
+
this.#s += e;
|
|
949
957
|
let n = this.shadowRoot?.querySelector("input[name=\"destination\"]");
|
|
950
|
-
n instanceof HTMLInputElement && (n.value = this.#
|
|
958
|
+
n instanceof HTMLInputElement && (n.value = this.#s), this.#L();
|
|
951
959
|
}
|
|
952
|
-
#
|
|
953
|
-
let e = !s(this.#
|
|
960
|
+
#L() {
|
|
961
|
+
let e = !s(this.#s, this.#i, this.#r);
|
|
954
962
|
for (let t of ["dial", "dial-internal"]) {
|
|
955
963
|
let n = this.shadowRoot?.querySelector(`[data-action="${t}"]`);
|
|
956
964
|
n instanceof HTMLButtonElement && (n.disabled = e);
|
|
957
965
|
}
|
|
958
966
|
}
|
|
959
|
-
#L() {
|
|
960
|
-
let e = this.shadowRoot?.querySelector("[data-action=\"mute\"]");
|
|
961
|
-
e instanceof HTMLButtonElement && (e.setAttribute("aria-pressed", this.#l ? "true" : "false"), e.textContent = this.#l ? this.#R().unmute : this.#R().mute);
|
|
962
|
-
}
|
|
963
967
|
#R() {
|
|
964
|
-
|
|
968
|
+
let e = this.shadowRoot?.querySelector("[data-action=\"mute\"]");
|
|
969
|
+
e instanceof HTMLButtonElement && (e.setAttribute("aria-pressed", this.#u ? "true" : "false"), e.textContent = this.#u ? this.#z().unmute : this.#z().mute);
|
|
965
970
|
}
|
|
966
971
|
#z() {
|
|
967
|
-
this
|
|
972
|
+
return r(this.getAttribute("locale") ?? "zh-CN", void 0, this.#y);
|
|
973
|
+
}
|
|
974
|
+
#B() {
|
|
975
|
+
this.#b?.(), this.#b = void 0;
|
|
968
976
|
let e = this.getAttribute("theme") ?? "light";
|
|
969
977
|
if (e === "dark" || e === "light") {
|
|
970
978
|
this.setAttribute("data-theme", e);
|
|
@@ -977,31 +985,31 @@ var B = ":root,:host{--ccbar-color-surface:#fff;--ccbar-color-surface-muted:#f1f
|
|
|
977
985
|
let t = window.matchMedia("(prefers-color-scheme: dark)"), n = () => {
|
|
978
986
|
this.setAttribute("data-theme", t.matches ? "dark" : "light");
|
|
979
987
|
};
|
|
980
|
-
n(), t.addEventListener("change", n), this.#
|
|
988
|
+
n(), t.addEventListener("change", n), this.#b = () => t.removeEventListener("change", n);
|
|
981
989
|
}
|
|
982
|
-
#
|
|
990
|
+
#V() {
|
|
983
991
|
this.style.position = this.hasAttribute("floating") ? "fixed" : "";
|
|
984
992
|
}
|
|
985
|
-
#
|
|
993
|
+
#H(e) {
|
|
986
994
|
if (!(e instanceof PointerEvent) || !this.hasAttribute("floating") || !this.hasAttribute("draggable") || (e.target instanceof Element ? e.target.closest("[data-drag-handle]") : null) === null) return;
|
|
987
995
|
e.preventDefault();
|
|
988
996
|
let t = this.getBoundingClientRect();
|
|
989
|
-
this.#
|
|
997
|
+
this.#p = {
|
|
990
998
|
pointerId: e.pointerId,
|
|
991
999
|
offsetX: e.clientX - t.left,
|
|
992
1000
|
offsetY: e.clientY - t.top
|
|
993
|
-
}, window.addEventListener("pointermove", this.#
|
|
1001
|
+
}, window.addEventListener("pointermove", this.#U), window.addEventListener("pointerup", this.#W);
|
|
994
1002
|
}
|
|
995
|
-
#
|
|
996
|
-
if (this.#
|
|
997
|
-
let t = window.visualViewport, n = t?.width ?? window.innerWidth, r = t?.height ?? window.innerHeight, i = q(e.clientX - this.#
|
|
1003
|
+
#U = (e) => {
|
|
1004
|
+
if (this.#p === void 0 || e.pointerId !== this.#p.pointerId) return;
|
|
1005
|
+
let t = window.visualViewport, n = t?.width ?? window.innerWidth, r = t?.height ?? window.innerHeight, i = q(e.clientX - this.#p.offsetX, 0, Math.max(0, n - this.offsetWidth)), a = q(e.clientY - this.#p.offsetY, 0, Math.max(0, r - this.offsetHeight));
|
|
998
1006
|
this.style.left = `${i}px`, this.style.top = `${a}px`, this.style.right = "auto", this.style.bottom = "auto";
|
|
999
1007
|
};
|
|
1000
|
-
#
|
|
1001
|
-
this.#
|
|
1008
|
+
#W = (e) => {
|
|
1009
|
+
this.#p !== void 0 && e.pointerId === this.#p.pointerId && this.#G();
|
|
1002
1010
|
};
|
|
1003
|
-
#
|
|
1004
|
-
this.#
|
|
1011
|
+
#G() {
|
|
1012
|
+
this.#p = void 0, window.removeEventListener("pointermove", this.#U), window.removeEventListener("pointerup", this.#W);
|
|
1005
1013
|
}
|
|
1006
1014
|
};
|
|
1007
1015
|
function G(e = {}) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "3.1.0";
|