@nivaro/react 0.3.9 → 0.3.10

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 (47) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +69 -1
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1000 -1001
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +3687 -3580
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +146 -145
  15. package/dist/shared/components/RecordGridEditor.js +76 -75
  16. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  17. package/dist/shared/components/ai/AskPanel.js +55 -54
  18. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  19. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  20. package/dist/shared/components/chat/SlashCommands.js +30 -29
  21. package/dist/shared/components/chat/chat-outbox.js +76 -75
  22. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  23. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  24. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  25. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  26. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  27. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  28. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  29. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  30. package/dist/shared/components/item-edit/staged-links.js +86 -0
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  32. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  33. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  34. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  35. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  36. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  37. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  38. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  39. package/dist/shared/lib/client-version.js +63 -0
  40. package/dist/shared/lib/force-reload.js +36 -0
  41. package/dist/shared/lib/load-error.js +11 -10
  42. package/dist/shared/lib/presence-live.js +54 -35
  43. package/dist/shared/lib/record-outbox.js +76 -75
  44. package/dist/shared/lib/safe-error.js +39 -0
  45. package/dist/shared/lib/server-clock.js +11 -7
  46. package/dist/shared/lib/unsaved-work.js +62 -0
  47. package/package.json +1 -1
@@ -3,19 +3,23 @@ const i = 1e3;
3
3
  function o() {
4
4
  return Date.now() + s;
5
5
  }
6
- function f(t) {
7
- s = Number.isFinite(t) && Math.abs(t) >= i ? Math.round(t) : 0;
6
+ function f() {
7
+ return s;
8
8
  }
9
9
  function u(t) {
10
+ s = Number.isFinite(t) && Math.abs(t) >= i ? Math.round(t) : 0;
11
+ }
12
+ function c(t) {
10
13
  let e = null;
11
- for (const n of t) {
12
- const r = n.received - n.sent;
13
- !Number.isFinite(r) || r < 0 || !Number.isFinite(n.server) || (!e || r < e.received - e.sent) && (e = n);
14
+ for (const r of t) {
15
+ const n = r.received - r.sent;
16
+ !Number.isFinite(n) || n < 0 || !Number.isFinite(r.server) || (!e || n < e.received - e.sent) && (e = r);
14
17
  }
15
18
  return e ? e.server - (e.sent + (e.received - e.sent) / 2) : null;
16
19
  }
17
20
  export {
18
- u as measureClockOffset,
21
+ c as measureClockOffset,
22
+ f as serverClockOffset,
19
23
  o as serverNow,
20
- f as setServerClockOffset
24
+ u as setServerClockOffset
21
25
  };
@@ -0,0 +1,62 @@
1
+ import { useEffect as c } from "react";
2
+ import { subscribeRecordOutbox as f, getRecordOutbox as i } from "./record-outbox.js";
3
+ const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
4
+ let a = 0;
5
+ function u() {
6
+ for (const e of [...s])
7
+ try {
8
+ e();
9
+ } catch {
10
+ }
11
+ }
12
+ function d(e, t) {
13
+ const n = ++a;
14
+ return r.set(n, { label: e, dirty: t }), u(), () => {
15
+ r.delete(n) && u();
16
+ };
17
+ }
18
+ function l() {
19
+ try {
20
+ return i().length;
21
+ } catch {
22
+ return 0;
23
+ }
24
+ }
25
+ function b() {
26
+ const e = [];
27
+ for (const n of r.values()) {
28
+ let o = !1;
29
+ try {
30
+ o = n.dirty();
31
+ } catch {
32
+ o = !1;
33
+ }
34
+ o && !e.includes(n.label) && e.push(n.label);
35
+ }
36
+ const t = l();
37
+ return t && e.push(`${t} save${t === 1 ? "" : "s"} waiting to be sent`), e;
38
+ }
39
+ function g() {
40
+ return b().length > 0;
41
+ }
42
+ function k(e) {
43
+ s.add(e);
44
+ const t = f(e);
45
+ return () => {
46
+ s.delete(e), t();
47
+ };
48
+ }
49
+ function p(e, t = "Unsaved changes") {
50
+ c(() => {
51
+ if (e)
52
+ return d(t, () => !0);
53
+ }, [e, t]);
54
+ }
55
+ export {
56
+ g as hasUnsavedWork,
57
+ u as notifyUnsavedWorkChanged,
58
+ d as registerUnsavedWork,
59
+ k as subscribeUnsavedWork,
60
+ b as unsavedWorkLabels,
61
+ p as useUnsavedWork
62
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",