@nivaro/react 0.3.99 → 0.3.100

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 (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useFormSchema.js +82 -85
  3. package/dist/hooks/useSessionRecorder.js +206 -175
  4. package/dist/index.d.ts +38 -13
  5. package/dist/index.js +182 -180
  6. package/dist/lib/commands.js +15 -11
  7. package/dist/shared/components/CollectionBrowserView.js +516 -503
  8. package/dist/shared/components/ItemEditForm.js +3021 -3019
  9. package/dist/shared/components/JobsTray.js +20 -16
  10. package/dist/shared/components/MyWorkView.js +133 -126
  11. package/dist/shared/components/NotificationBell.js +314 -288
  12. package/dist/shared/components/RecordCompare.js +38 -40
  13. package/dist/shared/components/RecordReadView.js +119 -119
  14. package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
  15. package/dist/shared/components/item-edit/InlineGridField.js +45 -45
  16. package/dist/shared/components/item-edit/InlineTableField.js +750 -749
  17. package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
  18. package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
  19. package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
  20. package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
  21. package/dist/shared/components/item-edit/related-missing.js +75 -19
  22. package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
  23. package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
  24. package/dist/shared/components/panels/BackgroundMove.js +175 -0
  25. package/dist/shared/components/panels/MoveAdvisory.js +204 -0
  26. package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
  27. package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
  28. package/dist/shared/lib/commands.js +18 -14
  29. package/dist/shared/lib/error-hints.js +1 -1
  30. package/dist/shared/lib/job-failure-text.js +12 -0
  31. package/dist/shared/lib/move-failure.js +9 -0
  32. package/dist/shared/lib/obligation-banner.js +15 -14
  33. package/dist/shared/lib/partner-failure.js +71 -0
  34. package/dist/shared/lib/prefetch.js +73 -73
  35. package/dist/shared/lib/replay-checkout.js +18 -13
  36. package/dist/shared/lib/replay-context.js +90 -77
  37. package/dist/shared/lib/replay-idle.js +21 -0
  38. package/dist/shared/lib/replay-socket.js +21 -17
  39. package/dist/shared/lib/rum.js +56 -51
  40. package/dist/shared/lib/safe-error.js +17 -13
  41. package/dist/shared/lib/stale-chunk.js +69 -26
  42. package/dist/shared/lib/system-collections.js +20 -0
  43. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- const l = "nvr-stale-chunk-reload";
2
- const d = [
1
+ import { unsavedWorkLabels as S } from "./unsaved-work.js";
2
+ const c = "nvr-stale-chunk-reload", m = 6e4, w = [
3
3
  /Failed to fetch dynamically imported module/i,
4
4
  // Chromium
5
5
  /Importing a module script failed/i,
@@ -9,44 +9,85 @@ const d = [
9
9
  /Unable to preload CSS/i
10
10
  // Vite's CSS preload
11
11
  ];
12
- function c(e) {
12
+ function v(e) {
13
13
  const n = e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e ? String(e.message) : "";
14
- return d.some((t) => t.test(n));
14
+ return w.some((t) => t.test(n));
15
15
  }
16
- function u(e = {}) {
17
- var o;
18
- const n = (e.now ?? Date.now)(), t = e.storage === void 0 ? s() : e.storage;
19
- let r = 0;
16
+ function y(e = {}) {
17
+ var l, i;
18
+ let n = [];
20
19
  try {
21
- r = Number(t == null ? void 0 : t.getItem(l)) || 0;
20
+ n = (e.unsaved ?? S)();
22
21
  } catch {
23
- r = 0;
22
+ n = [];
24
23
  }
25
- if (r && n - r < 6e4)
26
- return (o = e.onGiveUp) == null || o.call(e), "gave-up";
24
+ if (n.length > 0)
25
+ return e.onHeld ? e.onHeld(n) : (l = e.onGiveUp) == null || l.call(e), "held";
26
+ const t = (e.now ?? Date.now)(), r = e.storage === void 0 ? h() : e.storage;
27
+ let o = 0;
27
28
  try {
28
- t == null || t.setItem(l, String(n));
29
+ o = Number(r == null ? void 0 : r.getItem(c)) || 0;
30
+ } catch {
31
+ o = 0;
32
+ }
33
+ if (o && t - o < m)
34
+ return (i = e.onGiveUp) == null || i.call(e), "gave-up";
35
+ try {
36
+ r == null || r.setItem(c, String(t));
29
37
  } catch {
30
38
  }
31
39
  return (e.reload ?? (() => window.location.reload()))(), "reload";
32
40
  }
33
- function f(e = {}) {
41
+ function C(e = {}) {
42
+ const n = e.storage === void 0 ? h() : e.storage;
43
+ try {
44
+ const t = Number(n == null ? void 0 : n.getItem(c)) || 0;
45
+ return t > 0 && (e.now ?? Date.now)() - t < m;
46
+ } catch {
47
+ return !1;
48
+ }
49
+ }
50
+ const E = 2e3, g = 1e4;
51
+ function d(e) {
52
+ let n = null;
53
+ return () => {
54
+ const t = (e.now ?? Date.now)(), r = (n == null ? void 0 : n.outcome) === "reload" ? g : E;
55
+ if (n && t - n.at < r) return n.outcome;
56
+ const o = y(e);
57
+ return n = { outcome: o, at: t }, o;
58
+ };
59
+ }
60
+ let u = null, f = null;
61
+ function R(e = {}) {
34
62
  const n = e.target ?? (typeof window < "u" ? window : void 0);
35
63
  if (!n) return () => {
36
64
  };
37
- let t = !1;
65
+ const t = d(e);
66
+ u = t;
38
67
  const r = () => {
39
- t || (t = !0, u(e) === "gave-up" && (t = !1));
40
- }, o = (i) => {
41
- i.preventDefault(), r();
42
- }, a = (i) => {
43
- c(i.reason) && (i.preventDefault(), r());
68
+ t();
69
+ }, o = (l) => {
70
+ v(l.reason) && (l.preventDefault(), t());
44
71
  };
45
- return n.addEventListener("vite:preloadError", o), n.addEventListener("unhandledrejection", a), () => {
46
- n.removeEventListener("vite:preloadError", o), n.removeEventListener("unhandledrejection", a);
72
+ return n.addEventListener("vite:preloadError", r), n.addEventListener("unhandledrejection", o), () => {
73
+ n.removeEventListener("vite:preloadError", r), n.removeEventListener("unhandledrejection", o), u === t && (u = null);
47
74
  };
48
75
  }
49
- function s() {
76
+ function D(e, n, t) {
77
+ const r = t ? d(t) : null, o = () => (f ?? (f = d({})), (r ?? u ?? f)() !== "reload" ? Promise.resolve({ default: n }) : new Promise((i) => {
78
+ var s;
79
+ const a = setTimeout(() => i({ default: n }), g);
80
+ (s = a.unref) == null || s.call(a);
81
+ }));
82
+ return () => e().then(
83
+ (l) => l && l.default !== void 0 ? l : o(),
84
+ (l) => {
85
+ if (!v(l)) throw l;
86
+ return o();
87
+ }
88
+ );
89
+ }
90
+ function h() {
50
91
  try {
51
92
  return typeof sessionStorage < "u" ? sessionStorage : null;
52
93
  } catch {
@@ -54,7 +95,9 @@ function s() {
54
95
  }
55
96
  }
56
97
  export {
57
- f as installStaleChunkRecovery,
58
- c as isStaleChunkError,
59
- u as recoverFromStaleChunk
98
+ D as guardLazyImport,
99
+ R as installStaleChunkRecovery,
100
+ v as isStaleChunkError,
101
+ y as recoverFromStaleChunk,
102
+ C as staleChunkReloadJustTried
60
103
  };
@@ -0,0 +1,20 @@
1
+ const r = /^(nivaro_|directus_)/i;
2
+ function t(e) {
3
+ return !!e && r.test(e);
4
+ }
5
+ function i(e) {
6
+ return !t(e);
7
+ }
8
+ function o(e) {
9
+ return !t(e) || String(e).toLowerCase() === "nivaro_addendums";
10
+ }
11
+ function s(e) {
12
+ const n = String(e ?? "").toLowerCase();
13
+ return n === "nivaro_files" || n === "directus_files";
14
+ }
15
+ export {
16
+ i as hasRecordExtras,
17
+ s as isFileCollection,
18
+ t as isSystemCollection,
19
+ o as mayHavePipeline
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.99",
3
+ "version": "0.3.100",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",