dictate-button 1.1.1 → 1.1.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/dist/dictate-button.js
CHANGED
|
@@ -586,7 +586,7 @@ const Ft = `
|
|
|
586
586
|
}
|
|
587
587
|
`;
|
|
588
588
|
var Lt = /* @__PURE__ */ k("<div part=container class=dictate-button__container><style></style><button part=button class=dictate-button__button>"), Kt = /* @__PURE__ */ k('<svg part=icon class="dictate-button__icon dictate-button__icon--idle"fill=none viewBox="0 0 24 24"stroke-width=1.5 stroke=currentColor><path stroke-linecap=round stroke-linejoin=round d="M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z">'), Ut = /* @__PURE__ */ k('<svg part=icon class="dictate-button__icon dictate-button__icon--recording"viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=12 r=10>'), zt = /* @__PURE__ */ k('<svg part=icon class="dictate-button__icon dictate-button__icon--processing"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9">'), Vt = /* @__PURE__ */ k('<svg part=icon class="dictate-button__icon dictate-button__icon--error"viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=4 stroke-linecap=round stroke-linejoin=round><line x1=12 x2=12 y1=4 y2=14></line><line x1=12 x2=12.01 y1=20 y2=20>');
|
|
589
|
-
console.debug("dictate-button version:", "1.1.
|
|
589
|
+
console.debug("dictate-button version:", "1.1.2");
|
|
590
590
|
const qt = "https://api.dictate-button.io/transcribe", j = "dictate-button.io", q = -70, Y = -10, tt = 0, Ht = 4, Gt = 0.25, Wt = 0.05;
|
|
591
591
|
Dt("dictate-button", {
|
|
592
592
|
size: 30,
|
package/dist/inject-exclusive.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const
|
|
1
|
+
const b = [
|
|
2
2
|
"textarea[data-dictate-button-on]:not([data-dictate-button-enabled])",
|
|
3
3
|
'input[type="text"][data-dictate-button-on]:not([data-dictate-button-enabled])',
|
|
4
4
|
'input[type="search"][data-dictate-button-on]:not([data-dictate-button-enabled])',
|
|
5
5
|
"input[data-dictate-button-on]:not([type]):not([data-dictate-button-enabled])"
|
|
6
6
|
].join(",");
|
|
7
7
|
function g() {
|
|
8
|
-
const t = document.querySelectorAll(
|
|
8
|
+
const t = document.querySelectorAll(b);
|
|
9
9
|
for (const n of t) {
|
|
10
10
|
const a = document.createElement("div");
|
|
11
11
|
a.style.position = "relative", a.style.display = "inline-block", a.style.width = "auto", a.style.color = "inherit", n.parentNode.insertBefore(a, n), n.setAttribute("data-dictate-button-enabled", ""), a.appendChild(n), n.style.boxSizing = "border-box";
|
|
12
12
|
const e = document.createElement("dictate-button");
|
|
13
13
|
e.size = 30, e.style.position = "absolute", e.style.right = "0", e.style.top = T(a, n) + "px", e.style.margin = "10px";
|
|
14
14
|
const s = document.documentElement.lang;
|
|
15
|
-
s && s.length >= 2 && e.
|
|
15
|
+
s && s.length >= 2 && (e.language = s), e.addEventListener("recording:started", (o) => {
|
|
16
16
|
console.log("recording:started", o);
|
|
17
17
|
}), e.addEventListener("recording:stopped", (o) => {
|
|
18
18
|
console.log("recording:stopped", o);
|
|
@@ -41,7 +41,7 @@ function f(t, n) {
|
|
|
41
41
|
const a = typeof n == "string" ? n.trim() : String(n ?? "").trim();
|
|
42
42
|
if (a.length === 0)
|
|
43
43
|
return;
|
|
44
|
-
const e = t.selectionStart || 0, s = t.selectionEnd || 0, o = e > 0 ? t.value.charAt(e - 1) : "", d = o && !/\s/.test(o), c = s < t.value.length ? t.value.charAt(s) : "",
|
|
44
|
+
const e = t.selectionStart || 0, s = t.selectionEnd || 0, o = e > 0 ? t.value.charAt(e - 1) : "", d = o && !/\s/.test(o), c = s < t.value.length ? t.value.charAt(s) : "", p = c && !/\s/.test(c), r = (d ? " " : "") + a + (p ? " " : ""), l = e + r.length, u = typeof t.scrollTop == "number" ? t.scrollTop : null;
|
|
45
45
|
if (typeof t.setRangeText == "function")
|
|
46
46
|
t.setRangeText(r, e, s, "end");
|
|
47
47
|
else {
|
package/dist/inject-inclusive.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const
|
|
1
|
+
const b = [
|
|
2
2
|
"textarea:not([data-dictate-button-off]):not([data-dictate-button-enabled])",
|
|
3
3
|
'input[type="text"]:not([data-dictate-button-off]):not([data-dictate-button-enabled])',
|
|
4
4
|
'input[type="search"]:not([data-dictate-button-off]):not([data-dictate-button-enabled])',
|
|
5
5
|
"input:not([type]):not([data-dictate-button-off]):not([data-dictate-button-enabled])"
|
|
6
6
|
].join(",");
|
|
7
7
|
function g() {
|
|
8
|
-
const t = document.querySelectorAll(
|
|
8
|
+
const t = document.querySelectorAll(b);
|
|
9
9
|
for (const n of t) {
|
|
10
10
|
const a = document.createElement("div");
|
|
11
11
|
a.style.position = "relative", a.style.display = "inline-block", a.style.width = "auto", a.style.color = "inherit", n.parentNode.insertBefore(a, n), n.setAttribute("data-dictate-button-enabled", ""), a.appendChild(n), n.style.boxSizing = "border-box";
|
|
12
12
|
const e = document.createElement("dictate-button");
|
|
13
13
|
e.size = 30, e.style.position = "absolute", e.style.right = "0", e.style.top = f(a, n) + "px", e.style.margin = "10px";
|
|
14
14
|
const s = document.documentElement.lang;
|
|
15
|
-
s && s.length >= 2 && e.
|
|
15
|
+
s && s.length >= 2 && (e.language = s), e.addEventListener("recording:started", (o) => {
|
|
16
16
|
console.log("recording:started", o);
|
|
17
17
|
}), e.addEventListener("recording:stopped", (o) => {
|
|
18
18
|
console.log("recording:stopped", o);
|
|
@@ -41,7 +41,7 @@ function T(t, n) {
|
|
|
41
41
|
const a = typeof n == "string" ? n.trim() : String(n ?? "").trim();
|
|
42
42
|
if (a.length === 0)
|
|
43
43
|
return;
|
|
44
|
-
const e = t.selectionStart || 0, s = t.selectionEnd || 0, o = e > 0 ? t.value.charAt(e - 1) : "", d = o && !/\s/.test(o), c = s < t.value.length ? t.value.charAt(s) : "",
|
|
44
|
+
const e = t.selectionStart || 0, s = t.selectionEnd || 0, o = e > 0 ? t.value.charAt(e - 1) : "", d = o && !/\s/.test(o), c = s < t.value.length ? t.value.charAt(s) : "", p = c && !/\s/.test(c), r = (d ? " " : "") + a + (p ? " " : ""), l = e + r.length, u = typeof t.scrollTop == "number" ? t.scrollTop : null;
|
|
45
45
|
if (typeof t.setRangeText == "function")
|
|
46
46
|
t.setRangeText(r, e, s, "end");
|
|
47
47
|
else {
|