dictate-button 1.1.2 → 1.2.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/README.md CHANGED
@@ -15,6 +15,7 @@ Developed for [dictate-button.io](https://dictate-button.io).
15
15
  - Dark and light theme support
16
16
  - Event-based API for interaction with your application
17
17
  - Built with SolidJS for optimal performance
18
+ - Accessibility is ensured with ARIA attributes, high-contrast mode support, and clear keyboard focus states
18
19
 
19
20
  ## Supported tags (by our inject scripts)
20
21
 
@@ -1,49 +1,49 @@
1
- const pt = (t, e) => t === e, B = {
2
- equals: pt
1
+ const wt = (t, e) => t === e, B = {
2
+ equals: wt
3
3
  };
4
- let gt = lt;
5
- const C = 1, R = 2, et = {
4
+ let vt = ht;
5
+ const S = 1, R = 2, lt = {
6
6
  owned: null,
7
7
  cleanups: null,
8
8
  context: null,
9
9
  owner: null
10
10
  };
11
- var b = null;
12
- let z = null, bt = null, p = null, g = null, w = null, L = 0;
13
- function yt(t, e) {
14
- const n = p, s = b, r = t.length === 0, o = e === void 0 ? s : e, l = r ? et : {
11
+ var _ = null;
12
+ let V = null, Ct = null, p = null, g = null, m = null, L = 0;
13
+ function mt(t, e) {
14
+ const n = p, o = _, r = t.length === 0, i = e === void 0 ? o : e, l = r ? lt : {
15
15
  owned: null,
16
16
  cleanups: null,
17
- context: o ? o.context : null,
18
- owner: o
19
- }, i = r ? t : () => t(() => G(() => E(l)));
20
- b = l, p = null;
17
+ context: i ? i.context : null,
18
+ owner: i
19
+ }, s = r ? t : () => t(() => W(() => $(l)));
20
+ _ = l, p = null;
21
21
  try {
22
- return x(i, !0);
22
+ return T(s, !0);
23
23
  } finally {
24
- p = n, b = s;
24
+ p = n, _ = o;
25
25
  }
26
26
  }
27
- function nt(t, e) {
27
+ function at(t, e) {
28
28
  e = e ? Object.assign({}, B, e) : B;
29
29
  const n = {
30
30
  value: t,
31
31
  observers: null,
32
32
  observerSlots: null,
33
33
  comparator: e.equals || void 0
34
- }, s = (r) => (typeof r == "function" && (r = r(n.value)), st(n, r));
35
- return [rt.bind(n), s];
34
+ }, o = (r) => (typeof r == "function" && (r = r(n.value)), ut(n, r));
35
+ return [ct.bind(n), o];
36
36
  }
37
37
  function I(t, e, n) {
38
- const s = ot(t, e, !1, C);
39
- K(s);
38
+ const o = dt(t, e, !1, S);
39
+ K(o);
40
40
  }
41
- function _t(t, e, n) {
41
+ function St(t, e, n) {
42
42
  n = n ? Object.assign({}, B, n) : B;
43
- const s = ot(t, e, !0, 0);
44
- return s.observers = null, s.observerSlots = null, s.comparator = n.equals || void 0, K(s), rt.bind(s);
43
+ const o = dt(t, e, !0, 0);
44
+ return o.observers = null, o.observerSlots = null, o.comparator = n.equals || void 0, K(o), ct.bind(o);
45
45
  }
46
- function G(t) {
46
+ function W(t) {
47
47
  if (p === null) return t();
48
48
  const e = p;
49
49
  p = null;
@@ -53,12 +53,12 @@ function G(t) {
53
53
  p = e;
54
54
  }
55
55
  }
56
- function rt() {
56
+ function ct() {
57
57
  if (this.sources && this.state)
58
- if (this.state === C) K(this);
58
+ if (this.state === S) K(this);
59
59
  else {
60
60
  const t = g;
61
- g = null, x(() => D(this), !1), g = t;
61
+ g = null, T(() => D(this), !1), g = t;
62
62
  }
63
63
  if (p) {
64
64
  const t = this.observers ? this.observers.length : 0;
@@ -66,12 +66,12 @@ function rt() {
66
66
  }
67
67
  return this.value;
68
68
  }
69
- function st(t, e, n) {
70
- let s = t.value;
71
- return (!t.comparator || !t.comparator(s, e)) && (t.value = e, t.observers && t.observers.length && x(() => {
69
+ function ut(t, e, n) {
70
+ let o = t.value;
71
+ return (!t.comparator || !t.comparator(o, e)) && (t.value = e, t.observers && t.observers.length && T(() => {
72
72
  for (let r = 0; r < t.observers.length; r += 1) {
73
- const o = t.observers[r], l = z && z.running;
74
- l && z.disposed.has(o), (l ? !o.tState : !o.state) && (o.pure ? g.push(o) : w.push(o), o.observers && at(o)), l || (o.state = C);
73
+ const i = t.observers[r], l = V && V.running;
74
+ l && V.disposed.has(i), (l ? !i.tState : !i.state) && (i.pure ? g.push(i) : m.push(i), i.observers && pt(i)), l || (i.state = S);
75
75
  }
76
76
  if (g.length > 1e6)
77
77
  throw g = [], new Error();
@@ -79,105 +79,105 @@ function st(t, e, n) {
79
79
  }
80
80
  function K(t) {
81
81
  if (!t.fn) return;
82
- E(t);
82
+ $(t);
83
83
  const e = L;
84
- wt(t, t.value, e);
84
+ xt(t, t.value, e);
85
85
  }
86
- function wt(t, e, n) {
87
- let s;
88
- const r = b, o = p;
89
- p = b = t;
86
+ function xt(t, e, n) {
87
+ let o;
88
+ const r = _, i = p;
89
+ p = _ = t;
90
90
  try {
91
- s = t.fn(e);
91
+ o = t.fn(e);
92
92
  } catch (l) {
93
- return t.pure && (t.state = C, t.owned && t.owned.forEach(E), t.owned = null), t.updatedAt = n + 1, ct(l);
93
+ return t.pure && (t.state = S, t.owned && t.owned.forEach($), t.owned = null), t.updatedAt = n + 1, gt(l);
94
94
  } finally {
95
- p = o, b = r;
95
+ p = i, _ = r;
96
96
  }
97
- (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? st(t, s) : t.value = s, t.updatedAt = n);
97
+ (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? ut(t, o) : t.value = o, t.updatedAt = n);
98
98
  }
99
- function ot(t, e, n, s = C, r) {
100
- const o = {
99
+ function dt(t, e, n, o = S, r) {
100
+ const i = {
101
101
  fn: t,
102
- state: s,
102
+ state: o,
103
103
  updatedAt: null,
104
104
  owned: null,
105
105
  sources: null,
106
106
  sourceSlots: null,
107
107
  cleanups: null,
108
108
  value: e,
109
- owner: b,
110
- context: b ? b.context : null,
109
+ owner: _,
110
+ context: _ ? _.context : null,
111
111
  pure: n
112
112
  };
113
- return b === null || b !== et && (b.owned ? b.owned.push(o) : b.owned = [o]), o;
113
+ return _ === null || _ !== lt && (_.owned ? _.owned.push(i) : _.owned = [i]), i;
114
114
  }
115
- function it(t) {
115
+ function ft(t) {
116
116
  if (t.state === 0) return;
117
117
  if (t.state === R) return D(t);
118
- if (t.suspense && G(t.suspense.inFallback)) return t.suspense.effects.push(t);
118
+ if (t.suspense && W(t.suspense.inFallback)) return t.suspense.effects.push(t);
119
119
  const e = [t];
120
120
  for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < L); )
121
121
  t.state && e.push(t);
122
122
  for (let n = e.length - 1; n >= 0; n--)
123
- if (t = e[n], t.state === C)
123
+ if (t = e[n], t.state === S)
124
124
  K(t);
125
125
  else if (t.state === R) {
126
- const s = g;
127
- g = null, x(() => D(t, e[0]), !1), g = s;
126
+ const o = g;
127
+ g = null, T(() => D(t, e[0]), !1), g = o;
128
128
  }
129
129
  }
130
- function x(t, e) {
130
+ function T(t, e) {
131
131
  if (g) return t();
132
132
  let n = !1;
133
- e || (g = []), w ? n = !0 : w = [], L++;
133
+ e || (g = []), m ? n = !0 : m = [], L++;
134
134
  try {
135
- const s = t();
136
- return Ct(n), s;
137
- } catch (s) {
138
- n || (w = null), g = null, ct(s);
135
+ const o = t();
136
+ return At(n), o;
137
+ } catch (o) {
138
+ n || (m = null), g = null, gt(o);
139
139
  }
140
140
  }
141
- function Ct(t) {
142
- if (g && (lt(g), g = null), t) return;
143
- const e = w;
144
- w = null, e.length && x(() => gt(e), !1);
141
+ function At(t) {
142
+ if (g && (ht(g), g = null), t) return;
143
+ const e = m;
144
+ m = null, e.length && T(() => vt(e), !1);
145
145
  }
146
- function lt(t) {
147
- for (let e = 0; e < t.length; e++) it(t[e]);
146
+ function ht(t) {
147
+ for (let e = 0; e < t.length; e++) ft(t[e]);
148
148
  }
149
149
  function D(t, e) {
150
150
  t.state = 0;
151
151
  for (let n = 0; n < t.sources.length; n += 1) {
152
- const s = t.sources[n];
153
- if (s.sources) {
154
- const r = s.state;
155
- r === C ? s !== e && (!s.updatedAt || s.updatedAt < L) && it(s) : r === R && D(s, e);
152
+ const o = t.sources[n];
153
+ if (o.sources) {
154
+ const r = o.state;
155
+ r === S ? o !== e && (!o.updatedAt || o.updatedAt < L) && ft(o) : r === R && D(o, e);
156
156
  }
157
157
  }
158
158
  }
159
- function at(t) {
159
+ function pt(t) {
160
160
  for (let e = 0; e < t.observers.length; e += 1) {
161
161
  const n = t.observers[e];
162
- n.state || (n.state = R, n.pure ? g.push(n) : w.push(n), n.observers && at(n));
162
+ n.state || (n.state = R, n.pure ? g.push(n) : m.push(n), n.observers && pt(n));
163
163
  }
164
164
  }
165
- function E(t) {
165
+ function $(t) {
166
166
  let e;
167
167
  if (t.sources)
168
168
  for (; t.sources.length; ) {
169
- const n = t.sources.pop(), s = t.sourceSlots.pop(), r = n.observers;
169
+ const n = t.sources.pop(), o = t.sourceSlots.pop(), r = n.observers;
170
170
  if (r && r.length) {
171
- const o = r.pop(), l = n.observerSlots.pop();
172
- s < r.length && (o.sourceSlots[l] = s, r[s] = o, n.observerSlots[s] = l);
171
+ const i = r.pop(), l = n.observerSlots.pop();
172
+ o < r.length && (i.sourceSlots[l] = o, r[o] = i, n.observerSlots[o] = l);
173
173
  }
174
174
  }
175
175
  if (t.tOwned) {
176
- for (e = t.tOwned.length - 1; e >= 0; e--) E(t.tOwned[e]);
176
+ for (e = t.tOwned.length - 1; e >= 0; e--) $(t.tOwned[e]);
177
177
  delete t.tOwned;
178
178
  }
179
179
  if (t.owned) {
180
- for (e = t.owned.length - 1; e >= 0; e--) E(t.owned[e]);
180
+ for (e = t.owned.length - 1; e >= 0; e--) $(t.owned[e]);
181
181
  t.owned = null;
182
182
  }
183
183
  if (t.cleanups) {
@@ -186,95 +186,95 @@ function E(t) {
186
186
  }
187
187
  t.state = 0;
188
188
  }
189
- function St(t) {
189
+ function Et(t) {
190
190
  return t instanceof Error ? t : new Error(typeof t == "string" ? t : "Unknown error", {
191
191
  cause: t
192
192
  });
193
193
  }
194
- function ct(t, e = b) {
195
- throw St(t);
194
+ function gt(t, e = _) {
195
+ throw Et(t);
196
196
  }
197
- function M(t, e) {
198
- return G(() => t(e || {}));
197
+ function N(t, e) {
198
+ return W(() => t(e || {}));
199
199
  }
200
- const N = (t) => _t(() => t());
201
- function mt(t, e, n) {
202
- let s = n.length, r = e.length, o = s, l = 0, i = 0, a = e[r - 1].nextSibling, u = null;
203
- for (; l < r || i < o; ) {
204
- if (e[l] === n[i]) {
205
- l++, i++;
200
+ const j = (t) => St(() => t());
201
+ function kt(t, e, n) {
202
+ let o = n.length, r = e.length, i = o, l = 0, s = 0, a = e[r - 1].nextSibling, u = null;
203
+ for (; l < r || s < i; ) {
204
+ if (e[l] === n[s]) {
205
+ l++, s++;
206
206
  continue;
207
207
  }
208
- for (; e[r - 1] === n[o - 1]; )
209
- r--, o--;
208
+ for (; e[r - 1] === n[i - 1]; )
209
+ r--, i--;
210
210
  if (r === l) {
211
- const f = o < s ? i ? n[i - 1].nextSibling : n[o - i] : a;
212
- for (; i < o; ) t.insertBefore(n[i++], f);
213
- } else if (o === i)
211
+ const d = i < o ? s ? n[s - 1].nextSibling : n[i - s] : a;
212
+ for (; s < i; ) t.insertBefore(n[s++], d);
213
+ } else if (i === s)
214
214
  for (; l < r; )
215
215
  (!u || !u.has(e[l])) && e[l].remove(), l++;
216
- else if (e[l] === n[o - 1] && n[i] === e[r - 1]) {
217
- const f = e[--r].nextSibling;
218
- t.insertBefore(n[i++], e[l++].nextSibling), t.insertBefore(n[--o], f), e[r] = n[o];
216
+ else if (e[l] === n[i - 1] && n[s] === e[r - 1]) {
217
+ const d = e[--r].nextSibling;
218
+ t.insertBefore(n[s++], e[l++].nextSibling), t.insertBefore(n[--i], d), e[r] = n[i];
219
219
  } else {
220
220
  if (!u) {
221
221
  u = /* @__PURE__ */ new Map();
222
- let _ = i;
223
- for (; _ < o; ) u.set(n[_], _++);
222
+ let w = s;
223
+ for (; w < i; ) u.set(n[w], w++);
224
224
  }
225
- const f = u.get(e[l]);
226
- if (f != null)
227
- if (i < f && f < o) {
228
- let _ = l, v = 1, T;
229
- for (; ++_ < r && _ < o && !((T = u.get(e[_])) == null || T !== f + v); )
230
- v++;
231
- if (v > f - i) {
232
- const $ = e[l];
233
- for (; i < f; ) t.insertBefore(n[i++], $);
234
- } else t.replaceChild(n[i++], e[l++]);
225
+ const d = u.get(e[l]);
226
+ if (d != null)
227
+ if (s < d && d < i) {
228
+ let w = l, E = 1, P;
229
+ for (; ++w < r && w < i && !((P = u.get(e[w])) == null || P !== d + E); )
230
+ E++;
231
+ if (E > d - s) {
232
+ const M = e[l];
233
+ for (; s < d; ) t.insertBefore(n[s++], M);
234
+ } else t.replaceChild(n[s++], e[l++]);
235
235
  } else l++;
236
236
  else e[l++].remove();
237
237
  }
238
238
  }
239
239
  }
240
- const J = "_$DX_DELEGATE";
241
- function k(t, e, n, s) {
240
+ const et = "_$DX_DELEGATE";
241
+ function O(t, e, n, o) {
242
242
  let r;
243
- const o = () => {
244
- const i = document.createElement("template");
245
- return i.innerHTML = t, i.content.firstChild;
246
- }, l = () => (r || (r = o())).cloneNode(!0);
243
+ const i = () => {
244
+ const s = document.createElement("template");
245
+ return s.innerHTML = t, s.content.firstChild;
246
+ }, l = () => (r || (r = i())).cloneNode(!0);
247
247
  return l.cloneNode = l, l;
248
248
  }
249
- function At(t, e = window.document) {
250
- const n = e[J] || (e[J] = /* @__PURE__ */ new Set());
251
- for (let s = 0, r = t.length; s < r; s++) {
252
- const o = t[s];
253
- n.has(o) || (n.add(o), e.addEventListener(o, Et));
249
+ function $t(t, e = window.document) {
250
+ const n = e[et] || (e[et] = /* @__PURE__ */ new Set());
251
+ for (let o = 0, r = t.length; o < r; o++) {
252
+ const i = t[o];
253
+ n.has(i) || (n.add(i), e.addEventListener(i, Ot));
254
254
  }
255
255
  }
256
- function ut(t, e, n) {
256
+ function k(t, e, n) {
257
257
  n == null ? t.removeAttribute(e) : t.setAttribute(e, n);
258
258
  }
259
- function vt(t, e, n) {
260
- if (!e) return n ? ut(t, "style") : e;
261
- const s = t.style;
262
- if (typeof e == "string") return s.cssText = e;
263
- typeof n == "string" && (s.cssText = n = void 0), n || (n = {}), e || (e = {});
264
- let r, o;
265
- for (o in n)
266
- e[o] == null && s.removeProperty(o), delete n[o];
267
- for (o in e)
268
- r = e[o], r !== n[o] && (s.setProperty(o, r), n[o] = r);
259
+ function Tt(t, e, n) {
260
+ if (!e) return n ? k(t, "style") : e;
261
+ const o = t.style;
262
+ if (typeof e == "string") return o.cssText = e;
263
+ typeof n == "string" && (o.cssText = n = void 0), n || (n = {}), e || (e = {});
264
+ let r, i;
265
+ for (i in n)
266
+ e[i] == null && o.removeProperty(i), delete n[i];
267
+ for (i in e)
268
+ r = e[i], r !== n[i] && (o.setProperty(i, r), n[i] = r);
269
269
  return n;
270
270
  }
271
- function A(t, e, n, s) {
272
- if (n !== void 0 && !s && (s = []), typeof e != "function") return F(t, e, s, n);
273
- I((r) => F(t, e(), r, n), s);
271
+ function C(t, e, n, o) {
272
+ if (n !== void 0 && !o && (o = []), typeof e != "function") return F(t, e, o, n);
273
+ I((r) => F(t, e(), r, n), o);
274
274
  }
275
- function Et(t) {
275
+ function Ot(t) {
276
276
  let e = t.target;
277
- const n = `$$${t.type}`, s = t.target, r = t.currentTarget, o = (a) => Object.defineProperty(t, "target", {
277
+ const n = `$$${t.type}`, o = t.target, r = t.currentTarget, i = (a) => Object.defineProperty(t, "target", {
278
278
  configurable: !0,
279
279
  value: a
280
280
  }), l = () => {
@@ -283,8 +283,8 @@ function Et(t) {
283
283
  const u = e[`${n}Data`];
284
284
  if (u !== void 0 ? a.call(e, u, t) : a.call(e, t), t.cancelBubble) return;
285
285
  }
286
- return e.host && typeof e.host != "string" && !e.host._$host && e.contains(t.target) && o(e.host), !0;
287
- }, i = () => {
286
+ return e.host && typeof e.host != "string" && !e.host._$host && e.contains(t.target) && i(e.host), !0;
287
+ }, s = () => {
288
288
  for (; l() && (e = e._$host || e.parentNode || e.host); ) ;
289
289
  };
290
290
  if (Object.defineProperty(t, "currentTarget", {
@@ -294,133 +294,133 @@ function Et(t) {
294
294
  }
295
295
  }), t.composedPath) {
296
296
  const a = t.composedPath();
297
- o(a[0]);
297
+ i(a[0]);
298
298
  for (let u = 0; u < a.length - 2 && (e = a[u], !!l()); u++) {
299
299
  if (e._$host) {
300
- e = e._$host, i();
300
+ e = e._$host, s();
301
301
  break;
302
302
  }
303
303
  if (e.parentNode === r)
304
304
  break;
305
305
  }
306
- } else i();
307
- o(s);
306
+ } else s();
307
+ i(o);
308
308
  }
309
- function F(t, e, n, s, r) {
309
+ function F(t, e, n, o, r) {
310
310
  for (; typeof n == "function"; ) n = n();
311
311
  if (e === n) return n;
312
- const o = typeof e, l = s !== void 0;
313
- if (t = l && n[0] && n[0].parentNode || t, o === "string" || o === "number") {
314
- if (o === "number" && (e = e.toString(), e === n))
312
+ const i = typeof e, l = o !== void 0;
313
+ if (t = l && n[0] && n[0].parentNode || t, i === "string" || i === "number") {
314
+ if (i === "number" && (e = e.toString(), e === n))
315
315
  return n;
316
316
  if (l) {
317
- let i = n[0];
318
- i && i.nodeType === 3 ? i.data !== e && (i.data = e) : i = document.createTextNode(e), n = S(t, n, s, i);
317
+ let s = n[0];
318
+ s && s.nodeType === 3 ? s.data !== e && (s.data = e) : s = document.createTextNode(e), n = x(t, n, o, s);
319
319
  } else
320
320
  n !== "" && typeof n == "string" ? n = t.firstChild.data = e : n = t.textContent = e;
321
- } else if (e == null || o === "boolean")
322
- n = S(t, n, s);
321
+ } else if (e == null || i === "boolean")
322
+ n = x(t, n, o);
323
323
  else {
324
- if (o === "function")
324
+ if (i === "function")
325
325
  return I(() => {
326
- let i = e();
327
- for (; typeof i == "function"; ) i = i();
328
- n = F(t, i, n, s);
326
+ let s = e();
327
+ for (; typeof s == "function"; ) s = s();
328
+ n = F(t, s, n, o);
329
329
  }), () => n;
330
330
  if (Array.isArray(e)) {
331
- const i = [], a = n && Array.isArray(n);
332
- if (H(i, e, n, r))
333
- return I(() => n = F(t, i, n, s, !0)), () => n;
334
- if (i.length === 0) {
335
- if (n = S(t, n, s), l) return n;
336
- } else a ? n.length === 0 ? Z(t, i, s) : mt(t, n, i) : (n && S(t), Z(t, i));
337
- n = i;
331
+ const s = [], a = n && Array.isArray(n);
332
+ if (G(s, e, n, r))
333
+ return I(() => n = F(t, s, n, o, !0)), () => n;
334
+ if (s.length === 0) {
335
+ if (n = x(t, n, o), l) return n;
336
+ } else a ? n.length === 0 ? nt(t, s, o) : kt(t, n, s) : (n && x(t), nt(t, s));
337
+ n = s;
338
338
  } else if (e.nodeType) {
339
339
  if (Array.isArray(n)) {
340
- if (l) return n = S(t, n, s, e);
341
- S(t, n, null, e);
340
+ if (l) return n = x(t, n, o, e);
341
+ x(t, n, null, e);
342
342
  } else n == null || n === "" || !t.firstChild ? t.appendChild(e) : t.replaceChild(e, t.firstChild);
343
343
  n = e;
344
344
  }
345
345
  }
346
346
  return n;
347
347
  }
348
- function H(t, e, n, s) {
348
+ function G(t, e, n, o) {
349
349
  let r = !1;
350
- for (let o = 0, l = e.length; o < l; o++) {
351
- let i = e[o], a = n && n[t.length], u;
352
- if (!(i == null || i === !0 || i === !1)) if ((u = typeof i) == "object" && i.nodeType)
353
- t.push(i);
354
- else if (Array.isArray(i))
355
- r = H(t, i, a) || r;
350
+ for (let i = 0, l = e.length; i < l; i++) {
351
+ let s = e[i], a = n && n[t.length], u;
352
+ if (!(s == null || s === !0 || s === !1)) if ((u = typeof s) == "object" && s.nodeType)
353
+ t.push(s);
354
+ else if (Array.isArray(s))
355
+ r = G(t, s, a) || r;
356
356
  else if (u === "function")
357
- if (s) {
358
- for (; typeof i == "function"; ) i = i();
359
- r = H(t, Array.isArray(i) ? i : [i], Array.isArray(a) ? a : [a]) || r;
357
+ if (o) {
358
+ for (; typeof s == "function"; ) s = s();
359
+ r = G(t, Array.isArray(s) ? s : [s], Array.isArray(a) ? a : [a]) || r;
360
360
  } else
361
- t.push(i), r = !0;
361
+ t.push(s), r = !0;
362
362
  else {
363
- const f = String(i);
364
- a && a.nodeType === 3 && a.data === f ? t.push(a) : t.push(document.createTextNode(f));
363
+ const d = String(s);
364
+ a && a.nodeType === 3 && a.data === d ? t.push(a) : t.push(document.createTextNode(d));
365
365
  }
366
366
  }
367
367
  return r;
368
368
  }
369
- function Z(t, e, n = null) {
370
- for (let s = 0, r = e.length; s < r; s++) t.insertBefore(e[s], n);
369
+ function nt(t, e, n = null) {
370
+ for (let o = 0, r = e.length; o < r; o++) t.insertBefore(e[o], n);
371
371
  }
372
- function S(t, e, n, s) {
372
+ function x(t, e, n, o) {
373
373
  if (n === void 0) return t.textContent = "";
374
- const r = s || document.createTextNode("");
374
+ const r = o || document.createTextNode("");
375
375
  if (e.length) {
376
- let o = !1;
376
+ let i = !1;
377
377
  for (let l = e.length - 1; l >= 0; l--) {
378
- const i = e[l];
379
- if (r !== i) {
380
- const a = i.parentNode === t;
381
- !o && !l ? a ? t.replaceChild(r, i) : t.insertBefore(r, n) : a && i.remove();
382
- } else o = !0;
378
+ const s = e[l];
379
+ if (r !== s) {
380
+ const a = s.parentNode === t;
381
+ !i && !l ? a ? t.replaceChild(r, s) : t.insertBefore(r, n) : a && s.remove();
382
+ } else i = !0;
383
383
  }
384
384
  } else t.insertBefore(r, n);
385
385
  return [r];
386
386
  }
387
- function xt(t) {
388
- return Object.keys(t).reduce((n, s) => {
389
- const r = t[s];
390
- return n[s] = Object.assign({}, r), dt(r.value) && !Pt(r.value) && !Array.isArray(r.value) && (n[s].value = Object.assign({}, r.value)), Array.isArray(r.value) && (n[s].value = r.value.slice(0)), n;
387
+ function Pt(t) {
388
+ return Object.keys(t).reduce((n, o) => {
389
+ const r = t[o];
390
+ return n[o] = Object.assign({}, r), _t(r.value) && !Rt(r.value) && !Array.isArray(r.value) && (n[o].value = Object.assign({}, r.value)), Array.isArray(r.value) && (n[o].value = r.value.slice(0)), n;
391
391
  }, {});
392
392
  }
393
- function kt(t) {
394
- return t ? Object.keys(t).reduce((n, s) => {
395
- const r = t[s];
396
- return n[s] = dt(r) && "value" in r ? r : {
393
+ function Mt(t) {
394
+ return t ? Object.keys(t).reduce((n, o) => {
395
+ const r = t[o];
396
+ return n[o] = _t(r) && "value" in r ? r : {
397
397
  value: r
398
- }, n[s].attribute || (n[s].attribute = Ot(s)), n[s].parse = "parse" in n[s] ? n[s].parse : typeof n[s].value != "string", n;
398
+ }, n[o].attribute || (n[o].attribute = Bt(o)), n[o].parse = "parse" in n[o] ? n[o].parse : typeof n[o].value != "string", n;
399
399
  }, {}) : {};
400
400
  }
401
- function Tt(t) {
402
- return Object.keys(t).reduce((n, s) => (n[s] = t[s].value, n), {});
401
+ function Nt(t) {
402
+ return Object.keys(t).reduce((n, o) => (n[o] = t[o].value, n), {});
403
403
  }
404
- function $t(t, e) {
405
- const n = xt(e);
404
+ function jt(t, e) {
405
+ const n = Pt(e);
406
406
  return Object.keys(e).forEach((r) => {
407
- const o = n[r], l = t.getAttribute(o.attribute), i = t[r];
408
- l != null && (o.value = o.parse ? ft(l) : l), i != null && (o.value = Array.isArray(i) ? i.slice(0) : i), o.reflect && Q(t, o.attribute, o.value, !!o.parse), Object.defineProperty(t, r, {
407
+ const i = n[r], l = t.getAttribute(i.attribute), s = t[r];
408
+ l != null && (i.value = i.parse ? bt(l) : l), s != null && (i.value = Array.isArray(s) ? s.slice(0) : s), i.reflect && rt(t, i.attribute, i.value, !!i.parse), Object.defineProperty(t, r, {
409
409
  get() {
410
- return o.value;
410
+ return i.value;
411
411
  },
412
412
  set(a) {
413
- const u = o.value;
414
- o.value = a, o.reflect && Q(this, o.attribute, o.value, !!o.parse);
415
- for (let f = 0, _ = this.__propertyChangedCallbacks.length; f < _; f++)
416
- this.__propertyChangedCallbacks[f](r, a, u);
413
+ const u = i.value;
414
+ i.value = a, i.reflect && rt(this, i.attribute, i.value, !!i.parse);
415
+ for (let d = 0, w = this.__propertyChangedCallbacks.length; d < w; d++)
416
+ this.__propertyChangedCallbacks[d](r, a, u);
417
417
  },
418
418
  enumerable: !0,
419
419
  configurable: !0
420
420
  });
421
421
  }), n;
422
422
  }
423
- function ft(t) {
423
+ function bt(t) {
424
424
  if (t)
425
425
  try {
426
426
  return JSON.parse(t);
@@ -428,25 +428,25 @@ function ft(t) {
428
428
  return t;
429
429
  }
430
430
  }
431
- function Q(t, e, n, s) {
431
+ function rt(t, e, n, o) {
432
432
  if (n == null || n === !1) return t.removeAttribute(e);
433
- let r = s ? JSON.stringify(n) : n;
433
+ let r = o ? JSON.stringify(n) : n;
434
434
  t.__updating[e] = !0, r === "true" && (r = ""), t.setAttribute(e, r), Promise.resolve().then(() => delete t.__updating[e]);
435
435
  }
436
- function Ot(t) {
436
+ function Bt(t) {
437
437
  return t.replace(/\.?([A-Z]+)/g, (e, n) => "-" + n.toLowerCase()).replace("_", "-").replace(/^-/, "");
438
438
  }
439
- function dt(t) {
439
+ function _t(t) {
440
440
  return t != null && (typeof t == "object" || typeof t == "function");
441
441
  }
442
- function Pt(t) {
442
+ function Rt(t) {
443
443
  return Object.prototype.toString.call(t) === "[object Function]";
444
444
  }
445
- function Mt(t) {
445
+ function It(t) {
446
446
  return typeof t == "function" && t.toString().indexOf("class") === 0;
447
447
  }
448
- let V;
449
- function Nt(t, e) {
448
+ let q;
449
+ function Dt(t, e) {
450
450
  const n = Object.keys(e);
451
451
  return class extends t {
452
452
  static get observedAttributes() {
@@ -457,16 +457,16 @@ function Nt(t, e) {
457
457
  }
458
458
  connectedCallback() {
459
459
  if (this.__initialized) return;
460
- this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = $t(this, e);
461
- const r = Tt(this.props), o = this.Component, l = V;
460
+ this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = jt(this, e);
461
+ const r = Nt(this.props), i = this.Component, l = q;
462
462
  try {
463
- V = this, this.__initialized = !0, Mt(o) ? new o(r, {
463
+ q = this, this.__initialized = !0, It(i) ? new i(r, {
464
464
  element: this
465
- }) : o(r, {
465
+ }) : i(r, {
466
466
  element: this
467
467
  });
468
468
  } finally {
469
- V = l;
469
+ q = l;
470
470
  }
471
471
  }
472
472
  async disconnectedCallback() {
@@ -476,15 +476,15 @@ function Nt(t, e) {
476
476
  for (; r = this.__releaseCallbacks.pop(); ) r(this);
477
477
  delete this.__initialized, this.__released = !0;
478
478
  }
479
- attributeChangedCallback(r, o, l) {
479
+ attributeChangedCallback(r, i, l) {
480
480
  if (this.__initialized && !this.__updating[r] && (r = this.lookupProp(r), r in e)) {
481
481
  if (l == null && !this[r]) return;
482
- this[r] = e[r].parse ? ft(l) : l;
482
+ this[r] = e[r].parse ? bt(l) : l;
483
483
  }
484
484
  }
485
485
  lookupProp(r) {
486
486
  if (e)
487
- return n.find((o) => r === o || r === e[o].attribute);
487
+ return n.find((i) => r === i || r === e[i].attribute);
488
488
  }
489
489
  get renderRoot() {
490
490
  return this.shadowRoot || this.attachShadow({
@@ -499,54 +499,54 @@ function Nt(t, e) {
499
499
  }
500
500
  };
501
501
  }
502
- function jt(t, e = {}, n = {}) {
502
+ function Ft(t, e = {}, n = {}) {
503
503
  const {
504
- BaseElement: s = HTMLElement,
504
+ BaseElement: o = HTMLElement,
505
505
  extension: r,
506
- customElements: o = window.customElements
506
+ customElements: i = window.customElements
507
507
  } = n;
508
508
  return (l) => {
509
- let i = o.get(t);
510
- return i ? (i.prototype.Component = l, i) : (i = Nt(s, kt(e)), i.prototype.Component = l, i.prototype.registeredTag = t, o.define(t, i, r), i);
509
+ let s = i.get(t);
510
+ return s ? (s.prototype.Component = l, s) : (s = Dt(o, Mt(e)), s.prototype.Component = l, s.prototype.registeredTag = t, i.define(t, s, r), s);
511
511
  };
512
512
  }
513
- function Bt(t) {
513
+ function Lt(t) {
514
514
  const e = Object.keys(t), n = {};
515
- for (let s = 0; s < e.length; s++) {
516
- const [r, o] = nt(t[e[s]]);
517
- Object.defineProperty(n, e[s], {
515
+ for (let o = 0; o < e.length; o++) {
516
+ const [r, i] = at(t[e[o]]);
517
+ Object.defineProperty(n, e[o], {
518
518
  get: r,
519
519
  set(l) {
520
- o(() => l);
520
+ i(() => l);
521
521
  }
522
522
  });
523
523
  }
524
524
  return n;
525
525
  }
526
- function Rt(t) {
526
+ function Kt(t) {
527
527
  if (t.assignedSlot && t.assignedSlot._$owner) return t.assignedSlot._$owner;
528
528
  let e = t.parentNode;
529
529
  for (; e && !e._$owner && !(e.assignedSlot && e.assignedSlot._$owner); )
530
530
  e = e.parentNode;
531
531
  return e && e.assignedSlot ? e.assignedSlot._$owner : t._$owner;
532
532
  }
533
- function It(t) {
533
+ function Ut(t) {
534
534
  return (e, n) => {
535
- const { element: s } = n;
536
- return yt((r) => {
537
- const o = Bt(e);
538
- s.addPropertyChangedCallback((i, a) => o[i] = a), s.addReleaseCallback(() => {
539
- s.renderRoot.textContent = "", r();
535
+ const { element: o } = n;
536
+ return mt((r) => {
537
+ const i = Lt(e);
538
+ o.addPropertyChangedCallback((s, a) => i[s] = a), o.addReleaseCallback(() => {
539
+ o.renderRoot.textContent = "", r();
540
540
  });
541
- const l = t(o, n);
542
- return A(s.renderRoot, l);
543
- }, Rt(s));
541
+ const l = t(i, n);
542
+ return C(o.renderRoot, l);
543
+ }, Kt(o));
544
544
  };
545
545
  }
546
- function Dt(t, e, n) {
547
- return arguments.length === 2 && (n = e, e = {}), jt(t, e)(It(n));
546
+ function zt(t, e, n) {
547
+ return arguments.length === 2 && (n = e, e = {}), Ft(t, e)(Ut(n));
548
548
  }
549
- const Ft = `
549
+ const Vt = `
550
550
  :host([theme="dark"]) {
551
551
  color-scheme: only dark;
552
552
  }
@@ -560,15 +560,25 @@ const Ft = `
560
560
  display: inline-flex;
561
561
  align-items: center;
562
562
  justify-content: center;
563
- color: light-dark(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.95));
564
- background-color: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.7));
563
+ color: light-dark(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 1));
564
+ background-color: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.85));
565
565
  border-radius: 50%;
566
566
  border: none;
567
- transition: box-shadow 0.05s linear;
567
+ transition: box-shadow 0.05s linear, background-color 0.2s ease;
568
568
  box-sizing: border-box;
569
569
  }
570
- :host .dictate-button__button:hover, :host .dictate-button__button:focus {
571
- background-color: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.6));
570
+ :host .dictate-button__button:hover {
571
+ background-color: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.7));
572
+ }
573
+
574
+ :host .dictate-button__button:focus {
575
+ background-color: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.7));
576
+ outline: none;
577
+ }
578
+
579
+ :host .dictate-button__button:focus-visible {
580
+ outline: 2px solid light-dark(rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0.8));
581
+ outline-offset: 2px;
572
582
  }
573
583
 
574
584
  :host .dictate-button__button .dictate-button__icon {
@@ -584,121 +594,144 @@ const Ft = `
584
594
  0% { transform: rotate(0deg); }
585
595
  100% { transform: rotate(360deg); }
586
596
  }
597
+
598
+ @media (forced-colors: active) {
599
+ :host .dictate-button__button {
600
+ border: 1px solid currentColor;
601
+ }
602
+ :host .dictate-button__button:focus-visible {
603
+ outline: 3px solid currentColor;
604
+ }
605
+ }
587
606
  `;
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.2");
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
- Dt("dictate-button", {
607
+ var qt = /* @__PURE__ */ O('<div part=container class=dictate-button__container><style></style><div aria-live=polite class=dictate-button__status-announcer style="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0"></div><button part=button class=dictate-button__button>'), Ht = /* @__PURE__ */ O('<svg part=icon class="dictate-button__icon dictate-button__icon--idle"fill=none viewBox="0 0 24 24"stroke-width=1.5 stroke=currentColor role=img aria-hidden=true><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">'), Gt = /* @__PURE__ */ O('<svg part=icon class="dictate-button__icon dictate-button__icon--recording"viewBox="0 0 24 24"fill=currentColor role=img aria-hidden=true><circle cx=12 cy=12 r=10>'), Wt = /* @__PURE__ */ O('<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 role=img aria-hidden=true><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">'), Xt = /* @__PURE__ */ O('<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 role=img aria-hidden=true><line x1=12 x2=12 y1=4 y2=14></line><line x1=12 x2=12.01 y1=20 y2=20>');
608
+ console.debug("dictate-button version:", "1.2.0");
609
+ const Jt = "https://api.dictate-button.io/transcribe", v = "dictate-button.io", H = -70, ot = -10, it = 0, Zt = 4, Qt = 0.25, Yt = 0.05;
610
+ zt("dictate-button", {
592
611
  size: 30,
593
- apiEndpoint: qt,
612
+ apiEndpoint: Jt,
594
613
  language: void 0
595
614
  }, (t, {
596
615
  element: e
597
616
  }) => {
598
617
  console.debug("api", t.apiEndpoint);
599
- const [n, s] = nt("idle");
600
- let r = null, o = [], l = null, i = null, a = null, u = !1, f = 0;
601
- const _ = (d) => d <= q ? 0 : d >= Y ? 1 : (d - q) / (Y - q), v = (d) => {
618
+ const [n, o] = at("idle");
619
+ let r = null, i = [], l = null, s = null, a = null, u = !1, d = 0;
620
+ const w = (f) => f <= H ? 0 : f >= ot ? 1 : (f - H) / (ot - H), E = (f) => {
602
621
  let y = 0;
603
- for (let h = 0; h < d.length; h++) {
604
- const c = (d[h] - 128) / 128;
622
+ for (let b = 0; b < f.length; b++) {
623
+ const c = (f[b] - 128) / 128;
605
624
  y += c * c;
606
625
  }
607
- return Math.sqrt(y / d.length);
608
- }, T = (d) => 20 * Math.log10(Math.max(d, 1e-8)), $ = (d) => {
626
+ return Math.sqrt(y / f.length);
627
+ }, P = (f) => 20 * Math.log10(Math.max(f, 1e-8)), M = (f) => {
609
628
  const y = e.shadowRoot.querySelector(".dictate-button__button");
610
629
  if (!y)
611
630
  return;
612
- const h = tt + d * (Ht - tt), c = 0 + d * 0.4;
613
- y.style.boxShadow = `0 0 0 ${h}px light-dark(rgba(0, 0, 0, ${c}), rgba(255, 255, 255, ${c}))`;
614
- }, W = () => {
615
- if (!u || !i || !a) return;
616
- i.getByteTimeDomainData(a);
617
- const d = v(a), y = T(d), h = _(y), c = h > f ? Gt : Wt;
618
- f = c * h + (1 - c) * f, $(f), requestAnimationFrame(W);
631
+ const b = it + f * (Zt - it), c = 0 + f * 0.4;
632
+ y.style.boxShadow = `0 0 0 ${b}px light-dark(rgba(0, 0, 0, ${c}), rgba(255, 255, 255, ${c}))`;
633
+ }, X = () => {
634
+ if (!u || !s || !a) return;
635
+ s.getByteTimeDomainData(a);
636
+ const f = E(a), y = P(f), b = w(y), c = b > d ? Qt : Yt;
637
+ d = c * b + (1 - c) * d, M(d), requestAnimationFrame(X);
619
638
  }, U = () => {
620
- r && r.state !== "inactive" && r.stop(), o = [], u = !1, l && l.state !== "closed" && l.close(), l = null, i = null, a = null, f = 0, $(0);
639
+ r && r.state !== "inactive" && r.stop(), i = [], u = !1, l && l.state !== "closed" && l.close(), l = null, s = null, a = null, d = 0, M(0);
621
640
  };
622
641
  e.addEventListener("disconnected", U);
623
- const ht = async () => {
642
+ const yt = async () => {
624
643
  if (U(), n() === "idle")
625
644
  try {
626
- const d = await navigator.mediaDevices.getUserMedia({
645
+ const f = await navigator.mediaDevices.getUserMedia({
627
646
  audio: !0
628
647
  });
629
648
  l = new (window.AudioContext || window.webkitAudioContext)();
630
- const y = l.createMediaStreamSource(d);
631
- i = l.createAnalyser(), i.fftSize = 2048, y.connect(i), a = new Uint8Array(i.fftSize), r = new MediaRecorder(d, {
649
+ const y = l.createMediaStreamSource(f);
650
+ s = l.createAnalyser(), s.fftSize = 2048, y.connect(s), a = new Uint8Array(s.fftSize), r = new MediaRecorder(f, {
632
651
  mimeType: "audio/webm"
633
- }), o = [], r.ondataavailable = (h) => {
634
- o.push(h.data);
652
+ }), i = [], r.ondataavailable = (b) => {
653
+ i.push(b.data);
635
654
  }, r.onstop = async () => {
636
- u = !1, s("processing"), m(e, "transcribing:started", "Started transcribing");
637
- const h = new Blob(o, {
655
+ u = !1, o("processing"), A(e, "transcribing:started", "Started transcribing");
656
+ const b = new Blob(i, {
638
657
  type: "audio/webm"
639
658
  });
640
659
  try {
641
660
  const c = new FormData();
642
- c.append("audio", h, "recording.webm"), c.append("origin", window?.location?.origin), t.language && c.append("language", t.language);
643
- const O = await fetch(t.apiEndpoint, {
661
+ c.append("audio", b, "recording.webm"), c.append("origin", window?.location?.origin), t.language && c.append("language", t.language);
662
+ const h = await fetch(t.apiEndpoint, {
644
663
  method: "POST",
645
664
  body: c
646
665
  });
647
- if (!O.ok) throw new Error("Failed to transcribe audio");
648
- const P = await O.json();
666
+ if (!h.ok) throw new Error("Failed to transcribe audio");
667
+ const z = await h.json();
649
668
  if (n() !== "processing") return;
650
- m(e, "transcribing:finished", P.text), s("idle");
669
+ A(e, "transcribing:finished", z.text), o("idle");
651
670
  } catch (c) {
652
- console.error("Failed to transcribe audio:", c), m(e, "transcribing:failed", "Failed to transcribe audio"), X();
671
+ console.error("Failed to transcribe audio:", c), A(e, "transcribing:failed", "Failed to transcribe audio"), J();
653
672
  }
654
- }, r.start(), m(e, "recording:started", "Started recording"), u = !0, W(), s("recording");
655
- } catch (d) {
656
- console.error("Failed to start recording:", d), m(e, "recording:failed", "Failed to start recording"), X();
673
+ }, r.start(), A(e, "recording:started", "Started recording"), u = !0, X(), o("recording");
674
+ } catch (f) {
675
+ console.error("Failed to start recording:", f), A(e, "recording:failed", "Failed to start recording"), J();
657
676
  }
658
677
  else
659
- m(e, "recording:stopped", "Stopped recording"), s("idle"), U();
660
- }, X = () => {
661
- s("error"), setTimeout(() => s("idle"), 2e3);
678
+ A(e, "recording:stopped", "Stopped recording"), o("idle"), U();
679
+ }, J = () => {
680
+ o("error"), setTimeout(() => o("idle"), 2e3);
662
681
  };
663
682
  return (() => {
664
- var d = Lt(), y = d.firstChild, h = y.nextSibling;
665
- return A(y, Ft), h.$$click = ht, A(h, (() => {
666
- var c = N(() => n() === "idle");
667
- return () => c() && M(Jt, {});
668
- })(), null), A(h, (() => {
669
- var c = N(() => n() === "recording");
670
- return () => c() && M(Zt, {});
671
- })(), null), A(h, (() => {
672
- var c = N(() => n() === "processing");
673
- return () => c() && M(Qt, {});
674
- })(), null), A(h, (() => {
675
- var c = N(() => n() === "error");
676
- return () => c() && M(Yt, {});
677
- })(), null), I((c) => {
678
- var O = `width:${t.size}px;height:${t.size}px"`, P = Xt(n());
679
- return c.e = vt(h, O, c.e), P !== c.t && ut(h, "title", c.t = P), c;
683
+ var f = qt(), y = f.firstChild, b = y.nextSibling, c = b.nextSibling;
684
+ return C(y, Vt), C(b, () => st(n())), c.$$click = yt, C(c, (() => {
685
+ var h = j(() => n() === "idle");
686
+ return () => h() && N(ee, {});
687
+ })(), null), C(c, (() => {
688
+ var h = j(() => n() === "recording");
689
+ return () => h() && N(ne, {});
690
+ })(), null), C(c, (() => {
691
+ var h = j(() => n() === "processing");
692
+ return () => h() && N(re, {});
693
+ })(), null), C(c, (() => {
694
+ var h = j(() => n() === "error");
695
+ return () => h() && N(oe, {});
696
+ })(), null), I((h) => {
697
+ var z = `width:${t.size}px;height:${t.size}px"`, Z = te(n()), Q = st(n()), Y = n() === "recording", tt = n() === "processing";
698
+ return h.e = Tt(c, z, h.e), Z !== h.t && k(c, "title", h.t = Z), Q !== h.a && k(c, "aria-label", h.a = Q), Y !== h.o && k(c, "aria-pressed", h.o = Y), tt !== h.i && k(c, "aria-busy", h.i = tt), h;
680
699
  }, {
681
700
  e: void 0,
682
- t: void 0
683
- }), d;
701
+ t: void 0,
702
+ a: void 0,
703
+ o: void 0,
704
+ i: void 0
705
+ }), f;
684
706
  })();
685
707
  });
686
- const Xt = (t) => {
708
+ const te = (t) => {
709
+ switch (t) {
710
+ case "idle":
711
+ return `Start dictation (${v})`;
712
+ case "recording":
713
+ return `Stop dictation (${v})`;
714
+ case "processing":
715
+ return `Stop processing (${v})`;
716
+ case "error":
717
+ return `Click to reset (${v})`;
718
+ }
719
+ }, st = (t) => {
687
720
  switch (t) {
688
721
  case "idle":
689
- return `Start dictation (${j})`;
722
+ return `Start dictation (${v})`;
690
723
  case "recording":
691
- return `Stop dictation (${j})`;
724
+ return `Dictation in progress. Click to stop it (${v})`;
692
725
  case "processing":
693
- return `Stop processing (${j})`;
726
+ return `Processing dictation. Click to cancel it (${v})`;
694
727
  case "error":
695
- return `Click to reset (${j})`;
728
+ return `Dictation error. Click to reset (${v})`;
696
729
  }
697
- }, m = (t, e, n) => {
730
+ }, A = (t, e, n) => {
698
731
  t.dispatchEvent(new CustomEvent(e, {
699
732
  detail: n,
700
733
  bubbles: !0,
701
734
  composed: !0
702
735
  }));
703
- }, Jt = () => Kt(), Zt = () => Ut(), Qt = () => zt(), Yt = () => Vt();
704
- At(["click"]);
736
+ }, ee = () => Ht(), ne = () => Gt(), re = () => Wt(), oe = () => Xt();
737
+ $t(["click"]);
@@ -1 +1 @@
1
- export declare const dictateButtonStyles = "\n:host([theme=\"dark\"]) {\n color-scheme: only dark;\n}\n:host([theme=\"light\"]) {\n color-scheme: only light;\n}\n\n:host .dictate-button__button {\n cursor: pointer;\n padding: 8px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: light-dark(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.95));\n background-color: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.7));\n border-radius: 50%;\n border: none;\n transition: box-shadow 0.05s linear;\n box-sizing: border-box;\n}\n:host .dictate-button__button:hover, :host .dictate-button__button:focus {\n background-color: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.6));\n}\n\n:host .dictate-button__button .dictate-button__icon {\n width: 100%;\n height: 100%;\n}\n\n:host .dictate-button__button .dictate-button__icon.dictate-button__icon--processing {\n animation: dictate-button-rotate 1s linear infinite;\n}\n\n@keyframes dictate-button-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n";
1
+ export declare const dictateButtonStyles = "\n:host([theme=\"dark\"]) {\n color-scheme: only dark;\n}\n:host([theme=\"light\"]) {\n color-scheme: only light;\n}\n\n:host .dictate-button__button {\n cursor: pointer;\n padding: 8px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n color: light-dark(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 1));\n background-color: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.85));\n border-radius: 50%;\n border: none;\n transition: box-shadow 0.05s linear, background-color 0.2s ease;\n box-sizing: border-box;\n}\n:host .dictate-button__button:hover {\n background-color: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.7));\n}\n\n:host .dictate-button__button:focus {\n background-color: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.7));\n outline: none;\n}\n\n:host .dictate-button__button:focus-visible {\n outline: 2px solid light-dark(rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0.8));\n outline-offset: 2px;\n}\n\n:host .dictate-button__button .dictate-button__icon {\n width: 100%;\n height: 100%;\n}\n\n:host .dictate-button__button .dictate-button__icon.dictate-button__icon--processing {\n animation: dictate-button-rotate 1s linear infinite;\n}\n\n@keyframes dictate-button-rotate {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n}\n\n@media (forced-colors: active) {\n :host .dictate-button__button {\n border: 1px solid currentColor;\n }\n :host .dictate-button__button:focus-visible {\n outline: 3px solid currentColor;\n }\n}\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dictate-button",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Dictate Button (Web Component)",
5
5
  "keywords": [
6
6
  "custom-element",