@nivaro/react 0.3.110 → 0.3.112

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 (77) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +170 -2
  4. package/dist/index.js +745 -728
  5. package/dist/shared/components/CollectionBrowserView.js +3097 -2972
  6. package/dist/shared/components/CollectionImportBanner.js +135 -0
  7. package/dist/shared/components/ItemEditForm.js +2235 -2218
  8. package/dist/shared/components/JobsTray.js +54 -47
  9. package/dist/shared/components/TipLayer.js +61 -54
  10. package/dist/shared/components/ViewAsPersonButton.js +109 -0
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
  13. package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
  14. package/dist/shared/components/bulk/bulk-field-options.js +20 -19
  15. package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
  16. package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
  17. package/dist/shared/components/cbv/column-totals.js +66 -0
  18. package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
  19. package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
  20. package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
  21. package/dist/shared/components/collections-directory/directory-data.js +70 -58
  22. package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
  23. package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
  24. package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
  25. package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
  26. package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
  27. package/dist/shared/components/item-edit/FieldRow.js +248 -246
  28. package/dist/shared/components/item-edit/InlineGridField.js +34 -33
  29. package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
  30. package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
  31. package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
  32. package/dist/shared/components/item-edit/PlanGrid.js +2 -1
  33. package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
  34. package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
  35. package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
  36. package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
  37. package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
  38. package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
  39. package/dist/shared/components/item-edit/grid-search.js +345 -0
  40. package/dist/shared/components/item-edit/render-stability.js +61 -54
  41. package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
  42. package/dist/shared/components/ops-report/DigestSections.js +163 -144
  43. package/dist/shared/components/ops-report/drill.js +97 -97
  44. package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
  45. package/dist/shared/components/panels/AddendumPanel.js +92 -91
  46. package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
  47. package/dist/shared/components/panels/BlockedMove.js +73 -0
  48. package/dist/shared/components/panels/CommentPanel.js +265 -252
  49. package/dist/shared/components/panels/OwnersSlot.js +47 -35
  50. package/dist/shared/components/panels/PipelineInsight.js +186 -0
  51. package/dist/shared/components/panels/PipelinePanel.js +1573 -1475
  52. package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
  53. package/dist/shared/components/panels/RevisionsPanel.js +261 -260
  54. package/dist/shared/components/pipeline/FieldPicker.js +41 -40
  55. package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
  56. package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
  57. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
  58. package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
  59. package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
  60. package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
  61. package/dist/shared/components/profile/PersonHeader.js +29 -29
  62. package/dist/shared/components/profile/PersonProfile.js +30 -28
  63. package/dist/shared/components/profile/SlowScreensCard.js +286 -0
  64. package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
  65. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
  66. package/dist/shared/components/support/TicketDetailSheet.js +25 -16
  67. package/dist/shared/components/support/TicketSlowScreens.js +32 -0
  68. package/dist/shared/lib/activity-sentence.js +224 -178
  69. package/dist/shared/lib/collection-import-banner.js +27 -0
  70. package/dist/shared/lib/crash-report.js +112 -0
  71. package/dist/shared/lib/export-runs.js +99 -0
  72. package/dist/shared/lib/jobs-tray.js +89 -67
  73. package/dist/shared/lib/list-link.js +76 -69
  74. package/dist/shared/lib/nav-trail.js +180 -76
  75. package/dist/shared/lib/query-keys.js +26 -0
  76. package/dist/shared/lib/view-as.js +16 -11
  77. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
- const I = "lv";
2
- const k = 7e3;
3
- function L(t) {
1
+ import { noteTrailAddress as L } from "./nav-trail.js";
2
+ const u = "lv", m = "nvr:list-address", A = 1, v = 7e3;
3
+ function k(t) {
4
4
  const e = new TextEncoder().encode(t);
5
5
  let o = "";
6
6
  for (const i of e) o += String.fromCharCode(i);
7
7
  return btoa(o).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
8
8
  }
9
- function g(t) {
9
+ function S(t) {
10
10
  try {
11
11
  const e = t.replace(/-/g, "+").replace(/_/g, "/"), o = atob(e + "=".repeat((4 - e.length % 4) % 4)), i = Uint8Array.from(o, (r) => r.charCodeAt(0));
12
12
  return new TextDecoder().decode(i);
@@ -14,38 +14,38 @@ function g(t) {
14
14
  return null;
15
15
  }
16
16
  }
17
- function h(t) {
17
+ function w(t) {
18
18
  const e = {};
19
19
  for (const [o, i] of Object.entries(t))
20
20
  i == null || i === "" || Array.isArray(i) && i.length === 0 || typeof i == "object" && !Array.isArray(i) && Object.keys(i).length === 0 || (e[o] = i);
21
21
  return e;
22
22
  }
23
- function A(t, e) {
24
- return L(JSON.stringify({ v: 1, k: t, s: h(e) }));
25
- }
26
23
  function b(t, e) {
24
+ return k(JSON.stringify({ v: A, k: t, s: w(e) }));
25
+ }
26
+ function _(t, e) {
27
27
  if (!t) return null;
28
- const o = g(t);
28
+ const o = S(t);
29
29
  if (!o) return null;
30
30
  try {
31
31
  const i = JSON.parse(o);
32
- return (i == null ? void 0 : i.v) !== 1 || i.k !== e || !i.s || typeof i.s != "object" || Array.isArray(i.s) ? null : i.s;
32
+ return (i == null ? void 0 : i.v) !== A || i.k !== e || !i.s || typeof i.s != "object" || Array.isArray(i.s) ? null : i.s;
33
33
  } catch {
34
34
  return null;
35
35
  }
36
36
  }
37
- function S(t, e, o) {
37
+ function $(t, e, o) {
38
38
  const i = new URL(t);
39
- return i.searchParams.set("lv", A(e, o)), i.toString();
39
+ return i.searchParams.set(u, b(e, o)), i.toString();
40
40
  }
41
- function m(t) {
42
- return typeof window > "u" ? null : b(new URLSearchParams(window.location.search).get("lv"), t);
41
+ function N(t) {
42
+ return typeof window > "u" ? null : _(new URLSearchParams(window.location.search).get(u), t);
43
43
  }
44
- function N() {
44
+ function j() {
45
45
  if (typeof window > "u") return;
46
46
  const t = new URLSearchParams(window.location.search);
47
- if (!t.has("lv")) return;
48
- t.delete("lv");
47
+ if (!t.has(u)) return;
48
+ t.delete(u);
49
49
  const e = t.toString();
50
50
  window.history.replaceState(
51
51
  window.history.state,
@@ -53,40 +53,42 @@ function N() {
53
53
  `${window.location.pathname}${e ? `?${e}` : ""}${window.location.hash}`
54
54
  );
55
55
  }
56
- function R(t, e) {
56
+ function I(t, e) {
57
57
  if (typeof window > "u" || !window.history) return;
58
- const o = new URLSearchParams(window.location.search), i = e ? A(t, e) : null;
59
- if ((o.get("lv") ?? null) === i) return;
60
- i ? o.set("lv", i) : o.delete("lv");
61
- const r = o.toString();
58
+ const o = new URLSearchParams(window.location.search), i = e ? b(t, e) : null;
59
+ if ((o.get(u) ?? null) === i) return;
60
+ i ? o.set(u, i) : o.delete(u);
61
+ const r = o.toString(), l = `${window.location.pathname}${r ? `?${r}` : ""}${window.location.hash}`;
62
62
  try {
63
- window.history.replaceState(
64
- window.history.state,
65
- "",
66
- `${window.location.pathname}${r ? `?${r}` : ""}${window.location.hash}`
67
- );
63
+ window.history.replaceState(window.history.state, "", l);
64
+ } catch {
65
+ return;
66
+ }
67
+ L(l);
68
+ try {
69
+ window.dispatchEvent(new CustomEvent(m, { detail: { path: l } }));
68
70
  } catch {
69
71
  }
70
72
  }
71
- async function v(t, e) {
73
+ async function O(t, e) {
72
74
  if (typeof window > "u") return "failed";
73
- const o = S(window.location.href, t, e);
74
- if (o.length > 7e3) return "too-long";
75
+ const o = $(window.location.href, t, e);
76
+ if (o.length > v) return "too-long";
75
77
  try {
76
78
  return await navigator.clipboard.writeText(o), "copied";
77
79
  } catch {
78
80
  return "failed";
79
81
  }
80
82
  }
81
- const l = (t) => !!t && typeof t == "object" && !Array.isArray(t), u = (t) => typeof t == "string" ? t : void 0, d = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string") : void 0, _ = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string" || typeof e == "number") : [], p = (t, e) => {
83
+ const a = (t) => !!t && typeof t == "object" && !Array.isArray(t), y = (t) => typeof t == "string" ? t : void 0, g = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string") : void 0, E = (t) => Array.isArray(t) ? t.filter((e) => typeof e == "string" || typeof e == "number") : [], d = (t, e) => {
82
84
  const o = Number(t);
83
85
  return Number.isInteger(o) && o > 0 ? Math.min(o, e) : void 0;
84
86
  };
85
- function w(t) {
87
+ function R(t) {
86
88
  if (!t) return null;
87
- const e = {}, o = u(t.q);
89
+ const e = {}, o = y(t.q);
88
90
  o && (e.q = o.slice(0, 500)), Array.isArray(t.f) && (e.f = t.f.filter(
89
- (n) => l(n) && Array.isArray(n.path) && typeof n.op == "string"
91
+ (n) => a(n) && Array.isArray(n.path) && typeof n.op == "string"
90
92
  ).slice(0, 50).map((n, s) => ({
91
93
  ...n,
92
94
  id: typeof n.id == "string" && n.id ? n.id : `lv-${s}`,
@@ -94,70 +96,75 @@ function w(t) {
94
96
  fieldType: typeof n.fieldType == "string" ? n.fieldType : "string",
95
97
  value: n.value ?? ""
96
98
  })));
97
- const i = u(t.s);
99
+ const i = y(t.s);
98
100
  if (i && /^-?[\w.$]+$/.test(i) && (e.s = i), Array.isArray(t.c) && (e.c = t.c.filter(
99
- (n) => typeof n == "string" || l(n) && typeof n.key == "string"
100
- ).slice(0, 100)), l(t.qf)) {
101
+ (n) => typeof n == "string" || a(n) && typeof n.key == "string"
102
+ ).slice(0, 100)), a(t.qf)) {
101
103
  const n = {};
102
104
  for (const [s, f] of Object.entries(t.qf)) {
103
- const y = _(f);
104
- y.length && (n[s] = y.slice(0, 500));
105
+ const h = E(f);
106
+ h.length && (n[s] = h.slice(0, 500));
105
107
  }
106
108
  e.qf = n;
107
109
  }
108
- if (l(t.cf)) {
110
+ if (a(t.cf)) {
109
111
  const n = {};
110
112
  for (const [s, f] of Object.entries(t.cf))
111
- l(f) && typeof f.kind == "string" && (n[s] = f);
113
+ a(f) && typeof f.kind == "string" && (n[s] = f);
112
114
  e.cf = n;
113
115
  }
114
116
  Array.isArray(t.lc) && (e.lc = t.lc.filter(
115
- (n) => l(n) && Array.isArray(n.path) && typeof n.op == "string"
116
- ).slice(0, 50)), Array.isArray(t.ex) && (e.ex = t.ex.filter((n) => l(n) && Array.isArray(n.path)).slice(0, 50));
117
- const r = u(t.g);
117
+ (n) => a(n) && Array.isArray(n.path) && typeof n.op == "string"
118
+ ).slice(0, 50)), Array.isArray(t.ex) && (e.ex = t.ex.filter((n) => a(n) && Array.isArray(n.path)).slice(0, 50));
119
+ const r = y(t.g);
118
120
  r && /^[\w.$]+$/.test(r) && (e.g = r);
119
- const a = p(t.ps, 200);
120
- a && (e.ps = a);
121
- const c = p(t.p, 1e5);
122
- return c && (e.p = c), t.a === !0 && (e.a = !0), e;
121
+ const l = d(t.ps, 200);
122
+ l && (e.ps = l);
123
+ const p = d(t.p, 1e5);
124
+ p && (e.p = p), t.a === !0 && (e.a = !0);
125
+ const c = d(t.v, Number.MAX_SAFE_INTEGER);
126
+ return c && (e.v = c), e;
123
127
  }
124
- function T(t) {
128
+ function q(t) {
125
129
  if (!t) return null;
126
130
  const e = {};
127
- if ((t.scope === "mine" || t.scope === "unowned" || t.scope === "all" || t.scope === "claimed") && (e.scope = t.scope), l(t.filters)) {
131
+ if ((t.scope === "mine" || t.scope === "unowned" || t.scope === "all" || t.scope === "claimed") && (e.scope = t.scope), a(t.filters)) {
128
132
  const c = {};
129
133
  for (const [n, s] of Object.entries(t.filters))
130
134
  if (typeof s == "string") c[n] = s.slice(0, 500);
131
135
  else {
132
- const f = d(s);
136
+ const f = g(s);
133
137
  f != null && f.length && (c[n] = f.slice(0, 500));
134
138
  }
135
139
  e.filters = c;
136
140
  }
137
- const o = u(t.sort);
141
+ const o = y(t.sort);
138
142
  o && /^-?[\w.$]+$/.test(o) && (e.sort = o);
139
- const i = u(t.group_by);
143
+ const i = y(t.group_by);
140
144
  i && (e.group_by = i), (t.view === "table" || t.view === "kanban" || t.view === "workload") && (e.view = t.view);
141
- const r = d(t.columns);
142
- if (r != null && r.length && (e.columns = r.slice(0, 100)), l(t.pins)) {
145
+ const r = g(t.columns);
146
+ if (r != null && r.length && (e.columns = r.slice(0, 100)), a(t.pins)) {
143
147
  const c = {};
144
148
  for (const [n, s] of Object.entries(t.pins)) (s === "left" || s === "right") && (c[n] = s);
145
149
  Object.keys(c).length && (e.pins = c);
146
150
  }
147
- const a = p(t.page, 1e5);
148
- return a && (e.page = a), e;
151
+ const l = d(t.page, 1e5);
152
+ l && (e.page = l);
153
+ const p = d(t.view_id, Number.MAX_SAFE_INTEGER);
154
+ return p && (e.view_id = p), e;
149
155
  }
150
156
  export {
151
- k as LIST_LINK_MAX_CHARS,
152
- I as LIST_LINK_PARAM,
153
- v as copyListLink,
154
- b as decodeListLink,
155
- N as dropListLinkParam,
156
- A as encodeListLink,
157
- S as listLinkUrl,
158
- h as pruneListLinkState,
159
- m as readListLinkFromLocation,
160
- R as replaceListLinkParam,
161
- w as sanitizeCbvLinkState,
162
- T as sanitizeQueueLinkState
157
+ m as LIST_ADDRESS_EVENT,
158
+ v as LIST_LINK_MAX_CHARS,
159
+ u as LIST_LINK_PARAM,
160
+ O as copyListLink,
161
+ _ as decodeListLink,
162
+ j as dropListLinkParam,
163
+ b as encodeListLink,
164
+ $ as listLinkUrl,
165
+ w as pruneListLinkState,
166
+ N as readListLinkFromLocation,
167
+ I as replaceListLinkParam,
168
+ R as sanitizeCbvLinkState,
169
+ q as sanitizeQueueLinkState
163
170
  };
@@ -1,107 +1,211 @@
1
- import { useSyncExternalStore as m } from "react";
2
- const p = "nvr:nav-trail", y = 60, f = (n) => n.split(/[?#]/)[0] || "/";
3
- function k(n, t) {
4
- const i = t.at ?? Date.now(), e = Number.isFinite(t.idx) ? Math.max(0, Math.floor(t.idx)) : 0, r = n.entries.find((s) => s.idx === e);
5
- let o;
1
+ import { useSyncExternalStore as b } from "react";
2
+ const y = "nvr:nav-trail", m = 60, f = (n) => n.split(/[?#]/)[0] || "/";
3
+ function E(n, t) {
4
+ const e = t.at ?? Date.now(), i = Number.isFinite(t.idx) ? Math.max(0, Math.floor(t.idx)) : 0, l = n.entries.find((r) => r.idx === i);
5
+ let s;
6
6
  if (t.action === "PUSH")
7
- o = [...n.entries.filter((s) => s.idx < e), { key: t.key, idx: e, path: t.path, at: i }];
8
- else if (r && r.key === t.key && r.path === t.path)
9
- o = n.entries;
7
+ s = [...n.entries.filter((r) => r.idx < i), { key: t.key, idx: i, path: t.path, at: e }];
8
+ else if (l && l.key === t.key && l.path === t.path)
9
+ s = n.entries;
10
10
  else {
11
- const s = r && f(r.path) === f(t.path) ? r : null, c = {
11
+ const r = l && f(l.path) === f(t.path) ? l : null, o = t.action === "POP" && !!r, a = {
12
12
  key: t.key,
13
- idx: e,
13
+ idx: i,
14
14
  path: t.path,
15
- at: i,
16
- ...s != null && s.label ? { label: s.label } : {},
17
- ...s != null && s.scroll && t.action === "REPLACE" ? { scroll: s.scroll } : {}
15
+ at: e,
16
+ ...r != null && r.label ? { label: r.label } : {},
17
+ ...r != null && r.detail ? { detail: r.detail } : {},
18
+ ...r != null && r.scroll && (t.action === "REPLACE" || o) ? { scroll: r.scroll } : {}
18
19
  };
19
- o = [...n.entries.filter((l) => l.idx !== e), c].sort((l, a) => l.idx - a.idx);
20
+ s = [...n.entries.filter((c) => c.idx !== i), a].sort((c, u) => c.idx - u.idx);
20
21
  }
21
- return o.length > y && (o = o.slice(o.length - y)), { entries: o, current: { key: t.key, idx: e } };
22
+ return s.length > m && (s = s.slice(s.length - m)), { entries: s, current: { key: t.key, idx: i } };
22
23
  }
23
- function I(n) {
24
+ function P(n) {
24
25
  const t = n.current;
25
26
  if (!t) return [];
26
- const i = new Map(n.entries.map((r) => [r.idx, r])), e = [];
27
- for (let r = t.idx - 1; r >= 0; r--) {
28
- const o = i.get(r);
29
- if (!o) break;
30
- e.unshift(o);
27
+ const e = new Map(n.entries.map((l) => [l.idx, l])), i = [];
28
+ for (let l = t.idx - 1; l >= 0; l--) {
29
+ const s = e.get(l);
30
+ if (!s) break;
31
+ i.unshift(s);
31
32
  }
32
- return e;
33
+ return i;
33
34
  }
34
- function A(n, t, i = {}) {
35
- var c;
36
- const e = i.max ?? 4, r = f(t.path), o = /* @__PURE__ */ new Set([r]), s = [];
37
- for (let l = n.length - 1; l >= 0 && s.length < e; l--) {
38
- const a = n[l], d = f(a.path);
39
- if (!o.has(d) && (o.add(d), s.unshift({ key: a.key, path: a.path, label: a.label, delta: a.idx - t.idx }), (c = i.isRoot) != null && c.call(i, d)))
35
+ function L(n, t, e = {}) {
36
+ var o;
37
+ const i = e.max ?? 4, l = f(t.path), s = /* @__PURE__ */ new Set([l]), r = [];
38
+ for (let a = n.length - 1; a >= 0 && r.length < i; a--) {
39
+ const c = n[a], u = f(c.path);
40
+ if (!s.has(u) && (s.add(u), r.unshift({
41
+ key: c.key,
42
+ path: c.path,
43
+ label: c.label,
44
+ ...c.detail ? { detail: c.detail } : {},
45
+ delta: c.idx - t.idx
46
+ }), (o = e.isRoot) != null && o.call(e, u)))
40
47
  break;
41
48
  }
42
- return s;
49
+ return r;
50
+ }
51
+ function M(n) {
52
+ const t = [], e = (n.view ?? "").trim();
53
+ e && t.push(e.length > 40 ? `${e.slice(0, 39)}…` : e);
54
+ const i = (n.search ?? "").trim();
55
+ i && t.push(`“${i.length > 24 ? `${i.slice(0, 23)}…` : i}”`);
56
+ const l = Math.max(0, Math.floor(n.filters ?? 0));
57
+ !e && l > 0 && t.push(`${l} filter${l === 1 ? "" : "s"}`);
58
+ const s = Math.floor(n.page ?? 1);
59
+ return s > 1 && t.push(`page ${s}`), t.join(" · ");
43
60
  }
44
- const b = { entries: [], current: null };
45
- let u = null;
46
- const x = /* @__PURE__ */ new Set();
47
- function h() {
48
- if (u) return u;
61
+ function O(n, t) {
62
+ const e = (t ?? "").trim();
63
+ return e ? `${n} · ${e}` : n;
64
+ }
65
+ const g = { entries: [], current: null };
66
+ let d = null;
67
+ const h = /* @__PURE__ */ new Set();
68
+ function p() {
69
+ if (d) return d;
49
70
  try {
50
- const n = typeof sessionStorage < "u" ? sessionStorage.getItem(p) : null, t = n ? JSON.parse(n) : null;
51
- u = { entries: Array.isArray(t == null ? void 0 : t.entries) ? t.entries.filter(
52
- (e) => !!e && typeof e.key == "string" && typeof e.path == "string" && Number.isFinite(e.idx)
71
+ const n = typeof sessionStorage < "u" ? sessionStorage.getItem(y) : null, t = n ? JSON.parse(n) : null;
72
+ d = { entries: Array.isArray(t == null ? void 0 : t.entries) ? t.entries.filter(
73
+ (i) => !!i && typeof i.key == "string" && typeof i.path == "string" && Number.isFinite(i.idx)
53
74
  ) : [], current: (t == null ? void 0 : t.current) ?? null };
54
75
  } catch {
55
- u = b;
76
+ d = g;
56
77
  }
57
- return u;
78
+ return d;
58
79
  }
59
- function g(n) {
60
- u = n;
80
+ function S(n) {
81
+ d = n;
61
82
  try {
62
- sessionStorage.setItem(p, JSON.stringify(n));
83
+ sessionStorage.setItem(y, JSON.stringify(n));
63
84
  } catch {
64
85
  }
65
- for (const t of x) t();
86
+ for (const t of h) t();
66
87
  }
67
- function S() {
68
- return h();
88
+ function w() {
89
+ return p();
69
90
  }
70
- function w(n) {
71
- const t = k(h(), n);
72
- return t !== u && g(t), t.entries.find((i) => {
73
- var e;
74
- return i.idx === ((e = t.current) == null ? void 0 : e.idx);
91
+ function $(n) {
92
+ const t = E(p(), n);
93
+ return t !== d && S(t), t.entries.find((e) => {
94
+ var i;
95
+ return e.idx === ((i = t.current) == null ? void 0 : i.idx);
75
96
  });
76
97
  }
77
- function N(n, t) {
78
- const i = h(), e = i.current, r = n ? e && e.key === n ? i.entries.findIndex((c) => c.idx === e.idx && c.key === n) : -1 : e ? i.entries.findIndex((c) => c.idx === e.idx && c.key === e.key) : -1;
79
- if (r < 0) return;
80
- const o = t(i.entries[r]);
81
- if (!o) return;
82
- const s = [...i.entries];
83
- s[r] = o, g({ ...i, entries: s });
84
- }
85
- function M(n, t) {
86
- const i = (n ?? "").trim().slice(0, 120);
87
- i && N(t, (e) => e.label === i ? null : { ...e, label: i });
88
- }
89
- function T(n) {
90
- return x.add(n), () => {
91
- x.delete(n);
98
+ function T(n, t) {
99
+ const e = p(), i = e.current, l = n ? i && i.key === n ? e.entries.findIndex((o) => o.idx === i.idx && o.key === n) : -1 : i ? e.entries.findIndex((o) => o.idx === i.idx && o.key === i.key) : -1;
100
+ if (l < 0) return;
101
+ const s = t(e.entries[l]);
102
+ if (!s) return;
103
+ const r = [...e.entries];
104
+ r[l] = s, S({ ...e, entries: r });
105
+ }
106
+ const x = (n) => T(void 0, n);
107
+ function I(n, t) {
108
+ const e = (n ?? "").trim().slice(0, 120);
109
+ e && T(t, (i) => i.label === e ? null : { ...i, label: e });
110
+ }
111
+ function D(n) {
112
+ const t = (n ?? "").trim().slice(0, 120);
113
+ x((e) => {
114
+ if ((e.detail ?? "") === t) return null;
115
+ const { detail: i, ...l } = e;
116
+ return t ? { ...l, detail: t } : l;
117
+ });
118
+ }
119
+ function F(n) {
120
+ n && x(
121
+ (t) => t.path === n || f(t.path) !== f(n) ? null : { ...t, path: n }
122
+ );
123
+ }
124
+ function R(n, t) {
125
+ var l, s;
126
+ const e = f(t.path);
127
+ if (t.action === "POP") {
128
+ const r = n.entries.find((o) => o.idx === t.idx);
129
+ return (l = r == null ? void 0 : r.scroll) != null && l.length && f(r.path) === e ? r.scroll : null;
130
+ }
131
+ if (t.action !== "PUSH" || !t.returning) return null;
132
+ let i = null;
133
+ for (const r of n.entries)
134
+ r.idx >= t.idx || f(r.path) !== e || !((s = r.scroll) != null && s.length) || (!i || r.idx > i.idx) && (i = r);
135
+ return (i == null ? void 0 : i.scroll) ?? null;
136
+ }
137
+ function C(n) {
138
+ const t = n.filter((e) => Number.isFinite(e.top) && e.top >= 0).slice(0, 4);
139
+ x(
140
+ (e) => JSON.stringify(e.scroll ?? []) === JSON.stringify(t) ? null : { ...e, scroll: t }
141
+ );
142
+ }
143
+ function N(n) {
144
+ return h.add(n), () => {
145
+ h.delete(n);
92
146
  };
93
147
  }
94
- function R() {
95
- return m(T, S, () => b);
148
+ function H() {
149
+ return b(N, w, () => g);
150
+ }
151
+ function J(n, t) {
152
+ if (t === n) return "";
153
+ const e = [];
154
+ let i = t;
155
+ for (; i && i !== n; ) {
156
+ const l = i.parentElement;
157
+ if (!l) return null;
158
+ e.unshift(Array.prototype.indexOf.call(l.children, i)), i = l;
159
+ }
160
+ return i === n ? e.join(".") : null;
161
+ }
162
+ function k(n, t) {
163
+ if (t === "") return n;
164
+ let e = n;
165
+ for (const i of t.split(".")) {
166
+ const l = Number(i);
167
+ if (e = (e == null ? void 0 : e.children[l]) ?? null, !e) return null;
168
+ }
169
+ return e;
170
+ }
171
+ function _(n, t, e = 2e3) {
172
+ let i = !1;
173
+ const l = Date.now(), s = new Map(t.map((a) => [a.path, a.top])), r = () => {
174
+ i = !0, n.removeEventListener("wheel", r), n.removeEventListener("touchstart", r), n.removeEventListener("keydown", r);
175
+ };
176
+ n.addEventListener("wheel", r, { passive: !0 }), n.addEventListener("touchstart", r, { passive: !0 }), n.addEventListener("keydown", r);
177
+ const o = () => {
178
+ if (!i) {
179
+ for (const [a, c] of s) {
180
+ const u = k(n, a);
181
+ u && u.scrollHeight - u.clientHeight >= c - 1 && (u.scrollTop = c, s.delete(a));
182
+ }
183
+ if (s.size === 0 || Date.now() - l > e) {
184
+ r();
185
+ return;
186
+ }
187
+ requestAnimationFrame(o);
188
+ }
189
+ };
190
+ return requestAnimationFrame(o), r;
96
191
  }
97
192
  export {
98
- p as NAV_TRAIL_KEY,
99
- A as displayTrail,
100
- S as getNavTrail,
101
- w as recordNavigation,
102
- k as reduceTrail,
103
- M as setTrailLabel,
104
- T as subscribeNavTrail,
105
- I as trailChain,
106
- R as useNavTrail
193
+ y as NAV_TRAIL_KEY,
194
+ L as displayTrail,
195
+ k as elementAtScrollPath,
196
+ w as getNavTrail,
197
+ M as listTrailDetail,
198
+ F as noteTrailAddress,
199
+ $ as recordNavigation,
200
+ E as reduceTrail,
201
+ _ as restoreTrailScroll,
202
+ J as scrollPathOf,
203
+ R as scrollToRestore,
204
+ D as setTrailDetail,
205
+ I as setTrailLabel,
206
+ C as setTrailScroll,
207
+ N as subscribeNavTrail,
208
+ P as trailChain,
209
+ O as trailCrumbText,
210
+ H as useNavTrail
107
211
  };
@@ -0,0 +1,26 @@
1
+ import { get as i } from "./commands.js";
2
+ function o(e, ...t) {
3
+ return [e, ...t];
4
+ }
5
+ const a = {
6
+ collectionMeta: (e) => o("collection-meta", e),
7
+ collectionRelations: (e) => o("collection-relations", e),
8
+ collectionDisplayMeta: (e) => o("collection-display-meta", e),
9
+ fieldConfig: (e, ...t) => o("field-config", e, ...t),
10
+ collections: () => o("collections")
11
+ };
12
+ function s(e, t) {
13
+ return e.request(i(`/collections/${t}`)).then((l) => l.data);
14
+ }
15
+ function f(e, t) {
16
+ return t ? e.request(i(`/collections/${t}`)).then((l) => {
17
+ var c;
18
+ const n = (c = l.data) == null ? void 0 : c.relations;
19
+ return Array.isArray(n) ? n : [];
20
+ }) : Promise.resolve([]);
21
+ }
22
+ export {
23
+ s as fetchCollectionMeta,
24
+ f as fetchCollectionRelations,
25
+ a as queryKeys
26
+ };
@@ -1,17 +1,22 @@
1
- let n = null;
2
- function r(e) {
3
- return n = e, () => {
4
- n === e && (n = null);
1
+ let t = null;
2
+ function e(n) {
3
+ return t = n, () => {
4
+ t === n && (t = null);
5
5
  };
6
6
  }
7
- function t() {
8
- return n !== null;
7
+ function r() {
8
+ return t !== null;
9
9
  }
10
- function u(e) {
11
- return n == null ? void 0 : n(e);
10
+ function u(n) {
11
+ return t == null ? void 0 : t(n);
12
+ }
13
+ function l(n) {
14
+ const i = n ?? (typeof window < "u" ? `${window.location.pathname}${window.location.search}` : "");
15
+ return !(i != null && i.startsWith("/")) || i.startsWith("//") || i.startsWith("/\\") ? null : i.split("#")[0] ?? null;
12
16
  }
13
17
  export {
14
- t as canViewAs,
15
- r as registerViewAsOpener,
16
- u as viewAs
18
+ r as canViewAs,
19
+ e as registerViewAsOpener,
20
+ u as viewAs,
21
+ l as viewAsPath
17
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.110",
3
+ "version": "0.3.112",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",