@nivaro/react 0.3.113 → 0.3.115

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 (285) hide show
  1. package/dist/components/ScreenShareHost.js +24 -0
  2. package/dist/full.css +50 -2
  3. package/dist/hooks/useSessionRecorder.js +61 -60
  4. package/dist/index.d.ts +1727 -19
  5. package/dist/index.js +1091 -950
  6. package/dist/shared/components/ActivityEntry.js +209 -97
  7. package/dist/shared/components/AgentPresenceChip.js +51 -0
  8. package/dist/shared/components/AnnouncementBanner.js +56 -41
  9. package/dist/shared/components/AutolinkedText.js +98 -85
  10. package/dist/shared/components/BroadcastView.js +149 -141
  11. package/dist/shared/components/CacheStamp.js +78 -30
  12. package/dist/shared/components/CollectionBrowserView.js +4088 -3592
  13. package/dist/shared/components/ConfigChangeStrip.js +63 -0
  14. package/dist/shared/components/ConfigReachNote.js +107 -0
  15. package/dist/shared/components/ConformanceView.js +389 -319
  16. package/dist/shared/components/DataTable.js +544 -504
  17. package/dist/shared/components/DelegateCoverLine.js +164 -0
  18. package/dist/shared/components/EnvironmentNotice.js +56 -65
  19. package/dist/shared/components/FilePreviewLightbox.js +89 -43
  20. package/dist/shared/components/FindingFixedMark.js +23 -0
  21. package/dist/shared/components/GridPresenceLine.js +100 -0
  22. package/dist/shared/components/IdleReloadWatcher.js +82 -43
  23. package/dist/shared/components/InStep.js +46 -0
  24. package/dist/shared/components/ItemEditForm.js +5504 -4889
  25. package/dist/shared/components/LiveAnnouncer.js +62 -0
  26. package/dist/shared/components/LiveCount.js +54 -0
  27. package/dist/shared/components/LiveFigure.js +28 -0
  28. package/dist/shared/components/LiveListControls.js +114 -0
  29. package/dist/shared/components/LiveNewMatchesPill.js +25 -0
  30. package/dist/shared/components/LiveOffNote.js +44 -0
  31. package/dist/shared/components/LivePreferenceHost.js +42 -0
  32. package/dist/shared/components/LiveRowMark.js +25 -20
  33. package/dist/shared/components/LiveTraceView.js +257 -0
  34. package/dist/shared/components/MapView.js +30 -29
  35. package/dist/shared/components/MatrixEditor.js +497 -462
  36. package/dist/shared/components/MyWorkView.js +346 -272
  37. package/dist/shared/components/NotificationBell.js +215 -201
  38. package/dist/shared/components/PageRenderer.js +636 -599
  39. package/dist/shared/components/PresenceDot.js +21 -0
  40. package/dist/shared/components/ProfileView.js +656 -536
  41. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  42. package/dist/shared/components/RecentRecordsRail.js +51 -48
  43. package/dist/shared/components/RecordCompare.js +241 -150
  44. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  45. package/dist/shared/components/RecordGridEditor.js +350 -311
  46. package/dist/shared/components/RecordHoverCard.js +147 -0
  47. package/dist/shared/components/RecordPeekHost.js +111 -0
  48. package/dist/shared/components/RecordReadView.js +414 -412
  49. package/dist/shared/components/RelativeTime.js +16 -0
  50. package/dist/shared/components/ReportView.js +1396 -1304
  51. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  52. package/dist/shared/components/TabCountHost.js +10 -0
  53. package/dist/shared/components/TickerNumber.js +19 -18
  54. package/dist/shared/components/TipLayer.js +70 -58
  55. package/dist/shared/components/WidgetImageMenu.js +59 -0
  56. package/dist/shared/components/WidgetSlot.js +571 -524
  57. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  58. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  59. package/dist/shared/components/cbv/approval-changed.js +20 -0
  60. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  61. package/dist/shared/components/cbv/column-totals.js +75 -67
  62. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  63. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  65. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  66. package/dist/shared/components/change-proposals/types.js +4 -0
  67. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  68. package/dist/shared/components/chat/Composer.js +276 -298
  69. package/dist/shared/components/chat/room-due.js +13 -0
  70. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  71. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  72. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  73. package/dist/shared/components/imports/ImportConsole.js +159 -155
  74. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  75. package/dist/shared/components/integrations/SendStatus.js +202 -0
  76. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  77. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  78. package/dist/shared/components/integrations/console/api.js +161 -117
  79. package/dist/shared/components/integrations/console/tone.js +15 -12
  80. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  81. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  82. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  83. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  84. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  85. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  86. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  87. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  88. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  89. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  90. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  91. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  92. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  93. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  94. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  95. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  96. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  97. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  98. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  99. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  100. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  101. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  102. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  103. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  104. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  105. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  106. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  107. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  108. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  109. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  110. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  111. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  112. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  113. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  114. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  115. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  116. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  117. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  118. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  119. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  120. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  121. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  122. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  123. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  124. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  125. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  126. package/dist/shared/components/item-edit/file-live.js +77 -0
  127. package/dist/shared/components/item-edit/file-processing.js +87 -0
  128. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  129. package/dist/shared/components/item-edit/live-related.js +23 -0
  130. package/dist/shared/components/item-edit/live-title.js +66 -0
  131. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  132. package/dist/shared/components/item-edit/removed-line.js +58 -0
  133. package/dist/shared/components/item-edit/render-stability.js +70 -59
  134. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  135. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  136. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  137. package/dist/shared/components/list/InlineEdit.js +504 -208
  138. package/dist/shared/components/list/ListViewers.js +81 -0
  139. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  140. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  141. package/dist/shared/components/merge/merge-values.js +110 -0
  142. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  143. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  144. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  145. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  146. package/dist/shared/components/notifications/bundles.js +21 -19
  147. package/dist/shared/components/notifications/resolved-line.js +25 -0
  148. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  149. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  150. package/dist/shared/components/panels/AlertBanners.js +132 -0
  151. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  152. package/dist/shared/components/panels/BranchLanes.js +82 -54
  153. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  154. package/dist/shared/components/panels/CommentImages.js +219 -0
  155. package/dist/shared/components/panels/CommentPanel.js +649 -530
  156. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  157. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  158. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  159. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  160. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  161. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  162. package/dist/shared/components/panels/SlaClock.js +130 -99
  163. package/dist/shared/components/panels/TaskPanel.js +308 -287
  164. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  165. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  166. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  167. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  168. package/dist/shared/components/profile/AgentNameField.js +141 -0
  169. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  170. package/dist/shared/components/profile/PersonAccess.js +398 -330
  171. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  172. package/dist/shared/components/profile/PersonProfile.js +81 -73
  173. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  174. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  175. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  176. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  177. package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
  178. package/dist/shared/components/queue/queue-totals.js +92 -0
  179. package/dist/shared/components/queue/worklist-helpers.js +18 -14
  180. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  181. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  182. package/dist/shared/components/support/ReportProblem.js +1 -0
  183. package/dist/shared/components/support/ScreenShare.js +554 -0
  184. package/dist/shared/components/support/SupportView.js +160 -129
  185. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  186. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  187. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  188. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  189. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  190. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  191. package/dist/shared/lib/activity-sentence.js +87 -75
  192. package/dist/shared/lib/agent-presence.js +46 -0
  193. package/dist/shared/lib/approval-progress.js +49 -0
  194. package/dist/shared/lib/attention-prefs.js +27 -0
  195. package/dist/shared/lib/cell-locks.js +56 -0
  196. package/dist/shared/lib/co-edit.js +166 -0
  197. package/dist/shared/lib/coedit-registry.js +44 -0
  198. package/dist/shared/lib/comment-awareness.js +124 -0
  199. package/dist/shared/lib/comment-images.js +45 -0
  200. package/dist/shared/lib/config-watch.js +94 -0
  201. package/dist/shared/lib/copy-rules.js +65 -0
  202. package/dist/shared/lib/count-step.js +30 -0
  203. package/dist/shared/lib/deadline-ticker.js +68 -0
  204. package/dist/shared/lib/derived-causes.js +115 -0
  205. package/dist/shared/lib/draft-store.js +114 -85
  206. package/dist/shared/lib/error-hints.js +1 -0
  207. package/dist/shared/lib/field-merge.js +126 -0
  208. package/dist/shared/lib/filter-sentence.js +10 -10
  209. package/dist/shared/lib/focus-mode.js +16 -12
  210. package/dist/shared/lib/grid-cursors.js +77 -0
  211. package/dist/shared/lib/grid-presence.js +182 -0
  212. package/dist/shared/lib/idle-reload.js +100 -73
  213. package/dist/shared/lib/in-step.js +45 -0
  214. package/dist/shared/lib/integration-chip.js +19 -18
  215. package/dist/shared/lib/line-locks.js +141 -0
  216. package/dist/shared/lib/line-split.js +41 -0
  217. package/dist/shared/lib/linked-changes.js +150 -0
  218. package/dist/shared/lib/list-link.js +56 -50
  219. package/dist/shared/lib/list-return.js +231 -0
  220. package/dist/shared/lib/list-viewers.js +52 -0
  221. package/dist/shared/lib/live-announcer.js +86 -0
  222. package/dist/shared/lib/live-counts.js +85 -0
  223. package/dist/shared/lib/live-data-changed.js +108 -0
  224. package/dist/shared/lib/live-deltas.js +81 -0
  225. package/dist/shared/lib/live-findings.js +113 -0
  226. package/dist/shared/lib/live-groups.js +122 -0
  227. package/dist/shared/lib/live-link-labels.js +162 -0
  228. package/dist/shared/lib/live-list-flow.js +334 -0
  229. package/dist/shared/lib/live-list.js +143 -129
  230. package/dist/shared/lib/live-moves.js +51 -0
  231. package/dist/shared/lib/live-ops.js +26 -26
  232. package/dist/shared/lib/live-pickers.js +7 -0
  233. package/dist/shared/lib/live-preference.js +184 -0
  234. package/dist/shared/lib/live-queries.js +226 -181
  235. package/dist/shared/lib/live-screen.js +333 -0
  236. package/dist/shared/lib/live-search.js +108 -0
  237. package/dist/shared/lib/live-seen.js +35 -0
  238. package/dist/shared/lib/live-views.js +100 -0
  239. package/dist/shared/lib/live.js +159 -133
  240. package/dist/shared/lib/missed-updates.js +198 -0
  241. package/dist/shared/lib/newer-file.js +56 -0
  242. package/dist/shared/lib/notification-sound.js +42 -20
  243. package/dist/shared/lib/own-writes.js +59 -41
  244. package/dist/shared/lib/picker-badges.js +94 -0
  245. package/dist/shared/lib/presence-signals.js +131 -84
  246. package/dist/shared/lib/realtime.js +49 -24
  247. package/dist/shared/lib/record-gaps.js +85 -0
  248. package/dist/shared/lib/record-outbox.js +369 -222
  249. package/dist/shared/lib/record-peek.js +75 -0
  250. package/dist/shared/lib/record-tabs.js +92 -72
  251. package/dist/shared/lib/relative-ticker.js +42 -0
  252. package/dist/shared/lib/request-gate.js +119 -119
  253. package/dist/shared/lib/rollup-recalc.js +107 -0
  254. package/dist/shared/lib/room-gaps.js +40 -36
  255. package/dist/shared/lib/rum.js +137 -87
  256. package/dist/shared/lib/save-progress.js +20 -0
  257. package/dist/shared/lib/scheduled-countdown.js +67 -0
  258. package/dist/shared/lib/screen-refresh.js +160 -0
  259. package/dist/shared/lib/screen-share.js +234 -0
  260. package/dist/shared/lib/seen-since.js +74 -0
  261. package/dist/shared/lib/selection-watch.js +205 -0
  262. package/dist/shared/lib/send-status.js +132 -0
  263. package/dist/shared/lib/send-view.js +23 -0
  264. package/dist/shared/lib/socket-liveness.js +155 -0
  265. package/dist/shared/lib/socket-realtime.js +168 -140
  266. package/dist/shared/lib/state-census.js +53 -0
  267. package/dist/shared/lib/summary-mode.js +61 -39
  268. package/dist/shared/lib/tab-attention.js +143 -32
  269. package/dist/shared/lib/table-density.js +64 -0
  270. package/dist/shared/lib/track-travel.js +40 -0
  271. package/dist/shared/lib/unseen-changes.js +68 -0
  272. package/dist/shared/lib/upload-file.js +33 -0
  273. package/dist/shared/lib/upload-presence.js +127 -0
  274. package/dist/shared/lib/urgent-chime.js +65 -0
  275. package/dist/shared/lib/use-online-users.js +32 -11
  276. package/dist/shared/lib/user-sync.js +155 -39
  277. package/dist/shared/lib/waiting-count.js +44 -0
  278. package/dist/shared/lib/watch-desktop.js +83 -0
  279. package/dist/shared/lib/watch-list.js +447 -0
  280. package/dist/shared/lib/widget-image-render.js +64 -0
  281. package/dist/shared/lib/widget-image.js +111 -0
  282. package/dist/shared/lib/worker-socket.js +130 -104
  283. package/dist/shared/lib/write-to-screen.js +133 -0
  284. package/package.json +1 -1
  285. package/styles.css +49 -1
@@ -0,0 +1,113 @@
1
+ import { useState as F, useRef as d, useEffect as v, useCallback as C, useMemo as O } from "react";
2
+ import { useOptionalNivaroClient as q } from "../context.js";
3
+ import { get as I } from "./commands.js";
4
+ import { useLiveCollection as P } from "./live.js";
5
+ import { writerOf as U } from "./live-list.js";
6
+ const g = (o) => String(o).toUpperCase();
7
+ function j(o, i, l = 40) {
8
+ if (i.aspectsOnly) return [];
9
+ const u = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
10
+ for (const e of i.events) {
11
+ const f = String(e.collection);
12
+ e.item === "*" ? y.add(f) : u.add(`${f}:${g(e.item)}`);
13
+ }
14
+ const a = [], m = /* @__PURE__ */ new Set();
15
+ for (const e of o)
16
+ if (!m.has(e.key) && (u.has(`${e.collection}:${g(e.itemId)}`) || y.has(e.collection)) && (m.add(e.key), a.push(e), a.length >= l))
17
+ break;
18
+ return a;
19
+ }
20
+ function E(o, i, l) {
21
+ if (!o.by) return "Fixed";
22
+ if (l && g(o.by) === g(l)) return "Fixed by you";
23
+ const u = (i ?? "").trim();
24
+ return u ? `Fixed by ${u}` : "Fixed";
25
+ }
26
+ function N(o) {
27
+ const { findings: i, enabled: l = !0, maxPerRun: u = 40 } = o, y = q(), [a, m] = F(() => /* @__PURE__ */ new Map()), e = d(o);
28
+ e.current = o;
29
+ const f = d(i);
30
+ f.current = i;
31
+ const S = d(y);
32
+ S.current = y;
33
+ const p = d(!0), h = d([]), b = d(!1);
34
+ v(() => (p.current = !0, () => {
35
+ p.current = !1;
36
+ }), []);
37
+ const $ = i.map((t) => t.key).join("\0");
38
+ v(() => {
39
+ const t = new Set(f.current.map((n) => n.key));
40
+ m((n) => {
41
+ let c = !1;
42
+ const r = /* @__PURE__ */ new Map();
43
+ for (const [s, k] of n)
44
+ t.has(s) ? r.set(s, k) : c = !0;
45
+ return c ? r : n;
46
+ });
47
+ }, [$]);
48
+ const R = C(async (t) => {
49
+ const n = e.current;
50
+ if (n.lookupWriter) return n.lookupWriter(t).catch(() => null);
51
+ const c = S.current;
52
+ if (!c) return null;
53
+ try {
54
+ const r = await c.request(
55
+ I(`/items/${encodeURIComponent(t.collection)}/${encodeURIComponent(t.itemId)}`, {
56
+ fields: "user_updated"
57
+ })
58
+ );
59
+ return U(r.data);
60
+ } catch {
61
+ return null;
62
+ }
63
+ }, []), M = C(async () => {
64
+ if (!b.current) {
65
+ b.current = !0;
66
+ try {
67
+ for (; h.current.length > 0 && p.current; ) {
68
+ const t = h.current.splice(0, e.current.maxPerRun ?? 40);
69
+ let n = [];
70
+ try {
71
+ n = await e.current.recheck(t);
72
+ } catch {
73
+ continue;
74
+ }
75
+ if (!p.current) return;
76
+ const c = new Set(n), r = /* @__PURE__ */ new Map();
77
+ if (await Promise.all(
78
+ t.filter((s) => c.has(s.key)).slice(0, 12).map(async (s) => r.set(s.key, await R(s)))
79
+ ), !p.current) return;
80
+ m((s) => {
81
+ const k = new Map(s);
82
+ for (const w of t)
83
+ c.has(w.key) ? k.set(w.key, s.get(w.key) ?? { at: Date.now(), by: r.get(w.key) ?? null }) : k.delete(w.key);
84
+ return k;
85
+ });
86
+ }
87
+ } finally {
88
+ b.current = !1;
89
+ }
90
+ }
91
+ }, [R]), x = [...new Set(i.map((t) => t.collection))].sort().join(",");
92
+ return P(
93
+ x ? x.split(",") : null,
94
+ (t) => {
95
+ const n = j(f.current, t, u);
96
+ if (n.length === 0) return;
97
+ const c = new Set(h.current.map((r) => r.key));
98
+ for (const r of n) c.has(r.key) || h.current.push(r);
99
+ M();
100
+ },
101
+ {
102
+ debounceMs: 1e3,
103
+ includeOwn: !0,
104
+ enabled: l && x !== "",
105
+ focusable: !0
106
+ }
107
+ ), O(() => ({ resolved: a }), [a]);
108
+ }
109
+ export {
110
+ j as findingsTouchedBy,
111
+ E as resolvedLabel,
112
+ N as useResolvedFindings
113
+ };
@@ -0,0 +1,122 @@
1
+ import { useRef as K, useState as _, useEffect as S, useLayoutEffect as A } from "react";
2
+ import { useListAnchors as G, ROW_HOLD_MAX_MS as C, GROUP_ANCHOR_PREFIX as H } from "./live-list-flow.js";
3
+ import { liveMotionAllowed as O } from "./live-preference.js";
4
+ const v = (t) => t.flatMap((n) => [`${H}${n.key}`, ...n.rows]);
5
+ function T(t, n, i) {
6
+ const s = { held: !1, groups: n, gone: [], moving: /* @__PURE__ */ new Map() }, u = v(t);
7
+ let c = -1;
8
+ for (const e of i) e != null && (c = Math.max(c, u.indexOf(e)));
9
+ if (c < 0) return s;
10
+ const f = v(n);
11
+ let l = f.length > c;
12
+ for (let e = 0; l && e <= c; e++) u[e] !== f[e] && (l = !1);
13
+ if (l) return s;
14
+ const g = /* @__PURE__ */ new Map();
15
+ for (const e of n) for (const a of e.rows) g.set(a, e.key);
16
+ const p = [], r = /* @__PURE__ */ new Map();
17
+ for (const e of t)
18
+ for (const a of e.rows) {
19
+ const y = g.get(a);
20
+ y == null ? p.push(a) : y !== e.key && r.set(a, y);
21
+ }
22
+ return {
23
+ held: !0,
24
+ groups: t.map((e) => ({ key: e.key, rows: [...e.rows] })),
25
+ gone: p,
26
+ moving: r
27
+ };
28
+ }
29
+ function I(t) {
30
+ return `Now in ${t} — it moves there when you move the pointer away`;
31
+ }
32
+ function X(t, n, i, s = {}) {
33
+ const u = s.enabled !== !1, c = K({ groups: [], rowByKey: /* @__PURE__ */ new Map(), groupByKey: /* @__PURE__ */ new Map() }), f = K(!1), [, l] = _(0), g = G(i, u, () => {
34
+ f.current && l((o) => o + 1);
35
+ }), p = t.map((o) => ({ key: o.key, rows: o.rows.map(n) })), r = c.current, e = u && r.resetKey === s.resetKey ? T(r.groups, p, g.current()) : null, a = !!(e != null && e.held), y = s.maxHoldMs ?? C;
36
+ S(() => {
37
+ if (f.current = a, !a) return;
38
+ const o = setTimeout(() => {
39
+ g.clear(), l((w) => w + 1);
40
+ }, y);
41
+ return () => clearTimeout(o);
42
+ }, [a, y, g]);
43
+ const h = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
44
+ for (const o of t) {
45
+ M.set(o.key, o);
46
+ for (const w of o.rows) h.set(n(w), w);
47
+ }
48
+ let k, m;
49
+ e != null && e.held ? (m = e.groups, k = e.groups.map((o) => ({
50
+ key: o.key,
51
+ group: M.get(o.key) ?? null,
52
+ rows: o.rows.map((w) => h.get(w) ?? r.rowByKey.get(w)).filter((w) => w !== void 0)
53
+ }))) : (m = p, k = t.map((o) => ({ key: o.key, group: o, rows: o.rows }))), S(() => {
54
+ const o = new Map(h);
55
+ for (const w of m)
56
+ for (const d of w.rows)
57
+ !o.has(d) && r.rowByKey.has(d) && o.set(d, r.rowByKey.get(d));
58
+ c.current = { groups: m, rowByKey: o, groupByKey: M, resetKey: s.resetKey };
59
+ });
60
+ const b = new Set((e == null ? void 0 : e.gone) ?? []), B = (e == null ? void 0 : e.moving) ?? /* @__PURE__ */ new Map();
61
+ return {
62
+ groups: k,
63
+ isGone: (o) => b.has(o),
64
+ movingTo: (o) => B.get(o) ?? null,
65
+ holding: a
66
+ };
67
+ }
68
+ const R = 280, $ = 60;
69
+ function x(t, n, i = $) {
70
+ const s = [];
71
+ for (const [u, c] of n) {
72
+ const f = t.get(u);
73
+ if (f == null) continue;
74
+ const l = f - c;
75
+ Math.abs(l) > 1 && s.push({ key: u, dy: l });
76
+ }
77
+ return s.length > i ? [] : s;
78
+ }
79
+ function E(t) {
80
+ const n = /* @__PURE__ */ new Map(), i = t.getBoundingClientRect().top;
81
+ for (const s of t.querySelectorAll("[data-row-key]")) {
82
+ const u = s.getAttribute("data-row-key");
83
+ u != null && !n.has(u) && n.set(u, s.getBoundingClientRect().top - i);
84
+ }
85
+ return n;
86
+ }
87
+ function N(t, n, i = {}) {
88
+ const s = K(null), u = i.enabled !== !1;
89
+ A(() => {
90
+ const c = t.current;
91
+ if (!c || !u) {
92
+ s.current = null;
93
+ return;
94
+ }
95
+ const f = s.current;
96
+ if (f && f.sig === n && f.reset === i.resetKey) return;
97
+ const l = E(c);
98
+ if (s.current = { sig: n, reset: i.resetKey, tops: l }, !f || f.reset !== i.resetKey || !O()) return;
99
+ const g = x(f.tops, l);
100
+ if (g.length === 0) return;
101
+ const p = [];
102
+ for (const { key: r, dy: e } of g) {
103
+ const a = typeof CSS < "u" && CSS.escape ? CSS.escape(r) : r, y = c.querySelector(`[data-row-key="${a}"]`);
104
+ y && (y.style.transition = "none", y.style.transform = `translateY(${e}px)`, p.push(y));
105
+ }
106
+ c.offsetHeight;
107
+ for (const r of p)
108
+ r.style.transition = `transform ${R}ms cubic-bezier(0.22, 1, 0.36, 1)`, r.style.transform = "";
109
+ setTimeout(() => {
110
+ for (const r of p) r.style.transition = "";
111
+ }, R + 40);
112
+ });
113
+ }
114
+ export {
115
+ $ as GLIDE_MAX_ROWS,
116
+ R as GLIDE_MS,
117
+ x as glideMoves,
118
+ I as movingRowTitle,
119
+ T as planGroupHold,
120
+ N as useRowGlide,
121
+ X as useSteadyGroups
122
+ };
@@ -0,0 +1,162 @@
1
+ import { useQueryClient as S } from "@tanstack/react-query";
2
+ import { useEffect as _ } from "react";
3
+ import { expandCoalesced as A } from "./live.js";
4
+ import { useOptionalRealtime as w } from "./realtime.js";
5
+ const O = /* @__PURE__ */ new Set([
6
+ "cbv-relation-item",
7
+ "relation-single",
8
+ "rel-display",
9
+ "relation-grouped-single",
10
+ "relation-item"
11
+ ]), T = [
12
+ "collection-meta",
13
+ "cbv-collection-meta",
14
+ "col-meta",
15
+ "collection-display-meta",
16
+ "collection-meta-alias",
17
+ "collection-meta-cr"
18
+ ], C = 800, E = 30;
19
+ function b(n, e, o) {
20
+ var f;
21
+ const t = [], i = n[0];
22
+ if (typeof i == "string" && O.has(i)) {
23
+ const u = n[1], r = n[2];
24
+ typeof u == "string" && u && r != null && r !== "" && t.push({ collection: u, ids: [String(r)] });
25
+ }
26
+ if (i === "cbv-resolved" && e && typeof e == "object") {
27
+ const u = e;
28
+ for (const [r, a] of Object.entries(u.targets ?? {})) {
29
+ if (!a || a.startsWith("nivaro_") || a.startsWith("directus_")) continue;
30
+ const h = /* @__PURE__ */ new Set();
31
+ for (const s of Object.values(u.rows ?? {}))
32
+ for (const c of ((f = s == null ? void 0 : s[r]) == null ? void 0 : f.ids) ?? []) c != null && h.add(String(c));
33
+ const g = r.split(".").pop();
34
+ t.push({
35
+ collection: a,
36
+ ids: [...h],
37
+ ...g && r.includes(".") ? { fields: [g] } : {}
38
+ });
39
+ }
40
+ }
41
+ const l = o == null ? void 0 : o.linkLabels;
42
+ if (Array.isArray(l))
43
+ for (const u of l) {
44
+ const r = u;
45
+ r && typeof r.collection == "string" && r.collection && t.push(r);
46
+ }
47
+ return t;
48
+ }
49
+ function M(n) {
50
+ if (!n) return null;
51
+ const e = /* @__PURE__ */ new Set();
52
+ for (const o of n.matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) e.add(o[1].split(".")[0]);
53
+ return e.size ? [...e] : null;
54
+ }
55
+ function L(n, e, o) {
56
+ const t = e == null || e === "*" ? "*" : String(e), i = n.get(t);
57
+ if (o === null || i === null) {
58
+ n.set(t, null);
59
+ return;
60
+ }
61
+ const l = i ?? /* @__PURE__ */ new Set();
62
+ for (const f of o) l.add(f);
63
+ n.set(t, l);
64
+ }
65
+ function j(n, e, o) {
66
+ const t = n.fields ?? o, i = (l) => l !== void 0 && (l === null || !t || t.some((f) => l.has(f)));
67
+ return i(e.get("*")) ? !0 : n.ids ? n.ids.some((l) => i(e.get(l))) : [...e.values()].some(i);
68
+ }
69
+ function F(n) {
70
+ const e = n.changed_fields;
71
+ return !Array.isArray(e) || e.length === 0 ? null : e.map(String).filter((o) => !o.startsWith("$"));
72
+ }
73
+ function Q(n, e) {
74
+ for (const o of T) {
75
+ const t = n.getQueryData([o, e]);
76
+ if (t && typeof t == "object" && "display_template" in t)
77
+ return M(t.display_template ?? null);
78
+ }
79
+ return null;
80
+ }
81
+ const R = (n) => n.getObserversCount() > 0;
82
+ function W(n, e) {
83
+ const o = n.getQueryCache(), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
84
+ let l = null, f = null;
85
+ const u = () => {
86
+ l = null;
87
+ const s = [...i.entries()];
88
+ if (i.clear(), s.length === 0) return;
89
+ const c = new Map(s), d = new Map(s.map(([m]) => [m, Q(n, m)]));
90
+ n.invalidateQueries({
91
+ predicate: (m) => b(m.queryKey, m.state.data, m.meta).some((y) => {
92
+ const v = c.get(y.collection);
93
+ return !!v && j(y, v, d.get(y.collection) ?? null);
94
+ })
95
+ });
96
+ }, r = (s) => {
97
+ for (const c of A(s)) {
98
+ const d = String(c.collection ?? "");
99
+ if (!d || !t.has(d)) continue;
100
+ const m = F(c);
101
+ if (m && m.length === 0) continue;
102
+ const y = i.get(d) ?? /* @__PURE__ */ new Map();
103
+ L(y, c.item, m), i.set(d, y);
104
+ }
105
+ i.size > 0 && !l && (l = setTimeout(u, C));
106
+ }, a = () => {
107
+ f = null;
108
+ const s = /* @__PURE__ */ new Set();
109
+ for (const c of o.getAll())
110
+ if (R(c))
111
+ for (const d of b(c.queryKey, c.state.data, c.meta))
112
+ s.size >= E && !s.has(d.collection) || s.add(d.collection);
113
+ for (const [c, d] of t)
114
+ s.has(c) || (d(), t.delete(c));
115
+ for (const c of s) t.has(c) || t.set(c, e.subscribeCollections([c], r));
116
+ }, h = () => {
117
+ f || (f = setTimeout(a, 250));
118
+ }, g = o.subscribe((s) => {
119
+ (s.type === "added" || s.type === "removed" || s.type === "observerAdded" || s.type === "observerRemoved" || s.type === "observerOptionsUpdated" || s.type === "updated" && s.action.type === "success") && h();
120
+ });
121
+ return h(), () => {
122
+ g(), l && clearTimeout(l), f && clearTimeout(f);
123
+ for (const s of t.values()) s();
124
+ t.clear(), i.clear();
125
+ };
126
+ }
127
+ let p = null;
128
+ function K(n = !0) {
129
+ const e = S(), o = w();
130
+ _(() => {
131
+ if (!n || !o) return;
132
+ p && (p.qc !== e || p.realtime !== o) && (p.stop(), p = null), p || (p = { qc: e, realtime: o, stop: W(e, o), refs: 0 }), p.refs++;
133
+ const t = p;
134
+ return () => {
135
+ p === t && (t.refs--, t.refs <= 0 && (t.stop(), p = null));
136
+ };
137
+ }, [e, o, n]);
138
+ }
139
+ function P(n, e, o, t) {
140
+ const i = [];
141
+ for (const l of e) {
142
+ const [f, u] = l.split(".");
143
+ if (!f || !u) continue;
144
+ const r = t.find(
145
+ (g) => g.many_collection === n && g.many_field === f && g.one_collection
146
+ ), a = o == null ? void 0 : o[f], h = a != null && typeof a == "object" ? a.id : a;
147
+ !(r != null && r.one_collection) || h == null || h === "" || i.push({ collection: r.one_collection, ids: [String(h)], fields: [u] });
148
+ }
149
+ return i;
150
+ }
151
+ export {
152
+ C as FLUSH_MS,
153
+ O as LABEL_PREFIXES,
154
+ E as MAX_WATCHED,
155
+ L as addChange,
156
+ j as depTouched,
157
+ b as depsOfQuery,
158
+ P as linkDepsOfPaths,
159
+ F as realFields,
160
+ M as templateFields,
161
+ K as useLiveLinkLabels
162
+ };