@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.
Files changed (50) hide show
  1. package/dist/components/slots/CommentsSlot.js +124 -95
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +29 -3
  5. package/dist/index.js +150 -147
  6. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  7. package/dist/shared/components/DataTable.js +406 -401
  8. package/dist/shared/components/ItemEditForm.js +4485 -4409
  9. package/dist/shared/components/MatrixEditor.js +548 -490
  10. package/dist/shared/components/MyWorkView.js +284 -274
  11. package/dist/shared/components/NotificationBell.js +264 -218
  12. package/dist/shared/components/RecordGridEditor.js +582 -472
  13. package/dist/shared/components/ai/AiMarkdown.js +215 -196
  14. package/dist/shared/components/chat/chat-core.js +331 -346
  15. package/dist/shared/components/chat/chat-typing.js +25 -0
  16. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  17. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  18. package/dist/shared/components/command-center/api.js +17 -9
  19. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  20. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  21. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  22. package/dist/shared/components/item-edit/HeaderTools.js +216 -210
  23. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  24. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  25. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  26. package/dist/shared/components/item-edit/RowComments.js +33 -30
  27. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  28. package/dist/shared/components/item-edit/live-related.js +29 -16
  29. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  30. package/dist/shared/components/panels/CommentPanel.js +345 -327
  31. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  32. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  33. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  34. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  35. package/dist/shared/components/record-grid-guard.js +85 -0
  36. package/dist/shared/components/support/TicketDetailSheet.js +213 -174
  37. package/dist/shared/components/trackers/MirroredText.js +40 -0
  38. package/dist/shared/components/trackers/SourceTracker.js +168 -0
  39. package/dist/shared/components/trackers/TrackerChip.js +71 -0
  40. package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
  41. package/dist/shared/components/trackers/TrackerPickers.js +245 -0
  42. package/dist/shared/components/trackers/tracker-model.js +126 -0
  43. package/dist/shared/components/trackers/use-tracker-link.js +159 -0
  44. package/dist/shared/lib/at-risk-fields.js +14 -0
  45. package/dist/shared/lib/live-queries.js +9 -8
  46. package/dist/shared/lib/live-screen.js +77 -76
  47. package/dist/shared/lib/presence-hooks.js +190 -127
  48. package/dist/shared/lib/user-sync.js +78 -65
  49. package/dist/shared/lib/waiting-count.js +40 -29
  50. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { useRef as v, useState as g, useLayoutEffect as H, useEffect as x, useCallback as O } from "react";
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((k) => k.key === u[d].key);
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] = g(null), [a, l] = g(!1), [s, f] = g(!1), [u, p] = g(0), d = v(/* @__PURE__ */ new Map()), k = v(0), L = v(/* @__PURE__ */ new Set()), [A, S] = g(0), D = e.held ? [...e.held].sort().join("") : "", [K, w] = g(
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
- ), b = v(e.resetKey);
46
- x(() => {
45
+ ), h = v(e.resetKey);
46
+ M(() => {
47
47
  if (!r) return;
48
- const y = () => l(!0), m = () => l(!1), E = () => f(!0), I = (z) => {
49
- const M = z.relatedTarget;
50
- (!M || !r.contains(M)) && f(!1);
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", m), r.addEventListener("focusin", E), r.addEventListener("focusout", I), () => {
53
- r.removeEventListener("pointerenter", y), r.removeEventListener("pointerleave", m), r.removeEventListener("focusin", E), r.removeEventListener("focusout", I);
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]), x(() => {
55
+ }, [r]), M(() => {
56
56
  if (!c || typeof document > "u") return;
57
57
  const y = () => {
58
- k.current += 1, d.current.size > 0 && p((m) => m + 1);
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 C = j(c), R = c && (a || s || C);
64
+ const S = j(c), R = c && (a || s || S);
65
65
  H(() => {
66
66
  if (t === void 0) return;
67
- const y = b.current !== e.resetKey;
68
- if (b.current = e.resetKey, !c || y) {
67
+ const y = h.current !== e.resetKey;
68
+ if (h.current = e.resetKey, !c || y) {
69
69
  d.current.clear();
70
- const m = t.map((E) => ({ key: o.current(E), row: E, state: "live" }));
71
- w((E) => U(E, m) ? E : m);
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
- w((m) => {
75
- const E = new Set(e.held ?? []), I = X(m, t, o.current, {
74
+ k((w) => {
75
+ const g = new Set(e.held ?? []), T = X(w, t, o.current, {
76
76
  frozen: R,
77
- held: E,
78
- released: L.current,
79
- mayLeave: (h) => (d.current.get(h) ?? Number.POSITIVE_INFINITY) < k.current
80
- }), z = k.current, M = /* @__PURE__ */ new Set();
81
- for (const h of I)
82
- h.state === "departed" && (M.add(h.key), d.current.has(h.key) || d.current.set(h.key, z));
83
- for (const h of [...d.current.keys()])
84
- M.has(h) || d.current.delete(h);
85
- const q = new Set(t.map((h) => o.current(h)));
86
- for (const h of [...L.current]) q.has(h) && L.current.delete(h);
87
- return U(m, I) ? m : I;
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, A, D, e.resetKey]);
90
- const T = O((y) => {
91
- for (const m of y) L.current.add(String(m));
92
- S((m) => m + 1);
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: K, containerRef: i, release: T, frozen: R };
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] = g(null), [a, l] = g(!0), s = v(null), f = v(e.resetKey), [u, p] = g(0), d = v(/* @__PURE__ */ new Set()), k = v(null);
151
- x(() => {
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 w = J(r);
154
- if (k.current = w, !w) return;
155
- const b = w === document.scrollingElement || w === document.documentElement, C = b ? window : w;
156
- let R = b ? B(r) : 0;
157
- const T = () => {
158
- if (w.scrollTop <= $) return l(!0);
159
- const m = b ? R : w.getBoundingClientRect().top;
160
- l(r.getBoundingClientRect().top >= m - $);
161
- }, y = () => {
162
- b && (R = B(r)), T();
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 T(), C.addEventListener("scroll", T, { passive: !0 }), window.addEventListener("resize", y), () => {
165
- C.removeEventListener("scroll", T), window.removeEventListener("resize", y);
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 L = O(() => p((w) => w + 1), []), A = Q(k, l, L);
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 S;
171
- if (t === void 0) S = { rows: [], held: 0 };
171
+ let L;
172
+ if (t === void 0) L = { rows: [], held: 0 };
172
173
  else if (c)
173
- S = G(s.current, t, o.current, a);
174
- else return s.current = null, d.current = F, { rows: [...t], held: 0, reveal: A, rootRef: i, arrived: F };
175
- const D = S.rows.map((w) => o.current(w)), K = s.current;
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 (K) {
178
- const w = new Set(K), b = D.filter((C) => !w.has(C));
179
- b.length > 0 && (d.current = new Set(b));
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 = D;
182
+ s.current = A;
182
183
  }
183
184
  return {
184
- rows: S.rows,
185
- held: S.held,
186
- reveal: A,
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 P = 2e3, Z = 1500;
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 = P + Z;
261
+ const a = Y + Z;
261
262
  i.animate(
262
263
  [
263
264
  { backgroundColor: e.fill },
264
- { backgroundColor: e.fill, offset: P / a },
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 W = 600;
295
- function Y(t) {
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] = g(null);
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 > W))
317
+ if (!(s - u.at > P))
317
318
  for (const p of u.targets) f.add(p);
318
- i.current = [], Y([...f]);
319
- }, [t, c]), x(() => {
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() || Y(p);
326
+ N() || W(p);
326
327
  return;
327
328
  }
328
- const d = i.current.filter((k) => u - k.at <= W);
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] = g(() => Date.now());
343
- return x(() => {
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
- P as NEW_ROW_HOLD_MS,
353
+ Y as NEW_ROW_HOLD_MS,
353
354
  ce as fadeTargets,
354
355
  G as holdTopInserts,
355
356
  J as scrollParentOf,