@nivaro/react 0.3.127 → 0.3.129
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/components/slots/CommentsSlot.js +124 -95
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4485 -4409
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/ai/AiMarkdown.js +215 -196
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/HeaderTools.js +216 -210
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/panels/CommentPanel.js +345 -327
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +213 -174
- package/dist/shared/components/trackers/MirroredText.js +40 -0
- package/dist/shared/components/trackers/SourceTracker.js +168 -0
- package/dist/shared/components/trackers/TrackerChip.js +71 -0
- package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
- package/dist/shared/components/trackers/TrackerPickers.js +245 -0
- package/dist/shared/components/trackers/tracker-model.js +126 -0
- package/dist/shared/components/trackers/use-tracker-link.js +159 -0
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef as v, useState as
|
|
1
|
+
import { useRef as v, useState as b, useLayoutEffect as H, useEffect as M, useCallback as O } from "react";
|
|
2
2
|
import { useLiveBusy as j, liveMotionAllowed as V } from "./live-preference.js";
|
|
3
3
|
const _ = (t, n) => t ? typeof t == "function" ? t(n) : t.has(n) : !1;
|
|
4
4
|
function X(t, n, e, c) {
|
|
@@ -31,7 +31,7 @@ function X(t, n, e, c) {
|
|
|
31
31
|
);
|
|
32
32
|
let p = -1;
|
|
33
33
|
for (let d = u.length - 1; d >= 0 && p < 0; d--)
|
|
34
|
-
p = i.findIndex((
|
|
34
|
+
p = i.findIndex((E) => E.key === u[d].key);
|
|
35
35
|
i.splice(p + 1, 0, s.row);
|
|
36
36
|
} else i.splice(f + 1, 0, s.row);
|
|
37
37
|
}
|
|
@@ -40,58 +40,58 @@ function X(t, n, e, c) {
|
|
|
40
40
|
function fe(t, n, e = {}) {
|
|
41
41
|
const c = e.enabled !== !1, o = v(n);
|
|
42
42
|
o.current = n;
|
|
43
|
-
const [r, i] =
|
|
43
|
+
const [r, i] = b(null), [a, l] = b(!1), [s, f] = b(!1), [u, p] = b(0), d = v(/* @__PURE__ */ new Map()), E = v(0), C = v(/* @__PURE__ */ new Set()), [x, L] = b(0), A = e.held ? [...e.held].sort().join("") : "", [D, k] = b(
|
|
44
44
|
() => (t ?? []).map((y) => ({ key: n(y), row: y, state: "live" }))
|
|
45
|
-
),
|
|
46
|
-
|
|
45
|
+
), h = v(e.resetKey);
|
|
46
|
+
M(() => {
|
|
47
47
|
if (!r) return;
|
|
48
|
-
const y = () => l(!0),
|
|
49
|
-
const
|
|
50
|
-
(!
|
|
48
|
+
const y = () => l(!0), w = () => l(!1), g = () => f(!0), T = (z) => {
|
|
49
|
+
const I = z.relatedTarget;
|
|
50
|
+
(!I || !r.contains(I)) && f(!1);
|
|
51
51
|
};
|
|
52
|
-
return r.addEventListener("pointerenter", y), r.addEventListener("pointerleave",
|
|
53
|
-
r.removeEventListener("pointerenter", y), r.removeEventListener("pointerleave",
|
|
52
|
+
return r.addEventListener("pointerenter", y), r.addEventListener("pointerleave", w), r.addEventListener("focusin", g), r.addEventListener("focusout", T), () => {
|
|
53
|
+
r.removeEventListener("pointerenter", y), r.removeEventListener("pointerleave", w), r.removeEventListener("focusin", g), r.removeEventListener("focusout", T);
|
|
54
54
|
};
|
|
55
|
-
}, [r]),
|
|
55
|
+
}, [r]), M(() => {
|
|
56
56
|
if (!c || typeof document > "u") return;
|
|
57
57
|
const y = () => {
|
|
58
|
-
|
|
58
|
+
E.current += 1, d.current.size > 0 && p((w) => w + 1);
|
|
59
59
|
};
|
|
60
60
|
return document.addEventListener("pointerdown", y, !0), document.addEventListener("keydown", y, !0), () => {
|
|
61
61
|
document.removeEventListener("pointerdown", y, !0), document.removeEventListener("keydown", y, !0);
|
|
62
62
|
};
|
|
63
63
|
}, [c]);
|
|
64
|
-
const
|
|
64
|
+
const S = j(c), R = c && (a || s || S);
|
|
65
65
|
H(() => {
|
|
66
66
|
if (t === void 0) return;
|
|
67
|
-
const y =
|
|
68
|
-
if (
|
|
67
|
+
const y = h.current !== e.resetKey;
|
|
68
|
+
if (h.current = e.resetKey, !c || y) {
|
|
69
69
|
d.current.clear();
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
const w = t.map((g) => ({ key: o.current(g), row: g, state: "live" }));
|
|
71
|
+
k((g) => U(g, w) ? g : w);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
const
|
|
74
|
+
k((w) => {
|
|
75
|
+
const g = new Set(e.held ?? []), T = X(w, t, o.current, {
|
|
76
76
|
frozen: R,
|
|
77
|
-
held:
|
|
78
|
-
released:
|
|
79
|
-
mayLeave: (
|
|
80
|
-
}), z =
|
|
81
|
-
for (const
|
|
82
|
-
|
|
83
|
-
for (const
|
|
84
|
-
|
|
85
|
-
const q = new Set(t.map((
|
|
86
|
-
for (const
|
|
87
|
-
return U(
|
|
77
|
+
held: g,
|
|
78
|
+
released: C.current,
|
|
79
|
+
mayLeave: (m) => (d.current.get(m) ?? Number.POSITIVE_INFINITY) < E.current
|
|
80
|
+
}), z = E.current, I = /* @__PURE__ */ new Set();
|
|
81
|
+
for (const m of T)
|
|
82
|
+
m.state === "departed" && (I.add(m.key), d.current.has(m.key) || d.current.set(m.key, z));
|
|
83
|
+
for (const m of [...d.current.keys()])
|
|
84
|
+
I.has(m) || d.current.delete(m);
|
|
85
|
+
const q = new Set(t.map((m) => o.current(m)));
|
|
86
|
+
for (const m of [...C.current]) q.has(m) && C.current.delete(m);
|
|
87
|
+
return U(w, T) ? w : T;
|
|
88
88
|
});
|
|
89
|
-
}, [t, c, R, u,
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
|
|
89
|
+
}, [t, c, R, u, x, A, e.resetKey]);
|
|
90
|
+
const K = O((y) => {
|
|
91
|
+
for (const w of y) C.current.add(String(w));
|
|
92
|
+
L((w) => w + 1);
|
|
93
93
|
}, []);
|
|
94
|
-
return { rows:
|
|
94
|
+
return { rows: D, containerRef: i, release: K, frozen: R };
|
|
95
95
|
}
|
|
96
96
|
function U(t, n) {
|
|
97
97
|
if (t.length !== n.length) return !1;
|
|
@@ -147,43 +147,44 @@ function B(t) {
|
|
|
147
147
|
function de(t, n, e = {}) {
|
|
148
148
|
const c = e.enabled !== !1, o = v(n);
|
|
149
149
|
o.current = n;
|
|
150
|
-
const [r, i] =
|
|
151
|
-
|
|
150
|
+
const [r, i] = b(null), [a, l] = b(!0), s = v(null), f = v(e.resetKey), [u, p] = b(0), d = v(/* @__PURE__ */ new Set()), E = v(null);
|
|
151
|
+
M(() => {
|
|
152
152
|
if (!r) return;
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
let
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
const k = /(auto|scroll|overlay)/.test(window.getComputedStyle(r).overflowY), h = k ? r : J(r);
|
|
154
|
+
if (E.current = h, !h) return;
|
|
155
|
+
const S = h === document.scrollingElement || h === document.documentElement, R = S ? window : h;
|
|
156
|
+
let K = S ? B(r) : 0;
|
|
157
|
+
const y = () => {
|
|
158
|
+
if (h.scrollTop <= $) return l(!0);
|
|
159
|
+
if (k) return l(!1);
|
|
160
|
+
const g = S ? K : h.getBoundingClientRect().top;
|
|
161
|
+
l(r.getBoundingClientRect().top >= g - $);
|
|
162
|
+
}, w = () => {
|
|
163
|
+
S && (K = B(r)), y();
|
|
163
164
|
};
|
|
164
|
-
return
|
|
165
|
-
|
|
165
|
+
return y(), R.addEventListener("scroll", y, { passive: !0 }), window.addEventListener("resize", w), () => {
|
|
166
|
+
R.removeEventListener("scroll", y), window.removeEventListener("resize", w);
|
|
166
167
|
};
|
|
167
168
|
}, [r]);
|
|
168
|
-
const
|
|
169
|
+
const C = O(() => p((k) => k + 1), []), x = Q(E, l, C);
|
|
169
170
|
f.current !== e.resetKey && (f.current = e.resetKey, s.current = null);
|
|
170
|
-
let
|
|
171
|
-
if (t === void 0)
|
|
171
|
+
let L;
|
|
172
|
+
if (t === void 0) L = { rows: [], held: 0 };
|
|
172
173
|
else if (c)
|
|
173
|
-
|
|
174
|
-
else return s.current = null, d.current = F, { rows: [...t], held: 0, reveal:
|
|
175
|
-
const
|
|
174
|
+
L = G(s.current, t, o.current, a);
|
|
175
|
+
else return s.current = null, d.current = F, { rows: [...t], held: 0, reveal: x, rootRef: i, arrived: F };
|
|
176
|
+
const A = L.rows.map((k) => o.current(k)), D = s.current;
|
|
176
177
|
if (t !== void 0) {
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
|
|
178
|
+
if (D) {
|
|
179
|
+
const k = new Set(D), h = A.filter((S) => !k.has(S));
|
|
180
|
+
h.length > 0 && (d.current = new Set(h));
|
|
180
181
|
} else d.current = F;
|
|
181
|
-
s.current =
|
|
182
|
+
s.current = A;
|
|
182
183
|
}
|
|
183
184
|
return {
|
|
184
|
-
rows:
|
|
185
|
-
held:
|
|
186
|
-
reveal:
|
|
185
|
+
rows: L.rows,
|
|
186
|
+
held: L.held,
|
|
187
|
+
reveal: x,
|
|
187
188
|
rootRef: i,
|
|
188
189
|
arrived: d.current
|
|
189
190
|
};
|
|
@@ -201,7 +202,7 @@ function Q(t, n, e) {
|
|
|
201
202
|
c == null || c.scrollTo({ top: 0, behavior: o ? "smooth" : "auto" }), n(!0), e();
|
|
202
203
|
}, [t, n, e]);
|
|
203
204
|
}
|
|
204
|
-
const
|
|
205
|
+
const Y = 2e3, Z = 1500;
|
|
205
206
|
function ee() {
|
|
206
207
|
return typeof document < "u" && (document.documentElement.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark") ? { fill: "rgba(245, 158, 11, 0.10)", dot: "#f59e0b" } : { fill: "rgba(0, 206, 255, 0.08)", dot: "#00b8e6" };
|
|
207
208
|
}
|
|
@@ -257,11 +258,11 @@ function le(t, n) {
|
|
|
257
258
|
],
|
|
258
259
|
{ duration: 160, easing: "cubic-bezier(0.16, 1, 0.3, 1)" }
|
|
259
260
|
);
|
|
260
|
-
const a =
|
|
261
|
+
const a = Y + Z;
|
|
261
262
|
i.animate(
|
|
262
263
|
[
|
|
263
264
|
{ backgroundColor: e.fill },
|
|
264
|
-
{ backgroundColor: e.fill, offset:
|
|
265
|
+
{ backgroundColor: e.fill, offset: Y / a },
|
|
265
266
|
{ backgroundColor: "rgba(0, 0, 0, 0)" }
|
|
266
267
|
],
|
|
267
268
|
{ duration: a, easing: "linear" }
|
|
@@ -291,15 +292,15 @@ function ce(t, n, e = typeof document > "u" ? null : document.activeElement) {
|
|
|
291
292
|
}
|
|
292
293
|
return [...c];
|
|
293
294
|
}
|
|
294
|
-
const
|
|
295
|
-
function
|
|
295
|
+
const P = 600;
|
|
296
|
+
function W(t) {
|
|
296
297
|
for (const n of t) {
|
|
297
298
|
const e = n;
|
|
298
299
|
!e.isConnected || typeof e.animate != "function" || e.animate([{ opacity: 0.25 }, { opacity: 1 }], { duration: 700, easing: "ease-out" });
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
function pe(t, n = {}) {
|
|
302
|
-
const e = n.enabled !== !1, c = n.windowMs ?? 1200, o = v(0), r = v(!0), i = v([]), [a, l] =
|
|
303
|
+
const e = n.enabled !== !1, c = n.windowMs ?? 1200, o = v(0), r = v(!0), i = v([]), [a, l] = b(null);
|
|
303
304
|
return H(() => {
|
|
304
305
|
if (r.current) {
|
|
305
306
|
r.current = !1;
|
|
@@ -313,19 +314,19 @@ function pe(t, n = {}) {
|
|
|
313
314
|
}
|
|
314
315
|
const f = /* @__PURE__ */ new Set();
|
|
315
316
|
for (const u of i.current)
|
|
316
|
-
if (!(s - u.at >
|
|
317
|
+
if (!(s - u.at > P))
|
|
317
318
|
for (const p of u.targets) f.add(p);
|
|
318
|
-
i.current = [],
|
|
319
|
-
}, [t, c]),
|
|
319
|
+
i.current = [], W([...f]);
|
|
320
|
+
}, [t, c]), M(() => {
|
|
320
321
|
if (!e || !a || typeof MutationObserver > "u") return;
|
|
321
322
|
const s = new MutationObserver((f) => {
|
|
322
323
|
const u = Date.now(), p = ce(a, f);
|
|
323
324
|
if (p.length === 0) return;
|
|
324
325
|
if (u <= o.current) {
|
|
325
|
-
N() ||
|
|
326
|
+
N() || W(p);
|
|
326
327
|
return;
|
|
327
328
|
}
|
|
328
|
-
const d = i.current.filter((
|
|
329
|
+
const d = i.current.filter((E) => u - E.at <= P);
|
|
329
330
|
d.push({ at: u, targets: p }), i.current = d.slice(-20);
|
|
330
331
|
});
|
|
331
332
|
return s.observe(a, { subtree: !0, childList: !0, characterData: !0 }), () => {
|
|
@@ -339,8 +340,8 @@ function ie(t, n = Date.now()) {
|
|
|
339
340
|
return e < 5 ? "Updated just now" : e < 60 ? `Updated ${e} s ago` : e < 3600 ? `Updated ${Math.round(e / 60)} min ago` : e < 86400 ? `Updated ${Math.round(e / 3600)} h ago` : `Updated ${Math.round(e / 86400)} d ago`;
|
|
340
341
|
}
|
|
341
342
|
function ye(t, n) {
|
|
342
|
-
const [e, c] =
|
|
343
|
-
return
|
|
343
|
+
const [e, c] = b(() => Date.now());
|
|
344
|
+
return M(() => {
|
|
344
345
|
if (!n) return;
|
|
345
346
|
c(Date.now());
|
|
346
347
|
const o = setInterval(() => c(Date.now()), 5e3);
|
|
@@ -349,7 +350,7 @@ function ye(t, n) {
|
|
|
349
350
|
}
|
|
350
351
|
export {
|
|
351
352
|
Z as NEW_ROW_FADE_MS,
|
|
352
|
-
|
|
353
|
+
Y as NEW_ROW_HOLD_MS,
|
|
353
354
|
ce as fadeTargets,
|
|
354
355
|
G as holdTopInserts,
|
|
355
356
|
J as scrollParentOf,
|