@stonecrop/utilities 0.6.1 → 0.6.3

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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.10"
8
+ "packageVersion": "7.55.2"
9
9
  }
10
10
  ]
11
11
  }
package/dist/utilities.js CHANGED
@@ -1,16 +1,16 @@
1
- import { watch as T, getCurrentScope as V, onScopeDispose as _, computed as w, shallowRef as M, toValue as C, watchEffect as j, unref as B, getCurrentInstance as q, onMounted as F, ref as K, onBeforeUnmount as G } from "vue";
2
- function k(e, t) {
3
- return V() ? (_(e, t), !0) : !1;
1
+ import { watch as S, getCurrentScope as K, onScopeDispose as V, computed as h, shallowRef as M, toValue as C, watchEffect as j, getCurrentInstance as B, onMounted as W, unref as q, ref as F, onBeforeUnmount as G } from "vue";
2
+ function _(e, t) {
3
+ return K() ? (V(e, t), !0) : !1;
4
4
  }
5
5
  const z = typeof window < "u" && typeof document < "u";
6
6
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
7
7
  const J = (e) => e != null, Q = Object.prototype.toString, X = (e) => Q.call(e) === "[object Object]", Y = () => {
8
8
  };
9
- function S(e) {
9
+ function b(e) {
10
10
  return Array.isArray(e) ? e : [e];
11
11
  }
12
12
  function Z(e, t, n) {
13
- return T(e, t, {
13
+ return S(e, t, {
14
14
  ...n,
15
15
  immediate: !0
16
16
  });
@@ -21,245 +21,243 @@ function $(e) {
21
21
  const n = C(e);
22
22
  return (t = n?.$el) !== null && t !== void 0 ? t : n;
23
23
  }
24
- function y(...e) {
25
- const t = [], n = () => {
26
- t.forEach((o) => o()), t.length = 0;
27
- }, l = (o, i, r, a) => (o.addEventListener(i, r, a), () => o.removeEventListener(i, r, a)), c = w(() => {
28
- const o = S(C(e[0])).filter((i) => i != null);
29
- return o.every((i) => typeof i != "string") ? o : void 0;
30
- }), u = Z(() => {
31
- var o, i;
24
+ function w(...e) {
25
+ const t = (o, r, s, l) => (o.addEventListener(r, s, l), () => o.removeEventListener(r, s, l)), n = h(() => {
26
+ const o = b(C(e[0])).filter((r) => r != null);
27
+ return o.every((r) => typeof r != "string") ? o : void 0;
28
+ });
29
+ return Z(() => {
30
+ var o, r;
32
31
  return [
33
- (o = (i = c.value) === null || i === void 0 ? void 0 : i.map((r) => $(r))) !== null && o !== void 0 ? o : [E].filter((r) => r != null),
34
- S(C(c.value ? e[1] : e[0])),
35
- S(B(c.value ? e[2] : e[1])),
36
- C(c.value ? e[3] : e[2])
32
+ (o = (r = n.value) === null || r === void 0 ? void 0 : r.map((s) => $(s))) !== null && o !== void 0 ? o : [E].filter((s) => s != null),
33
+ b(C(n.value ? e[1] : e[0])),
34
+ b(q(n.value ? e[2] : e[1])),
35
+ C(n.value ? e[3] : e[2])
37
36
  ];
38
- }, ([o, i, r, a]) => {
39
- if (n(), !o?.length || !i?.length || !r?.length) return;
40
- const f = X(a) ? { ...a } : a;
41
- t.push(...o.flatMap((d) => i.flatMap((p) => r.map((h) => l(d, p, h, f)))));
42
- }, { flush: "post" }), s = () => {
43
- u(), n();
44
- };
45
- return k(n), s;
37
+ }, ([o, r, s, l], i, a) => {
38
+ if (!o?.length || !r?.length || !s?.length) return;
39
+ const c = X(l) ? { ...l } : l, u = o.flatMap((f) => r.flatMap((d) => s.map((p) => t(f, d, p, c))));
40
+ a(() => {
41
+ u.forEach((f) => f());
42
+ });
43
+ }, { flush: "post" });
46
44
  }
47
45
  // @__NO_SIDE_EFFECTS__
48
46
  function ee() {
49
- const e = M(!1), t = q();
50
- return t && F(() => {
47
+ const e = M(!1), t = B();
48
+ return t && W(() => {
51
49
  e.value = !0;
52
50
  }, t), e;
53
51
  }
54
52
  // @__NO_SIDE_EFFECTS__
55
53
  function te(e) {
56
54
  const t = /* @__PURE__ */ ee();
57
- return w(() => (t.value, !!e()));
55
+ return h(() => (t.value, !!e()));
58
56
  }
59
57
  function ne(e, t, n = {}) {
60
- const { window: l = E, ...c } = n;
61
- let u;
62
- const s = /* @__PURE__ */ te(() => l && "MutationObserver" in l), o = () => {
63
- u && (u.disconnect(), u = void 0);
64
- }, i = T(w(() => {
65
- const f = S(C(e)).map($).filter(J);
58
+ const { window: o = E, ...r } = n;
59
+ let s;
60
+ const l = /* @__PURE__ */ te(() => o && "MutationObserver" in o), i = () => {
61
+ s && (s.disconnect(), s = void 0);
62
+ }, a = S(h(() => {
63
+ const f = b(C(e)).map($).filter(J);
66
64
  return new Set(f);
67
65
  }), (f) => {
68
- o(), s.value && f.size && (u = new MutationObserver(t), f.forEach((d) => u.observe(d, c)));
66
+ i(), l.value && f.size && (s = new MutationObserver(t), f.forEach((d) => s.observe(d, r)));
69
67
  }, {
70
68
  immediate: !0,
71
69
  flush: "post"
72
- }), r = () => u?.takeRecords(), a = () => {
73
- i(), o();
70
+ }), c = () => s?.takeRecords(), u = () => {
71
+ a(), i();
74
72
  };
75
- return k(a), {
76
- isSupported: s,
77
- stop: a,
78
- takeRecords: r
73
+ return _(u), {
74
+ isSupported: l,
75
+ stop: u,
76
+ takeRecords: c
79
77
  };
80
78
  }
81
79
  function oe(e, t, n = {}) {
82
- const { window: l = E, document: c = l?.document, flush: u = "sync" } = n;
83
- if (!l || !c) return Y;
84
- let s;
85
- const o = (a) => {
86
- s?.(), s = a;
87
- }, i = j(() => {
88
- const a = $(e);
89
- if (a) {
90
- const { stop: f } = ne(c, (d) => {
91
- d.map((p) => [...p.removedNodes]).flat().some((p) => p === a || p.contains(a)) && t(d);
80
+ const { window: o = E, document: r = o?.document, flush: s = "sync" } = n;
81
+ if (!o || !r) return Y;
82
+ let l;
83
+ const i = (u) => {
84
+ l?.(), l = u;
85
+ }, a = j(() => {
86
+ const u = $(e);
87
+ if (u) {
88
+ const { stop: f } = ne(r, (d) => {
89
+ d.map((p) => [...p.removedNodes]).flat().some((p) => p === u || p.contains(u)) && t(d);
92
90
  }, {
93
- window: l,
91
+ window: o,
94
92
  childList: !0,
95
93
  subtree: !0
96
94
  });
97
- o(f);
95
+ i(f);
98
96
  }
99
- }, { flush: u }), r = () => {
100
- i(), o();
97
+ }, { flush: s }), c = () => {
98
+ a(), i();
101
99
  };
102
- return k(r), r;
100
+ return _(c), c;
103
101
  }
104
102
  // @__NO_SIDE_EFFECTS__
105
103
  function le(e = {}) {
106
104
  var t;
107
- const { window: n = E, deep: l = !0, triggerOnRemoval: c = !1 } = e, u = (t = e.document) !== null && t !== void 0 ? t : n?.document, s = () => {
108
- let r = u?.activeElement;
109
- if (l)
110
- for (var a; r?.shadowRoot; ) r = r == null || (a = r.shadowRoot) === null || a === void 0 ? void 0 : a.activeElement;
111
- return r;
112
- }, o = M(), i = () => {
113
- o.value = s();
105
+ const { window: n = E, deep: o = !0, triggerOnRemoval: r = !1 } = e, s = (t = e.document) !== null && t !== void 0 ? t : n?.document, l = () => {
106
+ let c = s?.activeElement;
107
+ if (o)
108
+ for (var u; c?.shadowRoot; ) c = c == null || (u = c.shadowRoot) === null || u === void 0 ? void 0 : u.activeElement;
109
+ return c;
110
+ }, i = M(), a = () => {
111
+ i.value = l();
114
112
  };
115
113
  if (n) {
116
- const r = {
114
+ const c = {
117
115
  capture: !0,
118
116
  passive: !0
119
117
  };
120
- y(n, "blur", (a) => {
121
- a.relatedTarget === null && i();
122
- }, r), y(n, "focus", i, r);
118
+ w(n, "blur", (u) => {
119
+ u.relatedTarget === null && a();
120
+ }, c), w(n, "focus", a, c);
123
121
  }
124
- return c && oe(o, i, { document: u }), i(), o;
122
+ return r && oe(i, a, { document: s }), a(), i;
125
123
  }
126
124
  const re = "focusin", se = "focusout", ie = ":focus-within";
127
125
  function ce(e, t = {}) {
128
- const { window: n = E } = t, l = w(() => $(e)), c = M(!1), u = w(() => c.value);
129
- if (!n || !(/* @__PURE__ */ le(t)).value) return { focused: u };
130
- const o = { passive: !0 };
131
- return y(l, re, () => c.value = !0, o), y(l, se, () => {
132
- var i, r, a;
133
- return c.value = (i = (r = l.value) === null || r === void 0 || (a = r.matches) === null || a === void 0 ? void 0 : a.call(r, ie)) !== null && i !== void 0 ? i : !1;
134
- }, o), { focused: u };
126
+ const { window: n = E } = t, o = h(() => $(e)), r = M(!1), s = h(() => r.value);
127
+ if (!n || !(/* @__PURE__ */ le(t)).value) return { focused: s };
128
+ const i = { passive: !0 };
129
+ return w(o, re, () => r.value = !0, i), w(o, se, () => {
130
+ var a, c, u;
131
+ return r.value = (a = (c = o.value) === null || c === void 0 || (u = c.matches) === null || u === void 0 ? void 0 : u.call(c, ie)) !== null && a !== void 0 ? a : !1;
132
+ }, i), { focused: s };
135
133
  }
136
134
  function ae(e, { window: t = E, scrollTarget: n } = {}) {
137
- const l = K(!1), c = () => {
135
+ const o = F(!1), r = () => {
138
136
  if (!t) return;
139
- const u = t.document, s = $(e);
140
- if (!s)
141
- l.value = !1;
137
+ const s = t.document, l = $(e);
138
+ if (!l)
139
+ o.value = !1;
142
140
  else {
143
- const o = s.getBoundingClientRect();
144
- l.value = o.top <= (t.innerHeight || u.documentElement.clientHeight) && o.left <= (t.innerWidth || u.documentElement.clientWidth) && o.bottom >= 0 && o.right >= 0;
141
+ const i = l.getBoundingClientRect();
142
+ o.value = i.top <= (t.innerHeight || s.documentElement.clientHeight) && i.left <= (t.innerWidth || s.documentElement.clientWidth) && i.bottom >= 0 && i.right >= 0;
145
143
  }
146
144
  };
147
- return T(
145
+ return S(
148
146
  () => $(e),
149
- () => c(),
147
+ () => r(),
150
148
  { immediate: !0, flush: "post" }
151
- ), t && y(n || t, "scroll", c, {
149
+ ), t && w(n || t, "scroll", r, {
152
150
  capture: !1,
153
151
  passive: !0
154
- }), l;
152
+ }), o;
155
153
  }
156
154
  const m = (e) => {
157
155
  let t = ae(e).value;
158
156
  return t = t && e.offsetHeight > 0, t;
159
- }, g = (e) => e.tabIndex >= 0, P = (e) => {
157
+ }, g = (e) => e.tabIndex >= 0, D = (e) => {
160
158
  const t = e.target;
161
- return A(t);
162
- }, A = (e) => {
159
+ return k(t);
160
+ }, k = (e) => {
163
161
  let t;
164
162
  if (e instanceof HTMLTableCellElement) {
165
163
  const n = e.parentElement?.previousElementSibling;
166
164
  if (n) {
167
- const c = Array.from(n.children)[e.cellIndex];
168
- c && (t = c);
165
+ const r = Array.from(n.children)[e.cellIndex];
166
+ r && (t = r);
169
167
  }
170
168
  } else if (e instanceof HTMLTableRowElement) {
171
169
  const n = e.previousElementSibling;
172
170
  n && (t = n);
173
171
  }
174
- return t && (!g(t) || !m(t)) ? A(t) : t;
172
+ return t && (!g(t) || !m(t)) ? k(t) : t;
175
173
  }, ue = (e) => {
176
174
  const t = e.target;
177
175
  let n;
178
176
  if (t instanceof HTMLTableCellElement) {
179
- const l = t.parentElement?.parentElement;
180
- if (l) {
181
- const u = l.firstElementChild?.children[t.cellIndex];
182
- u && (n = u);
177
+ const o = t.parentElement?.parentElement;
178
+ if (o) {
179
+ const s = o.firstElementChild?.children[t.cellIndex];
180
+ s && (n = s);
183
181
  }
184
182
  } else if (t instanceof HTMLTableRowElement) {
185
- const l = t.parentElement;
186
- if (l) {
187
- const c = l.firstElementChild;
188
- c && (n = c);
183
+ const o = t.parentElement;
184
+ if (o) {
185
+ const r = o.firstElementChild;
186
+ r && (n = r);
189
187
  }
190
188
  }
191
- return n && (!g(n) || !m(n)) ? L(n) : n;
192
- }, O = (e) => {
189
+ return n && (!g(n) || !m(n)) ? A(n) : n;
190
+ }, P = (e) => {
193
191
  const t = e.target;
194
- return L(t);
195
- }, L = (e) => {
192
+ return A(t);
193
+ }, A = (e) => {
196
194
  let t;
197
195
  if (e instanceof HTMLTableCellElement) {
198
196
  const n = e.parentElement?.nextElementSibling;
199
197
  if (n) {
200
- const c = Array.from(n.children)[e.cellIndex];
201
- c && (t = c);
198
+ const r = Array.from(n.children)[e.cellIndex];
199
+ r && (t = r);
202
200
  }
203
201
  } else if (e instanceof HTMLTableRowElement) {
204
202
  const n = e.nextElementSibling;
205
203
  n && (t = n);
206
204
  }
207
- return t && (!g(t) || !m(t)) ? L(t) : t;
205
+ return t && (!g(t) || !m(t)) ? A(t) : t;
208
206
  }, fe = (e) => {
209
207
  const t = e.target;
210
208
  let n;
211
209
  if (t instanceof HTMLTableCellElement) {
212
- const l = t.parentElement?.parentElement;
213
- if (l) {
214
- const u = l.lastElementChild?.children[t.cellIndex];
215
- u && (n = u);
210
+ const o = t.parentElement?.parentElement;
211
+ if (o) {
212
+ const s = o.lastElementChild?.children[t.cellIndex];
213
+ s && (n = s);
216
214
  }
217
215
  } else if (t instanceof HTMLTableRowElement) {
218
- const l = t.parentElement;
219
- if (l) {
220
- const c = l.lastElementChild;
221
- c && (n = c);
216
+ const o = t.parentElement;
217
+ if (o) {
218
+ const r = o.lastElementChild;
219
+ r && (n = r);
222
220
  }
223
221
  }
224
- return n && (!g(n) || !m(n)) ? A(n) : n;
222
+ return n && (!g(n) || !m(n)) ? k(n) : n;
223
+ }, O = (e) => {
224
+ const t = e.target;
225
+ return L(t);
226
+ }, L = (e) => {
227
+ let t;
228
+ return e.previousElementSibling ? t = e.previousElementSibling : t = e.parentElement?.previousElementSibling?.lastElementChild, t && (!g(t) || !m(t)) ? L(t) : t;
225
229
  }, U = (e) => {
226
230
  const t = e.target;
227
231
  return x(t);
228
232
  }, x = (e) => {
229
233
  let t;
230
- return e.previousElementSibling ? t = e.previousElementSibling : t = e.parentElement?.previousElementSibling?.lastElementChild, t && (!g(t) || !m(t)) ? x(t) : t;
234
+ return e.nextElementSibling ? t = e.nextElementSibling : t = e.parentElement?.nextElementSibling?.firstElementChild, t && (!g(t) || !m(t)) ? x(t) : t;
231
235
  }, I = (e) => {
232
- const t = e.target;
233
- return H(t);
234
- }, H = (e) => {
235
- let t;
236
- return e.nextElementSibling ? t = e.nextElementSibling : t = e.parentElement?.nextElementSibling?.firstElementChild, t && (!g(t) || !m(t)) ? H(t) : t;
237
- }, W = (e) => {
238
- const l = e.target.parentElement?.firstElementChild;
239
- return l && (!g(l) || !m(l)) ? H(l) : l;
236
+ const o = e.target.parentElement?.firstElementChild;
237
+ return o && (!g(o) || !m(o)) ? x(o) : o;
240
238
  }, N = (e) => {
241
- const l = e.target.parentElement?.lastElementChild;
242
- return l && (!g(l) || !m(l)) ? x(l) : l;
243
- }, b = ["alt", "control", "shift", "meta"], de = {
239
+ const o = e.target.parentElement?.lastElementChild;
240
+ return o && (!g(o) || !m(o)) ? L(o) : o;
241
+ }, y = ["alt", "control", "shift", "meta"], de = {
244
242
  ArrowUp: "up",
245
243
  ArrowDown: "down",
246
244
  ArrowLeft: "left",
247
245
  ArrowRight: "right"
248
246
  }, pe = {
249
247
  "keydown.up": (e) => {
250
- const t = P(e);
248
+ const t = D(e);
251
249
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
252
250
  },
253
251
  "keydown.down": (e) => {
254
- const t = O(e);
252
+ const t = P(e);
255
253
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
256
254
  },
257
255
  "keydown.left": (e) => {
258
- const t = U(e);
256
+ const t = O(e);
259
257
  e.preventDefault(), e.stopPropagation(), t && t.focus();
260
258
  },
261
259
  "keydown.right": (e) => {
262
- const t = I(e);
260
+ const t = U(e);
263
261
  e.preventDefault(), e.stopPropagation(), t && t.focus();
264
262
  },
265
263
  "keydown.control.up": (e) => {
@@ -271,7 +269,7 @@ const m = (e) => {
271
269
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
272
270
  },
273
271
  "keydown.control.left": (e) => {
274
- const t = W(e);
272
+ const t = I(e);
275
273
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
276
274
  },
277
275
  "keydown.control.right": (e) => {
@@ -285,92 +283,92 @@ const m = (e) => {
285
283
  "keydown.enter": (e) => {
286
284
  if (e.target instanceof HTMLTableCellElement) {
287
285
  e.preventDefault(), e.stopPropagation();
288
- const n = O(e);
286
+ const n = P(e);
289
287
  n && n.focus();
290
288
  }
291
289
  },
292
290
  "keydown.shift.enter": (e) => {
293
291
  if (e.target instanceof HTMLTableCellElement) {
294
292
  e.preventDefault(), e.stopPropagation();
295
- const n = P(e);
293
+ const n = D(e);
296
294
  n && n.focus();
297
295
  }
298
296
  },
299
297
  "keydown.home": (e) => {
300
- const t = W(e);
298
+ const t = I(e);
301
299
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
302
300
  },
303
301
  "keydown.tab": (e) => {
304
- const t = I(e);
302
+ const t = U(e);
305
303
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
306
304
  },
307
305
  "keydown.shift.tab": (e) => {
308
- const t = U(e);
306
+ const t = O(e);
309
307
  t && (e.preventDefault(), e.stopPropagation(), t.focus());
310
308
  }
311
309
  };
312
310
  function ge(e) {
313
- const t = (s) => {
314
- let o = null;
315
- return s.parent && (typeof s.parent == "string" ? o = document.querySelector(s.parent) : s.parent instanceof HTMLElement ? o = s.parent : o = s.parent.value), o;
316
- }, n = (s) => {
317
- const o = t(s);
318
- let i = [];
319
- if (typeof s.selectors == "string")
320
- i = o ? Array.from(o.querySelectorAll(s.selectors)) : Array.from(document.querySelectorAll(s.selectors));
321
- else if (Array.isArray(s.selectors))
322
- for (const r of s.selectors)
323
- r instanceof HTMLElement ? i.push(r) : i.push(r.$el);
324
- else if (s.selectors instanceof HTMLElement)
325
- i.push(s.selectors);
326
- else if (s.selectors?.value)
327
- if (Array.isArray(s.selectors.value))
328
- for (const r of s.selectors.value)
329
- r instanceof HTMLElement ? i.push(r) : i.push(r.$el);
311
+ const t = (l) => {
312
+ let i = null;
313
+ return l.parent && (typeof l.parent == "string" ? i = document.querySelector(l.parent) : l.parent instanceof HTMLElement ? i = l.parent : i = l.parent.value), i;
314
+ }, n = (l) => {
315
+ const i = t(l);
316
+ let a = [];
317
+ if (typeof l.selectors == "string")
318
+ a = Array.from(i ? i.querySelectorAll(l.selectors) : document.querySelectorAll(l.selectors));
319
+ else if (Array.isArray(l.selectors))
320
+ for (const c of l.selectors)
321
+ c instanceof HTMLElement ? a.push(c) : a.push(c.$el);
322
+ else if (l.selectors instanceof HTMLElement)
323
+ a.push(l.selectors);
324
+ else if (l.selectors?.value)
325
+ if (Array.isArray(l.selectors.value))
326
+ for (const c of l.selectors.value)
327
+ c instanceof HTMLElement ? a.push(c) : a.push(c.$el);
330
328
  else
331
- i.push(s.selectors.value);
332
- return i;
333
- }, l = (s) => {
334
- const o = t(s);
335
- let i = [];
336
- return s.selectors ? i = n(s) : o && (i = Array.from(o.children).filter((a) => g(a) && m(a))), i;
337
- }, c = (s) => (o) => {
338
- const i = de[o.key] || o.key.toLowerCase();
339
- if (b.includes(i)) return;
340
- const r = s.handlers || pe;
341
- for (const a of Object.keys(r)) {
342
- const [f, ...d] = a.split(".");
343
- if (f === "keydown" && d.includes(i)) {
344
- const p = r[a], h = d.filter((v) => b.includes(v)), D = b.some((v) => {
329
+ a.push(l.selectors.value);
330
+ return a;
331
+ }, o = (l) => {
332
+ const i = t(l);
333
+ let a = [];
334
+ return l.selectors ? a = n(l) : i && (a = Array.from(i.children).filter((u) => g(u) && m(u))), a;
335
+ }, r = (l) => (i) => {
336
+ const a = de[i.key] || i.key.toLowerCase();
337
+ if (y.includes(a)) return;
338
+ const c = l.handlers || pe;
339
+ for (const u of Object.keys(c)) {
340
+ const [f, ...d] = u.split(".");
341
+ if (f === "keydown" && d.includes(a)) {
342
+ const p = c[u], T = d.filter((v) => y.includes(v)), H = y.some((v) => {
345
343
  const R = v.charAt(0).toUpperCase() + v.slice(1);
346
- return o.getModifierState(R);
344
+ return i.getModifierState(R);
347
345
  });
348
- if (h.length > 0) {
349
- if (D) {
350
- for (const v of b)
346
+ if (T.length > 0) {
347
+ if (H) {
348
+ for (const v of y)
351
349
  if (d.includes(v)) {
352
350
  const R = v.charAt(0).toUpperCase() + v.slice(1);
353
- o.getModifierState(R) && p(o);
351
+ i.getModifierState(R) && p(i);
354
352
  }
355
353
  }
356
354
  } else
357
- D || p(o);
355
+ H || p(i);
358
356
  }
359
357
  }
360
- }, u = [];
361
- F(() => {
362
- for (const s of e) {
363
- const o = t(s), i = l(s), r = c(s), a = o ? [o] : i;
364
- for (const f of a) {
365
- const { focused: d } = ce(K(f)), p = T(d, (h) => {
366
- h ? f.addEventListener("keydown", r) : f.removeEventListener("keydown", r);
358
+ }, s = [];
359
+ W(() => {
360
+ for (const l of e) {
361
+ const i = t(l), a = o(l), c = r(l), u = i ? [i] : a;
362
+ for (const f of u) {
363
+ const { focused: d } = ce(F(f)), p = S(d, (T) => {
364
+ T ? f.addEventListener("keydown", c) : f.removeEventListener("keydown", c);
367
365
  });
368
- u.push(p);
366
+ s.push(p);
369
367
  }
370
368
  }
371
369
  }), G(() => {
372
- for (const s of u)
373
- s();
370
+ for (const l of s)
371
+ l();
374
372
  });
375
373
  }
376
374
  function ve(e) {