@tvuikit/navigation-react 0.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/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +607 -0
- package/dist/index.js.map +1 -0
- package/dist/react/CustomFocusable.d.ts +87 -0
- package/dist/react/CustomFocusable.d.ts.map +1 -0
- package/dist/react/DebugPanel.d.ts +42 -0
- package/dist/react/DebugPanel.d.ts.map +1 -0
- package/dist/react/FocusGroup.d.ts +51 -0
- package/dist/react/FocusGroup.d.ts.map +1 -0
- package/dist/react/Focusable.d.ts +39 -0
- package/dist/react/Focusable.d.ts.map +1 -0
- package/dist/react/NavigationProvider.d.ts +166 -0
- package/dist/react/NavigationProvider.d.ts.map +1 -0
- package/dist/react/focusGroupContext.d.ts +5 -0
- package/dist/react/focusGroupContext.d.ts.map +1 -0
- package/dist/react/useCustomFocusable.d.ts +76 -0
- package/dist/react/useCustomFocusable.d.ts.map +1 -0
- package/dist/react/useFocusEvents.d.ts +39 -0
- package/dist/react/useFocusEvents.d.ts.map +1 -0
- package/dist/react/useFocusable.d.ts +44 -0
- package/dist/react/useFocusable.d.ts.map +1 -0
- package/package.json +61 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./react/NavigationProvider.js";
|
|
2
|
+
export * from "./react/useFocusable.js";
|
|
3
|
+
export * from "./react/useCustomFocusable.js";
|
|
4
|
+
export * from "./react/useFocusEvents.js";
|
|
5
|
+
export * from "./react/FocusGroup.js";
|
|
6
|
+
export * from "./react/Focusable.js";
|
|
7
|
+
export * from "./react/CustomFocusable.js";
|
|
8
|
+
export * from "./react/DebugPanel.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { jsx as x, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import ne, { createContext as oe, useRef as W, useMemo as G, useEffect as C, useContext as F, useSyncExternalStore as re, memo as ce, useState as M } from "react";
|
|
3
|
+
import { createDomRegistry as le } from "@tvuikit/navigation-dom";
|
|
4
|
+
const H = {
|
|
5
|
+
up: "ArrowUp",
|
|
6
|
+
down: "ArrowDown",
|
|
7
|
+
left: "ArrowLeft",
|
|
8
|
+
right: "ArrowRight"
|
|
9
|
+
}, Q = {
|
|
10
|
+
select: ["Enter", " "],
|
|
11
|
+
back: ["Escape", "Backspace"]
|
|
12
|
+
}, P = oe(null);
|
|
13
|
+
function Ne({
|
|
14
|
+
children: n,
|
|
15
|
+
store: e,
|
|
16
|
+
domSource: t = "dom",
|
|
17
|
+
captureKeyboard: y = !0,
|
|
18
|
+
autoSync: r = !0,
|
|
19
|
+
initialFocus: g,
|
|
20
|
+
keyMap: s,
|
|
21
|
+
actionKeys: u
|
|
22
|
+
}) {
|
|
23
|
+
const v = W({
|
|
24
|
+
store: e,
|
|
25
|
+
domSource: t
|
|
26
|
+
}), c = G(() => {
|
|
27
|
+
const {
|
|
28
|
+
store: o,
|
|
29
|
+
domSource: i
|
|
30
|
+
} = v.current, l = o.getExistingSource(i);
|
|
31
|
+
if (l) {
|
|
32
|
+
if (typeof l.getElement == "function")
|
|
33
|
+
return l;
|
|
34
|
+
console.warn(`NavigationProvider: source "${i}" exists but is not a DomRegistry. Creating new DomRegistry.`);
|
|
35
|
+
}
|
|
36
|
+
const h = le();
|
|
37
|
+
return o.addSource(i, h), h;
|
|
38
|
+
}, []), p = G(() => ({
|
|
39
|
+
store: v.current.store,
|
|
40
|
+
domSource: v.current.domSource,
|
|
41
|
+
domRegistry: c
|
|
42
|
+
}), [c]);
|
|
43
|
+
C(() => {
|
|
44
|
+
if (!r) return;
|
|
45
|
+
let o = 0;
|
|
46
|
+
const i = () => {
|
|
47
|
+
e.sync(), o = requestAnimationFrame(i);
|
|
48
|
+
};
|
|
49
|
+
return o = requestAnimationFrame(i), () => cancelAnimationFrame(o);
|
|
50
|
+
}, [r, e]);
|
|
51
|
+
const a = G(() => s ? {
|
|
52
|
+
up: s.up ?? H.up,
|
|
53
|
+
down: s.down ?? H.down,
|
|
54
|
+
left: s.left ?? H.left,
|
|
55
|
+
right: s.right ?? H.right
|
|
56
|
+
} : H, [s]), d = G(() => u === !1 ? null : u ? {
|
|
57
|
+
...Q,
|
|
58
|
+
...u
|
|
59
|
+
} : Q, [u]);
|
|
60
|
+
return C(() => {
|
|
61
|
+
if (!y) return;
|
|
62
|
+
const o = /* @__PURE__ */ new Map(), i = (m, f) => {
|
|
63
|
+
if (typeof m == "string")
|
|
64
|
+
o.set(m, f);
|
|
65
|
+
else
|
|
66
|
+
for (const b of m) o.set(b, f);
|
|
67
|
+
};
|
|
68
|
+
i(a.up, "up"), i(a.down, "down"), i(a.left, "left"), i(a.right, "right");
|
|
69
|
+
const l = /* @__PURE__ */ new Map();
|
|
70
|
+
if (d)
|
|
71
|
+
for (const [m, f] of Object.entries(d))
|
|
72
|
+
if (typeof f == "string")
|
|
73
|
+
l.set(f, m);
|
|
74
|
+
else
|
|
75
|
+
for (const b of f) l.set(b, m);
|
|
76
|
+
const h = (m) => {
|
|
77
|
+
const f = o.get(m.key);
|
|
78
|
+
if (f) {
|
|
79
|
+
m.preventDefault(), e.move(f, {
|
|
80
|
+
sync: !0
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const b = l.get(m.key);
|
|
85
|
+
if (b) {
|
|
86
|
+
m.preventDefault();
|
|
87
|
+
const R = e.focused, S = R ? e.registry.bounds(R) : null;
|
|
88
|
+
e.engine.dispatchEvent(new CustomEvent("action", {
|
|
89
|
+
detail: {
|
|
90
|
+
action: b,
|
|
91
|
+
nodeId: R,
|
|
92
|
+
bounds: S,
|
|
93
|
+
key: m.key
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
99
|
+
}, [y, e, a, d]), C(() => {
|
|
100
|
+
const o = setTimeout(() => {
|
|
101
|
+
if (g) {
|
|
102
|
+
const l = g.includes(":") ? g : `${t}:${g}`;
|
|
103
|
+
e.focus(l);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
e.sync();
|
|
107
|
+
const i = e.registry.ids();
|
|
108
|
+
for (let l = 0; l < i.length; l++) {
|
|
109
|
+
const h = i[l], m = e.registry.enabled?.(h) ?? !0, f = e.registry.visible?.(h) ?? !0;
|
|
110
|
+
if (m && f) {
|
|
111
|
+
e.focus(h);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, 0);
|
|
116
|
+
return () => clearTimeout(o);
|
|
117
|
+
}, [e, g, t]), /* @__PURE__ */ x(P.Provider, { value: p, children: n });
|
|
118
|
+
}
|
|
119
|
+
function Fe() {
|
|
120
|
+
const n = F(P);
|
|
121
|
+
if (!n)
|
|
122
|
+
throw new Error("useNavigationStore must be used within a <NavigationProvider>");
|
|
123
|
+
return n.store;
|
|
124
|
+
}
|
|
125
|
+
function Oe() {
|
|
126
|
+
return F(P);
|
|
127
|
+
}
|
|
128
|
+
var U = { exports: {} }, Z = {};
|
|
129
|
+
/**
|
|
130
|
+
* @license React
|
|
131
|
+
* react-compiler-runtime.production.js
|
|
132
|
+
*
|
|
133
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the MIT license found in the
|
|
136
|
+
* LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/
|
|
138
|
+
var X;
|
|
139
|
+
function ue() {
|
|
140
|
+
if (X) return Z;
|
|
141
|
+
X = 1;
|
|
142
|
+
var n = ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
143
|
+
return Z.c = function(e) {
|
|
144
|
+
return n.H.useMemoCache(e);
|
|
145
|
+
}, Z;
|
|
146
|
+
}
|
|
147
|
+
var J = {};
|
|
148
|
+
/**
|
|
149
|
+
* @license React
|
|
150
|
+
* react-compiler-runtime.development.js
|
|
151
|
+
*
|
|
152
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the MIT license found in the
|
|
155
|
+
* LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/
|
|
157
|
+
var ee;
|
|
158
|
+
function de() {
|
|
159
|
+
return ee || (ee = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
160
|
+
var n = ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
161
|
+
J.c = function(e) {
|
|
162
|
+
var t = n.H;
|
|
163
|
+
return t === null && console.error(
|
|
164
|
+
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
165
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
166
|
+
2. You might be breaking the Rules of Hooks
|
|
167
|
+
3. You might have more than one copy of React in the same app
|
|
168
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
|
|
169
|
+
), t.useMemoCache(e);
|
|
170
|
+
};
|
|
171
|
+
})()), J;
|
|
172
|
+
}
|
|
173
|
+
var te;
|
|
174
|
+
function ae() {
|
|
175
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? U.exports = ue() : U.exports = de()), U.exports;
|
|
176
|
+
}
|
|
177
|
+
var L = ae();
|
|
178
|
+
const Y = oe(null);
|
|
179
|
+
function fe(n) {
|
|
180
|
+
const e = L.c(16), t = F(P);
|
|
181
|
+
if (!t)
|
|
182
|
+
throw new Error("useFocusable must be used within <NavigationProvider>");
|
|
183
|
+
const y = F(Y), {
|
|
184
|
+
store: r,
|
|
185
|
+
domSource: g,
|
|
186
|
+
domRegistry: s
|
|
187
|
+
} = t, u = n.id, v = n.groupId !== void 0 ? n.groupId : y?.groupId, c = n.disabled, p = n.onFocus, a = n.onBlur, d = `${g}:${u}`, o = W(null);
|
|
188
|
+
let i;
|
|
189
|
+
e[0] !== d || e[1] !== r ? (i = (_) => {
|
|
190
|
+
const E = r.subscribe(() => {
|
|
191
|
+
const I = r.isFocused(d);
|
|
192
|
+
o.current !== I && (o.current = I, _());
|
|
193
|
+
});
|
|
194
|
+
return o.current = r.isFocused(d), E;
|
|
195
|
+
}, e[0] = d, e[1] = r, e[2] = i) : i = e[2];
|
|
196
|
+
const l = i;
|
|
197
|
+
let h;
|
|
198
|
+
e[3] !== d || e[4] !== r ? (h = () => r.isFocused(d), e[3] = d, e[4] = r, e[5] = h) : h = e[5];
|
|
199
|
+
const b = re(l, h, ve);
|
|
200
|
+
let R;
|
|
201
|
+
e[6] !== c || e[7] !== s || e[8] !== v || e[9] !== u || e[10] !== a || e[11] !== p ? (R = (_) => {
|
|
202
|
+
if (!_) {
|
|
203
|
+
s.unregister(u);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const E = {};
|
|
207
|
+
v !== void 0 && (E.groupId = v), c !== void 0 && (E.enabled = !c), p && (E.onFocus = p), a && (E.onBlur = a), s.register(u, _, Object.keys(E).length > 0 ? E : void 0);
|
|
208
|
+
}, e[6] = c, e[7] = s, e[8] = v, e[9] = u, e[10] = a, e[11] = p, e[12] = R) : R = e[12];
|
|
209
|
+
const S = R;
|
|
210
|
+
let w;
|
|
211
|
+
return e[13] !== b || e[14] !== S ? (w = {
|
|
212
|
+
ref: S,
|
|
213
|
+
focused: b
|
|
214
|
+
}, e[13] = b, e[14] = S, e[15] = w) : w = e[15], w;
|
|
215
|
+
}
|
|
216
|
+
function ve() {
|
|
217
|
+
return !1;
|
|
218
|
+
}
|
|
219
|
+
function me(n) {
|
|
220
|
+
const e = L.c(20), {
|
|
221
|
+
store: t,
|
|
222
|
+
source: y,
|
|
223
|
+
id: r,
|
|
224
|
+
rect: g,
|
|
225
|
+
groupId: s,
|
|
226
|
+
disabled: u,
|
|
227
|
+
onFocus: v,
|
|
228
|
+
onBlur: c
|
|
229
|
+
} = n, p = y === void 0 ? "custom" : y, a = F(Y), d = s !== void 0 ? s : a?.groupId ?? null, o = `${p}:${r}`;
|
|
230
|
+
let i;
|
|
231
|
+
e[0] !== p || e[1] !== t ? (i = t.getSource(p), e[0] = p, e[1] = t, e[2] = i) : i = e[2];
|
|
232
|
+
const l = i;
|
|
233
|
+
let h, m;
|
|
234
|
+
e[3] !== u || e[4] !== d || e[5] !== r || e[6] !== c || e[7] !== v || e[8] !== g || e[9] !== l ? (h = () => (l.register({
|
|
235
|
+
id: r,
|
|
236
|
+
rect: g,
|
|
237
|
+
groupId: d,
|
|
238
|
+
...u !== void 0 && {
|
|
239
|
+
enabled: !u
|
|
240
|
+
},
|
|
241
|
+
...v && {
|
|
242
|
+
onFocus: v
|
|
243
|
+
},
|
|
244
|
+
...c && {
|
|
245
|
+
onBlur: c
|
|
246
|
+
}
|
|
247
|
+
}), () => {
|
|
248
|
+
l.unregister(r);
|
|
249
|
+
}), m = [l, r, g, d, u, v, c], e[3] = u, e[4] = d, e[5] = r, e[6] = c, e[7] = v, e[8] = g, e[9] = l, e[10] = h, e[11] = m) : (h = e[10], m = e[11]), C(h, m);
|
|
250
|
+
const f = W(null);
|
|
251
|
+
let b;
|
|
252
|
+
e[12] !== o || e[13] !== t ? (b = (j) => {
|
|
253
|
+
const N = t.subscribe(() => {
|
|
254
|
+
const $ = t.isFocused(o);
|
|
255
|
+
f.current !== $ && (f.current = $, j());
|
|
256
|
+
});
|
|
257
|
+
return f.current = t.isFocused(o), N;
|
|
258
|
+
}, e[12] = o, e[13] = t, e[14] = b) : b = e[14];
|
|
259
|
+
const R = b;
|
|
260
|
+
let S;
|
|
261
|
+
e[15] !== o || e[16] !== t ? (S = () => t.isFocused(o), e[15] = o, e[16] = t, e[17] = S) : S = e[17];
|
|
262
|
+
const E = re(R, S, ge);
|
|
263
|
+
let I;
|
|
264
|
+
return e[18] !== E ? (I = {
|
|
265
|
+
focused: E
|
|
266
|
+
}, e[18] = E, e[19] = I) : I = e[19], I;
|
|
267
|
+
}
|
|
268
|
+
function ge() {
|
|
269
|
+
return !1;
|
|
270
|
+
}
|
|
271
|
+
function he(n, e, t) {
|
|
272
|
+
const y = F(P), r = typeof n == "object", g = r ? n : {
|
|
273
|
+
[n]: e
|
|
274
|
+
}, u = (r ? e : t)?.store ?? y?.store, v = W(g);
|
|
275
|
+
v.current = g;
|
|
276
|
+
const c = Object.keys(g).sort().join(",");
|
|
277
|
+
C(() => {
|
|
278
|
+
if (!u) {
|
|
279
|
+
console.warn("useFocusEvents: No store available. Use within NavigationProvider or pass store option.");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const p = [];
|
|
283
|
+
for (const a of Object.keys(v.current)) {
|
|
284
|
+
const d = (o) => {
|
|
285
|
+
const i = v.current[a];
|
|
286
|
+
if (i) {
|
|
287
|
+
const l = o.detail;
|
|
288
|
+
i(l);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
u.addEventListener(a, d), p.push(() => u.removeEventListener(a, d));
|
|
292
|
+
}
|
|
293
|
+
return () => {
|
|
294
|
+
for (const a of p)
|
|
295
|
+
a();
|
|
296
|
+
};
|
|
297
|
+
}, [u, c]);
|
|
298
|
+
}
|
|
299
|
+
function De(n) {
|
|
300
|
+
const e = L.c(26), t = F(Y), y = F(P), r = n.store ?? y?.store;
|
|
301
|
+
let g;
|
|
302
|
+
e: {
|
|
303
|
+
if (n.nested === !1 || !t) {
|
|
304
|
+
g = n.id;
|
|
305
|
+
break e;
|
|
306
|
+
}
|
|
307
|
+
g = `${t.groupId}/${n.id}`;
|
|
308
|
+
}
|
|
309
|
+
const s = g;
|
|
310
|
+
let u, v;
|
|
311
|
+
e[0] !== s || e[1] !== n.restoreHistoryOnEnter || e[2] !== r ? (u = () => {
|
|
312
|
+
if (!r)
|
|
313
|
+
return;
|
|
314
|
+
const f = n.restoreHistoryOnEnter ?? !0;
|
|
315
|
+
return r.setGroupRestoreOnEnter(s, f), () => r.clearGroupRestoreOnEnter(s);
|
|
316
|
+
}, v = [r, s, n.restoreHistoryOnEnter], e[0] = s, e[1] = n.restoreHistoryOnEnter, e[2] = r, e[3] = u, e[4] = v) : (u = e[3], v = e[4]), C(u, v);
|
|
317
|
+
let c, p;
|
|
318
|
+
e[5] !== s || e[6] !== n.boundary || e[7] !== n.trap || e[8] !== r ? (c = () => {
|
|
319
|
+
if (!r)
|
|
320
|
+
return;
|
|
321
|
+
let f = null;
|
|
322
|
+
if (n.trap ? f = {
|
|
323
|
+
left: !0,
|
|
324
|
+
right: !0,
|
|
325
|
+
up: !0,
|
|
326
|
+
down: !0
|
|
327
|
+
} : n.boundary && (f = n.boundary), f)
|
|
328
|
+
return r.setGroupBoundary(s, f), () => r.clearGroupBoundary(s);
|
|
329
|
+
}, p = [r, s, n.trap, n.boundary], e[5] = s, e[6] = n.boundary, e[7] = n.trap, e[8] = r, e[9] = c, e[10] = p) : (c = e[9], p = e[10]), C(c, p);
|
|
330
|
+
let a, d;
|
|
331
|
+
e[11] !== s || e[12] !== n.resetHistoryOnMount || e[13] !== r ? (a = () => {
|
|
332
|
+
r && n.resetHistoryOnMount && r.clearGroupHistory(s);
|
|
333
|
+
}, d = [r, s, n.resetHistoryOnMount], e[11] = s, e[12] = n.resetHistoryOnMount, e[13] = r, e[14] = a, e[15] = d) : (a = e[14], d = e[15]), C(a, d);
|
|
334
|
+
let o, i;
|
|
335
|
+
e[16] !== s || e[17] !== n.focusOnMountId || e[18] !== r ? (o = () => {
|
|
336
|
+
if (!r)
|
|
337
|
+
return;
|
|
338
|
+
const f = n.focusOnMountId;
|
|
339
|
+
f && r.focusGroup(s, {
|
|
340
|
+
id: f
|
|
341
|
+
});
|
|
342
|
+
}, i = [r, s, n.focusOnMountId], e[16] = s, e[17] = n.focusOnMountId, e[18] = r, e[19] = o, e[20] = i) : (o = e[19], i = e[20]), C(o, i);
|
|
343
|
+
let l;
|
|
344
|
+
e[21] !== s ? (l = {
|
|
345
|
+
groupId: s
|
|
346
|
+
}, e[21] = s, e[22] = l) : l = e[22];
|
|
347
|
+
const h = l;
|
|
348
|
+
let m;
|
|
349
|
+
return e[23] !== n.children || e[24] !== h ? (m = /* @__PURE__ */ x(Y.Provider, { value: h, children: n.children }), e[23] = n.children, e[24] = h, e[25] = m) : m = e[25], m;
|
|
350
|
+
}
|
|
351
|
+
function ke(n) {
|
|
352
|
+
const e = L.c(35);
|
|
353
|
+
let t, y, r, g, s, u, v, c, p, a, d;
|
|
354
|
+
e[0] !== n ? ({
|
|
355
|
+
id: v,
|
|
356
|
+
as: t,
|
|
357
|
+
focusedClassName: s,
|
|
358
|
+
focusedStyle: u,
|
|
359
|
+
onFocus: p,
|
|
360
|
+
onBlur: c,
|
|
361
|
+
disabled: g,
|
|
362
|
+
children: y,
|
|
363
|
+
className: r,
|
|
364
|
+
style: d,
|
|
365
|
+
...a
|
|
366
|
+
} = n, e[0] = n, e[1] = t, e[2] = y, e[3] = r, e[4] = g, e[5] = s, e[6] = u, e[7] = v, e[8] = c, e[9] = p, e[10] = a, e[11] = d) : (t = e[1], y = e[2], r = e[3], g = e[4], s = e[5], u = e[6], v = e[7], c = e[8], p = e[9], a = e[10], d = e[11]);
|
|
367
|
+
let o;
|
|
368
|
+
e[12] !== g ? (o = g !== void 0 && {
|
|
369
|
+
disabled: g
|
|
370
|
+
}, e[12] = g, e[13] = o) : o = e[13];
|
|
371
|
+
let i;
|
|
372
|
+
e[14] !== p ? (i = p && {
|
|
373
|
+
onFocus: p
|
|
374
|
+
}, e[14] = p, e[15] = i) : i = e[15];
|
|
375
|
+
let l;
|
|
376
|
+
e[16] !== c ? (l = c && {
|
|
377
|
+
onBlur: c
|
|
378
|
+
}, e[16] = c, e[17] = l) : l = e[17];
|
|
379
|
+
let h;
|
|
380
|
+
e[18] !== v || e[19] !== o || e[20] !== i || e[21] !== l ? (h = {
|
|
381
|
+
id: v,
|
|
382
|
+
...o,
|
|
383
|
+
...i,
|
|
384
|
+
...l
|
|
385
|
+
}, e[18] = v, e[19] = o, e[20] = i, e[21] = l, e[22] = h) : h = e[22];
|
|
386
|
+
const {
|
|
387
|
+
ref: m,
|
|
388
|
+
focused: f
|
|
389
|
+
} = fe(h), b = t || "div", R = f && s ? r ? `${r} ${s}` : s : r;
|
|
390
|
+
let S;
|
|
391
|
+
e[23] !== f || e[24] !== u || e[25] !== d ? (S = f && u ? d ? {
|
|
392
|
+
...d,
|
|
393
|
+
...u
|
|
394
|
+
} : u : d, e[23] = f, e[24] = u, e[25] = d, e[26] = S) : S = e[26];
|
|
395
|
+
const w = S, _ = f || void 0;
|
|
396
|
+
let E;
|
|
397
|
+
return e[27] !== b || e[28] !== y || e[29] !== R || e[30] !== w || e[31] !== m || e[32] !== a || e[33] !== _ ? (E = /* @__PURE__ */ x(b, { ref: m, className: R, style: w, "data-tvkit-focused": _, ...a, children: y }), e[27] = b, e[28] = y, e[29] = R, e[30] = w, e[31] = m, e[32] = a, e[33] = _, e[34] = E) : E = e[34], E;
|
|
398
|
+
}
|
|
399
|
+
function $e(n) {
|
|
400
|
+
const e = L.c(22), {
|
|
401
|
+
store: t,
|
|
402
|
+
source: y,
|
|
403
|
+
id: r,
|
|
404
|
+
rect: g,
|
|
405
|
+
groupId: s,
|
|
406
|
+
disabled: u,
|
|
407
|
+
onFocus: v,
|
|
408
|
+
onBlur: c,
|
|
409
|
+
children: p
|
|
410
|
+
} = n;
|
|
411
|
+
let a;
|
|
412
|
+
e[0] !== y ? (a = y && {
|
|
413
|
+
source: y
|
|
414
|
+
}, e[0] = y, e[1] = a) : a = e[1];
|
|
415
|
+
let d;
|
|
416
|
+
e[2] !== s ? (d = s !== void 0 && {
|
|
417
|
+
groupId: s
|
|
418
|
+
}, e[2] = s, e[3] = d) : d = e[3];
|
|
419
|
+
let o;
|
|
420
|
+
e[4] !== u ? (o = u !== void 0 && {
|
|
421
|
+
disabled: u
|
|
422
|
+
}, e[4] = u, e[5] = o) : o = e[5];
|
|
423
|
+
let i;
|
|
424
|
+
e[6] !== v ? (i = v && {
|
|
425
|
+
onFocus: v
|
|
426
|
+
}, e[6] = v, e[7] = i) : i = e[7];
|
|
427
|
+
let l;
|
|
428
|
+
e[8] !== c ? (l = c && {
|
|
429
|
+
onBlur: c
|
|
430
|
+
}, e[8] = c, e[9] = l) : l = e[9];
|
|
431
|
+
let h;
|
|
432
|
+
e[10] !== r || e[11] !== g || e[12] !== t || e[13] !== a || e[14] !== d || e[15] !== o || e[16] !== i || e[17] !== l ? (h = {
|
|
433
|
+
store: t,
|
|
434
|
+
id: r,
|
|
435
|
+
rect: g,
|
|
436
|
+
...a,
|
|
437
|
+
...d,
|
|
438
|
+
...o,
|
|
439
|
+
...i,
|
|
440
|
+
...l
|
|
441
|
+
}, e[10] = r, e[11] = g, e[12] = t, e[13] = a, e[14] = d, e[15] = o, e[16] = i, e[17] = l, e[18] = h) : h = e[18];
|
|
442
|
+
const {
|
|
443
|
+
focused: m
|
|
444
|
+
} = me(h);
|
|
445
|
+
let f;
|
|
446
|
+
return e[19] !== p || e[20] !== m ? (f = p(m), e[19] = p, e[20] = m, e[21] = f) : f = e[21], f;
|
|
447
|
+
}
|
|
448
|
+
const V = 40, pe = {
|
|
449
|
+
position: "fixed",
|
|
450
|
+
background: "rgba(18, 18, 26, 0.95)",
|
|
451
|
+
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
452
|
+
borderRadius: "12px",
|
|
453
|
+
fontSize: "0.8rem",
|
|
454
|
+
backdropFilter: "blur(12px)",
|
|
455
|
+
zIndex: 1e3,
|
|
456
|
+
fontFamily: "system-ui, sans-serif",
|
|
457
|
+
color: "#ffffff",
|
|
458
|
+
transition: "all 0.2s ease"
|
|
459
|
+
}, ye = {
|
|
460
|
+
width: V,
|
|
461
|
+
height: V,
|
|
462
|
+
padding: 0,
|
|
463
|
+
cursor: "pointer"
|
|
464
|
+
}, be = {
|
|
465
|
+
minWidth: "200px",
|
|
466
|
+
padding: "1rem",
|
|
467
|
+
paddingTop: "2.5rem"
|
|
468
|
+
}, se = {
|
|
469
|
+
position: "absolute",
|
|
470
|
+
top: 0,
|
|
471
|
+
left: 0,
|
|
472
|
+
width: V,
|
|
473
|
+
height: V,
|
|
474
|
+
border: "none",
|
|
475
|
+
background: "transparent",
|
|
476
|
+
color: "#00d4aa",
|
|
477
|
+
fontSize: "1.25rem",
|
|
478
|
+
fontWeight: 600,
|
|
479
|
+
cursor: "pointer",
|
|
480
|
+
display: "flex",
|
|
481
|
+
alignItems: "center",
|
|
482
|
+
justifyContent: "center",
|
|
483
|
+
transition: "color 0.2s ease"
|
|
484
|
+
}, Se = {
|
|
485
|
+
...se,
|
|
486
|
+
position: "relative"
|
|
487
|
+
}, Ee = {
|
|
488
|
+
fontSize: "0.75rem",
|
|
489
|
+
fontWeight: 600,
|
|
490
|
+
textTransform: "uppercase",
|
|
491
|
+
letterSpacing: "0.05em",
|
|
492
|
+
color: "#00d4aa",
|
|
493
|
+
marginBottom: "0.75rem",
|
|
494
|
+
margin: 0
|
|
495
|
+
}, Re = {
|
|
496
|
+
display: "flex",
|
|
497
|
+
flexDirection: "column",
|
|
498
|
+
gap: "0.5rem"
|
|
499
|
+
}, q = {
|
|
500
|
+
display: "flex",
|
|
501
|
+
justifyContent: "space-between",
|
|
502
|
+
color: "#9ca3af"
|
|
503
|
+
}, z = {
|
|
504
|
+
color: "#ffffff",
|
|
505
|
+
fontFamily: "monospace"
|
|
506
|
+
}, _e = {
|
|
507
|
+
animation: "debugPanelFadeIn 0.2s ease"
|
|
508
|
+
};
|
|
509
|
+
function xe(n, e) {
|
|
510
|
+
const t = typeof e == "number" ? `${e}px` : e, y = {};
|
|
511
|
+
return n.vertical === "top" ? y.top = t : y.bottom = t, n.horizontal === "left" ? y.left = t : y.right = t, y;
|
|
512
|
+
}
|
|
513
|
+
const Ae = ce(function(e) {
|
|
514
|
+
const t = L.c(22), {
|
|
515
|
+
className: y,
|
|
516
|
+
style: r,
|
|
517
|
+
useDefaultStyles: g,
|
|
518
|
+
position: s,
|
|
519
|
+
padding: u,
|
|
520
|
+
defaultExpanded: v
|
|
521
|
+
} = e, c = g === void 0 ? !0 : g, p = s === void 0 ? {} : s, a = u === void 0 ? "1rem" : u, d = v === void 0 ? !1 : v, [o, i] = M(d), [l, h] = M(null), [m, f] = M("-"), [b, R] = M("-"), [S, w] = M("-");
|
|
522
|
+
let _;
|
|
523
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
|
|
524
|
+
focus: (O) => {
|
|
525
|
+
const {
|
|
526
|
+
nodeId: D
|
|
527
|
+
} = O;
|
|
528
|
+
return h(D);
|
|
529
|
+
},
|
|
530
|
+
blur: (O) => {
|
|
531
|
+
const {
|
|
532
|
+
nodeId: D
|
|
533
|
+
} = O;
|
|
534
|
+
return f(D);
|
|
535
|
+
},
|
|
536
|
+
move: (O) => {
|
|
537
|
+
const {
|
|
538
|
+
direction: D
|
|
539
|
+
} = O;
|
|
540
|
+
return R(D);
|
|
541
|
+
},
|
|
542
|
+
reject: (O) => {
|
|
543
|
+
const {
|
|
544
|
+
direction: D,
|
|
545
|
+
reason: ie
|
|
546
|
+
} = O;
|
|
547
|
+
return w(`${D} (${ie})`);
|
|
548
|
+
}
|
|
549
|
+
}, t[0] = _) : _ = t[0], he(_);
|
|
550
|
+
const E = {
|
|
551
|
+
vertical: p.vertical ?? "bottom",
|
|
552
|
+
horizontal: p.horizontal ?? "right"
|
|
553
|
+
}, I = c ? {
|
|
554
|
+
...pe,
|
|
555
|
+
...xe(E, a),
|
|
556
|
+
...o ? be : ye,
|
|
557
|
+
...r
|
|
558
|
+
} : r, j = c ? o ? se : Se : void 0;
|
|
559
|
+
let N;
|
|
560
|
+
t[1] !== o || t[2] !== i ? (N = () => i(!o), t[1] = o, t[2] = i, t[3] = N) : N = t[3];
|
|
561
|
+
const $ = o ? "Collapse debug panel" : "Expand debug panel", K = o ? "×" : "D";
|
|
562
|
+
let A;
|
|
563
|
+
t[4] !== o || t[5] !== j || t[6] !== N || t[7] !== $ || t[8] !== K ? (A = /* @__PURE__ */ x("button", { style: j, onClick: N, "aria-label": $, "aria-expanded": o, children: K }), t[4] = o, t[5] = j, t[6] = N, t[7] = $, t[8] = K, t[9] = A) : A = t[9];
|
|
564
|
+
let T;
|
|
565
|
+
t[10] !== o || t[11] !== l || t[12] !== b || t[13] !== S || t[14] !== m || t[15] !== c ? (T = o && /* @__PURE__ */ k("div", { style: c ? _e : void 0, children: [
|
|
566
|
+
/* @__PURE__ */ x("h3", { style: c ? Ee : void 0, children: "Debug" }),
|
|
567
|
+
/* @__PURE__ */ k("div", { style: c ? Re : void 0, children: [
|
|
568
|
+
/* @__PURE__ */ k("div", { style: c ? q : void 0, children: [
|
|
569
|
+
/* @__PURE__ */ x("span", { children: "Focused:" }),
|
|
570
|
+
/* @__PURE__ */ x("span", { style: c ? z : void 0, children: l ?? "none" })
|
|
571
|
+
] }),
|
|
572
|
+
/* @__PURE__ */ k("div", { style: c ? q : void 0, children: [
|
|
573
|
+
/* @__PURE__ */ x("span", { children: "Previous:" }),
|
|
574
|
+
/* @__PURE__ */ x("span", { style: c ? z : void 0, children: m })
|
|
575
|
+
] }),
|
|
576
|
+
/* @__PURE__ */ k("div", { style: c ? q : void 0, children: [
|
|
577
|
+
/* @__PURE__ */ x("span", { children: "Last move:" }),
|
|
578
|
+
/* @__PURE__ */ x("span", { style: c ? z : void 0, children: b })
|
|
579
|
+
] }),
|
|
580
|
+
/* @__PURE__ */ k("div", { style: c ? q : void 0, children: [
|
|
581
|
+
/* @__PURE__ */ x("span", { children: "Last reject:" }),
|
|
582
|
+
/* @__PURE__ */ x("span", { style: c ? z : void 0, children: S })
|
|
583
|
+
] })
|
|
584
|
+
] })
|
|
585
|
+
] }), t[10] = o, t[11] = l, t[12] = b, t[13] = S, t[14] = m, t[15] = c, t[16] = T) : T = t[16];
|
|
586
|
+
let B;
|
|
587
|
+
return t[17] !== y || t[18] !== I || t[19] !== A || t[20] !== T ? (B = /* @__PURE__ */ k("div", { className: y, style: I, children: [
|
|
588
|
+
A,
|
|
589
|
+
T
|
|
590
|
+
] }), t[17] = y, t[18] = I, t[19] = A, t[20] = T, t[21] = B) : B = t[21], B;
|
|
591
|
+
});
|
|
592
|
+
export {
|
|
593
|
+
$e as CustomFocusable,
|
|
594
|
+
Q as DEFAULT_ACTION_KEYS,
|
|
595
|
+
H as DEFAULT_KEY_MAP,
|
|
596
|
+
Ae as DebugPanel,
|
|
597
|
+
De as FocusGroup,
|
|
598
|
+
ke as Focusable,
|
|
599
|
+
P as NavigationContext,
|
|
600
|
+
Ne as NavigationProvider,
|
|
601
|
+
me as useCustomFocusable,
|
|
602
|
+
he as useFocusEvents,
|
|
603
|
+
fe as useFocusable,
|
|
604
|
+
Oe as useNavigationContext,
|
|
605
|
+
Fe as useNavigationStore
|
|
606
|
+
};
|
|
607
|
+
//# sourceMappingURL=index.js.map
|