@nivaro/react 0.3.127 → 0.3.128

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 (39) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +20 -2
  4. package/dist/index.js +150 -147
  5. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  6. package/dist/shared/components/DataTable.js +406 -401
  7. package/dist/shared/components/ItemEditForm.js +4203 -4156
  8. package/dist/shared/components/MatrixEditor.js +548 -490
  9. package/dist/shared/components/MyWorkView.js +284 -274
  10. package/dist/shared/components/NotificationBell.js +264 -218
  11. package/dist/shared/components/RecordGridEditor.js +582 -472
  12. package/dist/shared/components/chat/chat-core.js +331 -346
  13. package/dist/shared/components/chat/chat-typing.js +25 -0
  14. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  15. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  16. package/dist/shared/components/command-center/api.js +17 -9
  17. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  18. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  19. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  20. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  22. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  23. package/dist/shared/components/item-edit/RowComments.js +33 -30
  24. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  25. package/dist/shared/components/item-edit/live-related.js +29 -16
  26. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  27. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  28. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  29. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  30. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  31. package/dist/shared/components/record-grid-guard.js +85 -0
  32. package/dist/shared/components/support/TicketDetailSheet.js +168 -151
  33. package/dist/shared/lib/at-risk-fields.js +14 -0
  34. package/dist/shared/lib/live-queries.js +9 -8
  35. package/dist/shared/lib/live-screen.js +77 -76
  36. package/dist/shared/lib/presence-hooks.js +190 -127
  37. package/dist/shared/lib/user-sync.js +78 -65
  38. package/dist/shared/lib/waiting-count.js +40 -29
  39. package/package.json +1 -1
@@ -41,6 +41,7 @@ const Oe = [
41
41
  "cbv-row-instance",
42
42
  "queue-items",
43
43
  "my-work",
44
+ "my-work-count",
44
45
  "widget-data",
45
46
  "live-record",
46
47
  "live-list",
@@ -59,7 +60,7 @@ function Se(n) {
59
60
  return (i = n.record) != null && i.collection && s.add(n.record.collection), [...s];
60
61
  }
61
62
  function Ce(n, s, i) {
62
- var Q;
63
+ var k;
63
64
  if (n.reconcileOnly) return !1;
64
65
  const f = n.record, v = !!f && f.collection === s;
65
66
  if (!v && !(n.reads ?? []).includes(s)) return !1;
@@ -73,7 +74,7 @@ function Ce(n, s, i) {
73
74
  if (E.length > 0 && (!n.fields || E.some((u) => {
74
75
  var w;
75
76
  return (w = n.fields) == null ? void 0 : w.includes(u);
76
- })) || (Q = n.aspects) != null && Q.length && a.some((u) => {
77
+ })) || (k = n.aspects) != null && k.length && a.some((u) => {
77
78
  var w;
78
79
  return (w = n.aspects) == null ? void 0 : w.includes(u);
79
80
  })) return !0;
@@ -87,7 +88,7 @@ const x = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set(), re = (n, s)
87
88
  };
88
89
  function Ee(n, s, i = {}) {
89
90
  var $, J;
90
- const f = i.windowMs ?? 300, v = i.readsGapMs ?? 1e4, C = i.hiddenReconcileMs ?? 5 * 6e4, L = i.lingerMs ?? 3e4, Q = i.jitterMs ?? 1500, p = i.isOwn ?? ((t, e) => ye(t, e)), a = i.now ?? (() => Date.now()), E = i.random ?? Math.random, u = i.doc === void 0 ? typeof document > "u" ? null : document : i.doc, w = i.win === void 0 ? typeof window > "u" ? null : window : i.win, k = n.getQueryCache(), R = { events: 0, refetches: 0, reconciles: 0, deferred: 0 };
91
+ const f = i.windowMs ?? 300, v = i.readsGapMs ?? 1e4, C = i.hiddenReconcileMs ?? 5 * 6e4, L = i.lingerMs ?? 3e4, k = i.jitterMs ?? 1500, p = i.isOwn ?? ((t, e) => ye(t, e)), a = i.now ?? (() => Date.now()), E = i.random ?? Math.random, u = i.doc === void 0 ? typeof document > "u" ? null : document : i.doc, w = i.win === void 0 ? typeof window > "u" ? null : window : i.win, Q = n.getQueryCache(), R = { events: 0, refetches: 0, reconciles: 0, deferred: 0 };
91
92
  let g = !1;
92
93
  const h = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), ue = 500, fe = (t) => {
93
94
  if (g || !(t != null && t.collection)) return;
@@ -109,7 +110,7 @@ function Ee(n, s, i = {}) {
109
110
  }, U = () => {
110
111
  if (g) return;
111
112
  const t = /* @__PURE__ */ new Set();
112
- for (const e of k.getAll()) {
113
+ for (const e of Q.getAll()) {
113
114
  if (e.getObserversCount() === 0) continue;
114
115
  const o = m(e);
115
116
  if (!(o != null && o.staleOnly && !e.state.dataUpdatedAt))
@@ -133,7 +134,7 @@ function Ee(n, s, i = {}) {
133
134
  G || (G = !0, queueMicrotask(() => {
134
135
  G = !1, U();
135
136
  }));
136
- }, z = /* @__PURE__ */ new WeakSet(), de = k.subscribe((t) => {
137
+ }, z = /* @__PURE__ */ new WeakSet(), de = Q.subscribe((t) => {
137
138
  var e, o;
138
139
  if (t.type === "added" || t.type === "removed" || t.type === "observerAdded" || t.type === "observerRemoved" || t.type === "observerOptionsUpdated")
139
140
  W();
@@ -197,7 +198,7 @@ function Ee(n, s, i = {}) {
197
198
  const e = A.get(t) ?? [];
198
199
  if (A.delete(t), g || e.length === 0) return;
199
200
  const o = [];
200
- for (const c of k.getAll()) {
201
+ for (const c of Q.getAll()) {
201
202
  const l = m(c);
202
203
  l && Ce(l, t, e) && o.push(c);
203
204
  }
@@ -206,7 +207,7 @@ function Ee(n, s, i = {}) {
206
207
  if (g || me() === "off") return;
207
208
  R.reconciles++;
208
209
  const e = [], o = /* @__PURE__ */ new Set();
209
- for (const l of k.getAll()) {
210
+ for (const l of Q.getAll()) {
210
211
  const y = m(l);
211
212
  y != null && y.staleOnly ? o.add(l) : y && e.push(l);
212
213
  }
@@ -228,7 +229,7 @@ function Ee(n, s, i = {}) {
228
229
  () => {
229
230
  T = null, B();
230
231
  },
231
- Math.floor(E() * Q)
232
+ Math.floor(E() * k)
232
233
  ));
233
234
  };
234
235
  let P = (($ = s.status) == null ? void 0 : $.call(s).state) !== "reconnecting";
@@ -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,