@nivaro/react 0.3.110 → 0.3.111
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.
|
@@ -10,7 +10,7 @@ import { noteReplayEvent as Fe, createReplayCheckoutState as Me } from "../share
|
|
|
10
10
|
import { emitReplayTap as Ne, setReplayRecorderMode as O, registerReplayCapture as Oe, clipEndOffset as Ue, withClipKind as We } from "../shared/lib/replay-capture.js";
|
|
11
11
|
import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
|
|
12
12
|
import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
|
|
13
|
-
const ze = "nivaro-react@0.3.
|
|
13
|
+
const ze = "nivaro-react@0.3.111", Q = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, V = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
14
14
|
function Je(o) {
|
|
15
15
|
return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
|
|
16
16
|
const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
@@ -1,55 +1,62 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as g, useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const [e,
|
|
7
|
-
return
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
}), []),
|
|
12
|
-
if (!
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useRef as y, useEffect as x, useLayoutEffect as E } from "react";
|
|
3
|
+
import { createPortal as M } from "react-dom";
|
|
4
|
+
const a = [], R = '[data-nvr-header-menu-panel], [role="menu"]', b = 6;
|
|
5
|
+
function T() {
|
|
6
|
+
const [e, d] = g(null), [o, f] = g(!1), p = y(null);
|
|
7
|
+
return x(() => (a.push(f), a[0] === f && f(!0), () => {
|
|
8
|
+
var n;
|
|
9
|
+
const s = a.indexOf(f);
|
|
10
|
+
s < 0 || (a.splice(s, 1), s === 0 && ((n = a[0]) == null || n.call(a, !0)));
|
|
11
|
+
}), []), x(() => {
|
|
12
|
+
if (!o) return;
|
|
13
|
+
const s = (i) => {
|
|
14
|
+
var v;
|
|
15
|
+
const t = (v = i == null ? void 0 : i.closest) == null ? void 0 : v.call(i, "[data-tip]"), r = t == null ? void 0 : t.getAttribute("data-tip");
|
|
16
|
+
if (!t || !r || t.getAttribute("aria-expanded") === "true") {
|
|
17
|
+
d((h) => h && null);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
x:
|
|
25
|
-
y:
|
|
26
|
-
text:
|
|
27
|
-
beside: { left:
|
|
20
|
+
const l = t.getBoundingClientRect(), m = t.closest(R);
|
|
21
|
+
if (m && m !== t) {
|
|
22
|
+
const h = m.getBoundingClientRect();
|
|
23
|
+
d({
|
|
24
|
+
x: h.left,
|
|
25
|
+
y: l.top,
|
|
26
|
+
text: r,
|
|
27
|
+
beside: { left: h.left, right: h.right, rowTop: l.top, rowHeight: l.height }
|
|
28
28
|
});
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
d({ x: l.left, y: l.bottom + 4, text: r });
|
|
32
|
+
}, n = (i) => s(i.target), u = () => d(null), c = (i) => {
|
|
33
|
+
var r, l;
|
|
34
|
+
const t = (l = (r = i.target) == null ? void 0 : r.closest) == null ? void 0 : l.call(r, "[data-tip-focus]");
|
|
35
|
+
t && s(t);
|
|
36
|
+
}, w = (i) => {
|
|
37
|
+
var t, r;
|
|
38
|
+
(r = (t = i.target) == null ? void 0 : t.closest) != null && r.call(t, "[data-tip-focus]") && d(null);
|
|
35
39
|
};
|
|
36
|
-
|
|
40
|
+
return window.addEventListener("mouseover", n), window.addEventListener("focusin", c), window.addEventListener("focusout", w), window.addEventListener("pointerdown", u, !0), window.addEventListener("scroll", u, !0), () => {
|
|
41
|
+
window.removeEventListener("mouseover", n), window.removeEventListener("focusin", c), window.removeEventListener("focusout", w), window.removeEventListener("pointerdown", u, !0), window.removeEventListener("scroll", u, !0);
|
|
42
|
+
};
|
|
43
|
+
}, [o]), E(() => {
|
|
37
44
|
if (!e) return;
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
const
|
|
41
|
-
let { x:
|
|
45
|
+
const s = p.current;
|
|
46
|
+
if (!s) return;
|
|
47
|
+
const n = s.getBoundingClientRect();
|
|
48
|
+
let { x: u, y: c } = e;
|
|
42
49
|
if (e.beside) {
|
|
43
|
-
const
|
|
44
|
-
|
|
50
|
+
const w = e.beside, i = w.left - b - n.width;
|
|
51
|
+
u = i >= 8 ? i : Math.min(w.right + b, Math.max(8, window.innerWidth - n.width - 8)), c = Math.round(w.rowTop + (w.rowHeight - n.height) / 2), c = Math.max(8, Math.min(c, window.innerHeight - n.height - 8));
|
|
45
52
|
} else
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
}, [e]), !
|
|
49
|
-
/* @__PURE__ */
|
|
53
|
+
n.right > window.innerWidth - 8 && (u = Math.max(8, window.innerWidth - n.width - 8)), n.bottom > window.innerHeight - 8 && (c = Math.max(8, e.y - n.height - 30));
|
|
54
|
+
(u !== e.x || c !== e.y) && d({ ...e, x: u, y: c });
|
|
55
|
+
}, [e]), !o || !e ? null : M(
|
|
56
|
+
/* @__PURE__ */ L(
|
|
50
57
|
"div",
|
|
51
58
|
{
|
|
52
|
-
ref:
|
|
59
|
+
ref: p,
|
|
53
60
|
style: { position: "fixed", left: e.x, top: e.y, zIndex: 120 },
|
|
54
61
|
className: "pointer-events-none max-w-[340px] whitespace-pre-wrap break-words rounded-md bg-[#0f172a] px-2 py-1 text-[11px] font-medium leading-snug text-white shadow-lg dark:bg-[#334155] dark:ring-1 dark:ring-white/10",
|
|
55
62
|
children: e.text
|
|
@@ -58,20 +65,20 @@ function A() {
|
|
|
58
65
|
document.body
|
|
59
66
|
);
|
|
60
67
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
66
|
-
const
|
|
67
|
-
(
|
|
68
|
+
function W(e) {
|
|
69
|
+
const d = y(null);
|
|
70
|
+
return E(() => {
|
|
71
|
+
const o = d.current;
|
|
72
|
+
if (!o) return;
|
|
73
|
+
const f = () => {
|
|
74
|
+
(o.scrollWidth > o.clientWidth + 1 || o.scrollHeight > o.clientHeight + 1) && e ? o.setAttribute("data-tip", e) : o.removeAttribute("data-tip");
|
|
68
75
|
};
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
return
|
|
72
|
-
}, [e]),
|
|
76
|
+
if (f(), typeof ResizeObserver > "u") return;
|
|
77
|
+
const p = new ResizeObserver(f);
|
|
78
|
+
return p.observe(o), () => p.disconnect();
|
|
79
|
+
}, [e]), d;
|
|
73
80
|
}
|
|
74
81
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
T as TipLayer,
|
|
83
|
+
W as useOverflowTip
|
|
77
84
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as d, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { Lock as l } from "lucide-react";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import { cn as p } from "../../lib/utils.js";
|
|
5
|
+
import { Button as f } from "../ui/button.js";
|
|
6
|
+
function v(t, r) {
|
|
7
|
+
if (!r || r.length === 0) return t;
|
|
8
|
+
const o = new Set(t.map((e) => String(e.id).toUpperCase())), a = r.filter((e) => e.blocked && !o.has(String(e.id).toUpperCase()));
|
|
9
|
+
if (a.length === 0) return t;
|
|
10
|
+
const n = [...t, ...a], s = (e) => typeof e.sort == "number" ? e.sort : Number.POSITIVE_INFINITY;
|
|
11
|
+
return n.map((e, i) => ({ t: e, i })).sort((e, i) => s(e.t) - s(i.t) || e.i - i.i).map(({ t: e }) => e);
|
|
12
|
+
}
|
|
13
|
+
function w(t) {
|
|
14
|
+
var r;
|
|
15
|
+
return !!((r = t.blocked) != null && r.reason);
|
|
16
|
+
}
|
|
17
|
+
function B(t, r) {
|
|
18
|
+
const o = [...new Set(t.map((a) => {
|
|
19
|
+
var n;
|
|
20
|
+
return ((n = a.blocked) == null ? void 0 : n.reason) ?? "";
|
|
21
|
+
}).filter(Boolean))];
|
|
22
|
+
return o.length <= 1 ? o[0] ?? "" : t.map((a, n) => {
|
|
23
|
+
var s;
|
|
24
|
+
return `${r(n)}: ${((s = a.blocked) == null ? void 0 : s.reason) ?? ""}`;
|
|
25
|
+
}).join(`
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
const M = u(function({ label: r, reason: o, code: a, small: n = !1, className: s }, e) {
|
|
29
|
+
return /* @__PURE__ */ c(
|
|
30
|
+
f,
|
|
31
|
+
{
|
|
32
|
+
ref: e,
|
|
33
|
+
type: "button",
|
|
34
|
+
size: "sm",
|
|
35
|
+
variant: "outline",
|
|
36
|
+
"aria-disabled": !0,
|
|
37
|
+
"aria-description": o,
|
|
38
|
+
"data-tip": o,
|
|
39
|
+
"data-tip-focus": !0,
|
|
40
|
+
"data-move-unavailable": a ?? !0,
|
|
41
|
+
onClick: (i) => i.preventDefault(),
|
|
42
|
+
className: p(k, n ? "h-7 text-[11px]" : "text-[12px]", s),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ d(l, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
45
|
+
r
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}), k = "gap-1.5 cursor-not-allowed border-dashed border-slate-300 bg-transparent text-slate-500 shadow-none hover:bg-transparent hover:text-slate-500 active:scale-100 dark:border-slate-600 dark:bg-transparent dark:text-slate-400 dark:hover:bg-transparent dark:hover:text-slate-400 [&_svg]:size-3";
|
|
50
|
+
function S(t) {
|
|
51
|
+
var r;
|
|
52
|
+
return (r = t.blocked) != null && r.reason ? {
|
|
53
|
+
"aria-disabled": !0,
|
|
54
|
+
"aria-description": t.blocked.reason,
|
|
55
|
+
"data-tip": t.blocked.reason,
|
|
56
|
+
"data-tip-focus": !0,
|
|
57
|
+
"data-move-unavailable": t.blocked.code,
|
|
58
|
+
onSelect: (o) => o.preventDefault(),
|
|
59
|
+
className: "cursor-not-allowed text-slate-400 focus:bg-slate-50 focus:text-slate-500 dark:text-slate-500 dark:focus:bg-white/5 dark:focus:text-slate-400"
|
|
60
|
+
} : {};
|
|
61
|
+
}
|
|
62
|
+
function N() {
|
|
63
|
+
return /* @__PURE__ */ d(l, { "aria-hidden": !0, className: "ml-auto h-3 w-3 shrink-0 text-slate-400" });
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
k as BLOCKED_MOVE_CLASS,
|
|
67
|
+
N as BlockedMenuMark,
|
|
68
|
+
M as BlockedMoveButton,
|
|
69
|
+
B as blockedGroupTip,
|
|
70
|
+
S as blockedMenuItemProps,
|
|
71
|
+
w as isBlockedMove,
|
|
72
|
+
v as withBlockedMoves
|
|
73
|
+
};
|