@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,333 @@
1
+ import { useRef as v, useState as k, useLayoutEffect as Y, useEffect as R, useCallback as U } from "react";
2
+ import { useLiveBusy as H, liveMotionAllowed as j } from "./live-preference.js";
3
+ const D = (t, n) => t ? typeof t == "function" ? t(n) : t.has(n) : !1;
4
+ function q(t, n, e, s) {
5
+ const c = /* @__PURE__ */ new Map();
6
+ for (const o of n) c.set(e(o), o);
7
+ const r = (o) => !D(s.released, o) && (D(s.held, o) || !D(s.mayLeave, o));
8
+ if (s.frozen) {
9
+ const o = [], d = /* @__PURE__ */ new Set();
10
+ for (const u of t) {
11
+ d.add(u.key);
12
+ const l = c.get(u.key);
13
+ l !== void 0 ? o.push({ key: u.key, row: l, state: "live" }) : D(s.released, u.key) || o.push({ key: u.key, row: u.row, state: "departed" });
14
+ }
15
+ for (const u of n) {
16
+ const l = e(u);
17
+ d.has(l) || o.push({ key: l, row: u, state: "live" });
18
+ }
19
+ return o;
20
+ }
21
+ const i = n.map((o) => ({ key: e(o), row: o, state: "live" })), a = [];
22
+ let y = null;
23
+ for (const o of t)
24
+ !c.has(o.key) && r(o.key) && a.push({ row: { key: o.key, row: o.row, state: "departed" }, after: y }), y = o.key;
25
+ for (const o of a) {
26
+ const d = o.after == null ? -1 : i.findIndex((u) => u.key === o.after);
27
+ if (d < 0 && o.after != null) {
28
+ const u = t.slice(
29
+ 0,
30
+ t.findIndex((f) => f.key === o.row.key)
31
+ );
32
+ let l = -1;
33
+ for (let f = u.length - 1; f >= 0 && l < 0; f--)
34
+ l = i.findIndex((g) => g.key === u[f].key);
35
+ i.splice(l + 1, 0, o.row);
36
+ } else i.splice(d + 1, 0, o.row);
37
+ }
38
+ return i;
39
+ }
40
+ function ue(t, n, e = {}) {
41
+ const s = e.enabled !== !1, c = v(n);
42
+ c.current = n;
43
+ const [r, i] = k(null), [a, y] = k(!1), [o, d] = k(!1), [u, l] = k(0), f = v(/* @__PURE__ */ new Map()), g = v(0), I = v(/* @__PURE__ */ new Set()), [A, S] = k(0), C = e.held ? [...e.held].sort().join("") : "", [x, p] = k(
44
+ () => (t ?? []).map((m) => ({ key: n(m), row: m, state: "live" }))
45
+ ), E = v(e.resetKey);
46
+ R(() => {
47
+ if (!r) return;
48
+ const m = () => y(!0), w = () => y(!1), b = () => d(!0), T = (_) => {
49
+ const M = _.relatedTarget;
50
+ (!M || !r.contains(M)) && d(!1);
51
+ };
52
+ return r.addEventListener("pointerenter", m), r.addEventListener("pointerleave", w), r.addEventListener("focusin", b), r.addEventListener("focusout", T), () => {
53
+ r.removeEventListener("pointerenter", m), r.removeEventListener("pointerleave", w), r.removeEventListener("focusin", b), r.removeEventListener("focusout", T);
54
+ };
55
+ }, [r]), R(() => {
56
+ if (!s || typeof document > "u") return;
57
+ const m = () => {
58
+ g.current += 1, f.current.size > 0 && l((w) => w + 1);
59
+ };
60
+ return document.addEventListener("pointerdown", m, !0), document.addEventListener("keydown", m, !0), () => {
61
+ document.removeEventListener("pointerdown", m, !0), document.removeEventListener("keydown", m, !0);
62
+ };
63
+ }, [s]);
64
+ const L = H(s), K = s && (a || o || L);
65
+ Y(() => {
66
+ if (t === void 0) return;
67
+ const m = E.current !== e.resetKey;
68
+ if (E.current = e.resetKey, !s || m) {
69
+ f.current.clear();
70
+ const w = t.map((b) => ({ key: c.current(b), row: b, state: "live" }));
71
+ p((b) => O(b, w) ? b : w);
72
+ return;
73
+ }
74
+ p((w) => {
75
+ const b = new Set(e.held ?? []), T = q(w, t, c.current, {
76
+ frozen: K,
77
+ held: b,
78
+ released: I.current,
79
+ mayLeave: (h) => (f.current.get(h) ?? Number.POSITIVE_INFINITY) < g.current
80
+ }), _ = g.current, M = /* @__PURE__ */ new Set();
81
+ for (const h of T)
82
+ h.state === "departed" && (M.add(h.key), f.current.has(h.key) || f.current.set(h.key, _));
83
+ for (const h of [...f.current.keys()])
84
+ M.has(h) || f.current.delete(h);
85
+ const B = new Set(t.map((h) => c.current(h)));
86
+ for (const h of [...I.current]) B.has(h) && I.current.delete(h);
87
+ return O(w, T) ? w : T;
88
+ });
89
+ }, [t, s, K, u, A, C, e.resetKey]);
90
+ const W = U((m) => {
91
+ for (const w of m) I.current.add(String(w));
92
+ S((w) => w + 1);
93
+ }, []);
94
+ return { rows: x, containerRef: i, release: W, frozen: K };
95
+ }
96
+ function O(t, n) {
97
+ if (t.length !== n.length) return !1;
98
+ for (let e = 0; e < t.length; e++)
99
+ if (t[e].key !== n[e].key || t[e].row !== n[e].row || t[e].state !== n[e].state) return !1;
100
+ return !0;
101
+ }
102
+ function V(t, n, e, s) {
103
+ if (t === null || s) return { rows: [...n], held: 0 };
104
+ const c = new Set(t), r = /* @__PURE__ */ new Map();
105
+ for (const d of n) r.set(e(d), d);
106
+ let i = 0, a = !0;
107
+ const y = [];
108
+ for (const d of n) {
109
+ const u = e(d);
110
+ if (c.has(u)) {
111
+ a = !1;
112
+ continue;
113
+ }
114
+ a ? i++ : y.push(d);
115
+ }
116
+ if (a) return { rows: [...n], held: 0 };
117
+ const o = [];
118
+ for (const d of t) {
119
+ const u = r.get(d);
120
+ u !== void 0 && o.push(u);
121
+ }
122
+ return { rows: [...o, ...y], held: i };
123
+ }
124
+ function X(t) {
125
+ if (typeof window > "u") return null;
126
+ let n = (t == null ? void 0 : t.parentElement) ?? null;
127
+ for (; n; ) {
128
+ const e = window.getComputedStyle(n);
129
+ if (/(auto|scroll|overlay)/.test(e.overflowY) && n.scrollHeight > n.clientHeight) return n;
130
+ n = n.parentElement;
131
+ }
132
+ return document.scrollingElement ?? null;
133
+ }
134
+ const G = 24;
135
+ function ae(t, n, e = {}) {
136
+ const s = e.enabled !== !1, c = v(n);
137
+ c.current = n;
138
+ const [r, i] = k(null), [a, y] = k(!0), o = v(null), d = v(e.resetKey), [u, l] = k(0), f = v(/* @__PURE__ */ new Set()), g = v(null);
139
+ R(() => {
140
+ if (!r) return;
141
+ const p = X(r);
142
+ if (g.current = p, !p) return;
143
+ const E = p === document.scrollingElement || p === document.documentElement ? window : p, L = () => y(p.scrollTop <= G);
144
+ return L(), E.addEventListener("scroll", L, { passive: !0 }), () => E.removeEventListener("scroll", L);
145
+ }, [r]);
146
+ const I = U(() => l((p) => p + 1), []), A = J(g, y, I);
147
+ d.current !== e.resetKey && (d.current = e.resetKey, o.current = null);
148
+ let S;
149
+ if (t === void 0) S = { rows: [], held: 0 };
150
+ else if (s)
151
+ S = V(o.current, t, c.current, a);
152
+ else return o.current = null, f.current = F, { rows: [...t], held: 0, reveal: A, rootRef: i, arrived: F };
153
+ const C = S.rows.map((p) => c.current(p)), x = o.current;
154
+ if (t !== void 0) {
155
+ if (x) {
156
+ const p = new Set(x), E = C.filter((L) => !p.has(L));
157
+ E.length > 0 && (f.current = new Set(E));
158
+ } else f.current = F;
159
+ o.current = C;
160
+ }
161
+ return {
162
+ rows: S.rows,
163
+ held: S.held,
164
+ reveal: A,
165
+ rootRef: i,
166
+ arrived: f.current
167
+ };
168
+ }
169
+ const F = /* @__PURE__ */ new Set();
170
+ function J(t, n, e) {
171
+ return U(() => {
172
+ var r;
173
+ const s = t.current;
174
+ let c = !0;
175
+ try {
176
+ c = !((r = window.matchMedia) != null && r.call(window, "(prefers-reduced-motion: reduce)").matches);
177
+ } catch {
178
+ }
179
+ s == null || s.scrollTo({ top: 0, behavior: c ? "smooth" : "auto" }), n(!0), e();
180
+ }, [t, n, e]);
181
+ }
182
+ const z = 2e3, Q = 1500;
183
+ function Z() {
184
+ 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" };
185
+ }
186
+ function ee() {
187
+ var t;
188
+ return typeof document > "u" ? !1 : document.visibilityState === "hidden" || ((t = document.hasFocus) == null ? void 0 : t.call(document)) === !1;
189
+ }
190
+ function te(t, n) {
191
+ if (t.querySelector("[data-live-new-dot]")) return;
192
+ typeof getComputedStyle == "function" && getComputedStyle(t).position === "static" && (t.style.position = "relative");
193
+ const e = document.createElement("span");
194
+ e.setAttribute("data-live-new-dot", ""), e.setAttribute("aria-hidden", "true"), e.style.cssText = `position:absolute;left:3px;top:6px;width:6px;height:6px;border-radius:9999px;background:${n};pointer-events:none;z-index:1`, t.appendChild(e);
195
+ const s = () => {
196
+ e.remove(), c == null || c.disconnect(), document.removeEventListener("visibilitychange", r);
197
+ };
198
+ let c = null;
199
+ const r = () => {
200
+ if (document.visibilityState === "visible") {
201
+ if (typeof IntersectionObserver > "u") return s();
202
+ c == null || c.disconnect(), c = new IntersectionObserver(
203
+ (i) => {
204
+ i.some((a) => a.isIntersecting && a.intersectionRatio >= 0.5) && s();
205
+ },
206
+ { threshold: [0.5] }
207
+ ), c.observe(t);
208
+ }
209
+ };
210
+ document.addEventListener("visibilitychange", r), r();
211
+ }
212
+ function de(t, n) {
213
+ if (!t || typeof window > "u") return;
214
+ const e = Z(), s = ee();
215
+ for (const c of n) {
216
+ const r = typeof CSS < "u" && CSS.escape ? CSS.escape(c) : c.replace(/"/g, '\\"'), i = t.querySelector(`[data-live-key="${r}"]`);
217
+ if (!i) continue;
218
+ if (s) {
219
+ te(i, e.dot);
220
+ continue;
221
+ }
222
+ if (typeof i.animate != "function") continue;
223
+ N() || i.animate(
224
+ [
225
+ { opacity: 0.7, transform: "translateY(-6px)" },
226
+ { opacity: 1, transform: "none" }
227
+ ],
228
+ { duration: 160, easing: "cubic-bezier(0.16, 1, 0.3, 1)" }
229
+ );
230
+ const a = z + Q;
231
+ i.animate(
232
+ [
233
+ { backgroundColor: e.fill },
234
+ { backgroundColor: e.fill, offset: z / a },
235
+ { backgroundColor: "rgba(0, 0, 0, 0)" }
236
+ ],
237
+ { duration: a, easing: "linear" }
238
+ );
239
+ }
240
+ }
241
+ function N() {
242
+ return !j();
243
+ }
244
+ const ne = 'input, textarea, select, [contenteditable="true"], [contenteditable=""], [data-live-nofade]', re = 60;
245
+ function oe(t, n, e = typeof document > "u" ? null : document.activeElement) {
246
+ const s = /* @__PURE__ */ new Set(), c = (r) => {
247
+ if (!(!r || r === t || !t.contains(r) || s.size >= re) && !r.closest(ne) && !(e && e !== document.body && (r.contains(e) || e.contains(r)))) {
248
+ for (const i of s) if (i.contains(r)) return;
249
+ for (const i of [...s]) r.contains(i) && s.delete(i);
250
+ s.add(r);
251
+ }
252
+ };
253
+ for (const r of n)
254
+ if (r.type === "characterData") c(r.target.parentElement);
255
+ else if (r.type === "childList") {
256
+ const i = r.target;
257
+ let a = !1;
258
+ for (const y of Array.from(r.addedNodes))
259
+ y.nodeType === 1 ? c(y) : y.nodeType === 3 && (y.textContent ?? "").trim() && (a = !0);
260
+ a && c(i.nodeType === 1 ? i : i.parentElement);
261
+ }
262
+ return [...s];
263
+ }
264
+ const $ = 600;
265
+ function P(t) {
266
+ for (const n of t) {
267
+ const e = n;
268
+ !e.isConnected || typeof e.animate != "function" || e.animate([{ opacity: 0.25 }, { opacity: 1 }], { duration: 700, easing: "ease-out" });
269
+ }
270
+ }
271
+ function fe(t, n = {}) {
272
+ const e = n.enabled !== !1, s = n.windowMs ?? 1200, c = v(0), r = v(!0), i = v([]), [a, y] = k(null);
273
+ return Y(() => {
274
+ if (r.current) {
275
+ r.current = !1;
276
+ return;
277
+ }
278
+ if (t == null || t === 0 || t === !1) return;
279
+ const o = Date.now();
280
+ if (c.current = o + s, N()) {
281
+ i.current = [];
282
+ return;
283
+ }
284
+ const d = /* @__PURE__ */ new Set();
285
+ for (const u of i.current)
286
+ if (!(o - u.at > $))
287
+ for (const l of u.targets) d.add(l);
288
+ i.current = [], P([...d]);
289
+ }, [t, s]), R(() => {
290
+ if (!e || !a || typeof MutationObserver > "u") return;
291
+ const o = new MutationObserver((d) => {
292
+ const u = Date.now(), l = oe(a, d);
293
+ if (l.length === 0) return;
294
+ if (u <= c.current) {
295
+ N() || P(l);
296
+ return;
297
+ }
298
+ const f = i.current.filter((g) => u - g.at <= $);
299
+ f.push({ at: u, targets: l }), i.current = f.slice(-20);
300
+ });
301
+ return o.observe(a, { subtree: !0, childList: !0, characterData: !0 }), () => {
302
+ o.disconnect(), i.current = [];
303
+ };
304
+ }, [a, e]), y;
305
+ }
306
+ function se(t, n = Date.now()) {
307
+ if (!t) return null;
308
+ const e = Math.max(0, Math.round((n - t) / 1e3));
309
+ 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`;
310
+ }
311
+ function le(t, n) {
312
+ const [e, s] = k(() => Date.now());
313
+ return R(() => {
314
+ if (!n) return;
315
+ s(Date.now());
316
+ const c = setInterval(() => s(Date.now()), 5e3);
317
+ return () => clearInterval(c);
318
+ }, [n]), se(t, e);
319
+ }
320
+ export {
321
+ Q as NEW_ROW_FADE_MS,
322
+ z as NEW_ROW_HOLD_MS,
323
+ oe as fadeTargets,
324
+ V as holdTopInserts,
325
+ X as scrollParentOf,
326
+ q as settleRows,
327
+ de as slideIn,
328
+ se as updatedAgoLabel,
329
+ fe as useLiveFade,
330
+ ue as useSettledRows,
331
+ ae as useTopInserts,
332
+ le as useUpdatedAgo
333
+ };
@@ -0,0 +1,108 @@
1
+ import { useState as O, useRef as r, useMemo as U, useEffect as k, useCallback as D } from "react";
2
+ import { useLiveCollection as j } from "./live.js";
3
+ import { flashRows as q } from "./live-list.js";
4
+ function S(e) {
5
+ return `${e.collection}:${String(e.id).toUpperCase()}`;
6
+ }
7
+ function B(e, m, a, f) {
8
+ const g = new Map(m.map((t) => [S(t), t])), w = new Set(e.map(S)), y = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set();
9
+ for (const t of f != null ? e.slice(0, f) : e) {
10
+ const c = S(t), s = g.get(c);
11
+ s ? JSON.stringify(s) !== JSON.stringify(t) && y.set(c, s) : a !== "any" && a.has(c) && v.add(c);
12
+ }
13
+ const h = /* @__PURE__ */ new Map();
14
+ for (const [t, c] of g)
15
+ w.has(t) || (a === "any" || a.has(t)) && h.set(t, c);
16
+ return { updated: y, gone: v, added: h };
17
+ }
18
+ function V(e) {
19
+ return `${e} new ${e === 1 ? "match" : "matches"}`;
20
+ }
21
+ const G = 500;
22
+ function X(e) {
23
+ const { rows: m, resetKey: a, enabled: f = !0, detectNew: g = !0 } = e, [w, y] = O(() => /* @__PURE__ */ new Map()), [v, h] = O(() => /* @__PURE__ */ new Set()), [t, c] = O(() => /* @__PURE__ */ new Set()), s = r(/* @__PURE__ */ new Set()), l = r(!1), d = r(null), z = r(!1), x = r(!1), E = r(0), M = r(!0), R = r([]), L = r(() => {
24
+ }), C = U(
25
+ () => w.size === 0 ? m : m.map((n) => w.get(S(n)) ?? n),
26
+ [m, w]
27
+ ), N = r(C);
28
+ N.current = C;
29
+ const o = r(e);
30
+ o.current = e, k(() => {
31
+ y(/* @__PURE__ */ new Map()), h(/* @__PURE__ */ new Set()), c(/* @__PURE__ */ new Set()), s.current.clear(), l.current = !1;
32
+ }, [a]);
33
+ const T = D(async () => {
34
+ if (d.current = null, z.current) {
35
+ x.current = !0;
36
+ return;
37
+ }
38
+ if (typeof document < "u" && document.hidden) return;
39
+ const n = l.current ? "any" : new Set(s.current);
40
+ s.current.clear(), l.current = !1, z.current = !0, E.current = Date.now();
41
+ try {
42
+ const i = await o.current.fetchFresh();
43
+ if (!M.current) return;
44
+ const u = B(N.current, i, n, o.current.windowSize);
45
+ u.updated.size > 0 && (y((p) => {
46
+ const $ = new Map(p);
47
+ for (const [F, J] of u.updated) $.set(F, J);
48
+ return $;
49
+ }), R.current.push(...u.updated.keys())), u.gone.size > 0 && h((p) => /* @__PURE__ */ new Set([...p, ...u.gone])), u.added.size > 0 && o.current.detectNew !== !1 && c((p) => /* @__PURE__ */ new Set([...p, ...u.added.keys()]));
50
+ } catch {
51
+ } finally {
52
+ z.current = !1, x.current && M.current && (x.current = !1, L.current());
53
+ }
54
+ }, []), b = D(() => {
55
+ if (d.current) return;
56
+ const n = Math.max(0, E.current + (o.current.minGapMs ?? 4e3) - Date.now());
57
+ d.current = setTimeout(() => void T(), n);
58
+ }, [T]);
59
+ L.current = b;
60
+ const K = [...new Set(e.collections)].sort().join(",");
61
+ j(
62
+ K ? K.split(",") : null,
63
+ (n) => {
64
+ if (!n.aspectsOnly) {
65
+ for (const i of n.events)
66
+ i.item === "*" ? l.current = !0 : s.current.size < G ? s.current.add(
67
+ S({ collection: String(i.collection), id: String(i.item) })
68
+ ) : l.current = !0;
69
+ b();
70
+ }
71
+ },
72
+ { debounceMs: 1e3, enabled: f && K !== "", focusable: !0 }
73
+ ), k(() => {
74
+ if (!f) return;
75
+ const n = () => {
76
+ !document.hidden && (s.current.size > 0 || l.current) && b();
77
+ };
78
+ return document.addEventListener("visibilitychange", n), () => document.removeEventListener("visibilitychange", n);
79
+ }, [f, b]), k(() => (M.current = !0, () => {
80
+ M.current = !1, d.current && clearTimeout(d.current), d.current = null;
81
+ }), []), k(() => {
82
+ if (R.current.length === 0) return;
83
+ const n = R.current;
84
+ R.current = [];
85
+ const i = requestAnimationFrame(
86
+ () => {
87
+ var u;
88
+ return q(((u = o.current.rootRef) == null ? void 0 : u.current) ?? document, n);
89
+ }
90
+ );
91
+ return () => cancelAnimationFrame(i);
92
+ });
93
+ const A = D(() => {
94
+ c(/* @__PURE__ */ new Set()), o.current.onShow();
95
+ }, []);
96
+ return {
97
+ rows: C,
98
+ dimmed: v,
99
+ newCount: g ? t.size : 0,
100
+ show: A
101
+ };
102
+ }
103
+ export {
104
+ V as newMatchesText,
105
+ B as reconcileSearch,
106
+ S as searchRowKey,
107
+ X as useLiveSearchResults
108
+ };
@@ -0,0 +1,35 @@
1
+ const c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), s = (t, n) => `${t}\0${String(n)}`;
2
+ function r(t, n, o) {
3
+ if (t.delete(n), t.set(n, o), t.size > 5e3) {
4
+ const e = t.keys().next().value;
5
+ e !== void 0 && t.delete(e);
6
+ }
7
+ }
8
+ function u(t, n, o = Date.now()) {
9
+ if (!n || typeof n != "object") return;
10
+ const e = n;
11
+ if (typeof e.collection != "string" || !e.collection) return;
12
+ const i = e.collection;
13
+ if (e.coalesced) {
14
+ if (e.many || !Array.isArray(e.items)) {
15
+ r(l, i, o);
16
+ return;
17
+ }
18
+ for (const f of e.items.slice(0, 500))
19
+ f != null && r(c, s(i, f), o);
20
+ return;
21
+ }
22
+ if (e.item == null || e.item === "*") {
23
+ r(l, i, o);
24
+ return;
25
+ }
26
+ r(c, s(i, e.item), o);
27
+ }
28
+ function d(t, n) {
29
+ const o = c.get(s(t, n)), e = l.get(t);
30
+ return o == null && e == null ? null : Math.max(o ?? 0, e ?? 0);
31
+ }
32
+ export {
33
+ d as lastLiveSeen,
34
+ u as noteLiveSeen
35
+ };
@@ -0,0 +1,100 @@
1
+ import { useQueryClient as y } from "@tanstack/react-query";
2
+ import { useRef as l, useEffect as v, useCallback as k, useState as h } from "react";
3
+ import { useLiveCollection as L, useLiveWatchRoom as M, useLiveEvent as R } from "./live.js";
4
+ import { createCoalescer as g } from "./live-counts.js";
5
+ import { useSettledRows as q, useLiveFade as w } from "./live-screen.js";
6
+ function x(e, n, r) {
7
+ return n ? e.resetKey !== r || e.first == null ? { arm: 0, state: { resetKey: r, first: n } } : { arm: n === e.first ? 0 : n, state: e } : { arm: 0, state: e };
8
+ }
9
+ function E(e, n = "") {
10
+ const r = l({ resetKey: n, first: null }), { arm: i, state: c } = x(r.current, e ?? 0, n);
11
+ return r.current = c, i;
12
+ }
13
+ function C(e, n) {
14
+ return e.aspectsOnly ? !1 : !n || n.length === 0 || e.changedFields === null ? !0 : e.changedFields.some((r) => n.includes(r));
15
+ }
16
+ function T(e) {
17
+ const n = y(), r = e.enabled !== !1, i = l(e.keys);
18
+ i.current = e.keys;
19
+ const c = l(e.fields);
20
+ c.current = e.fields;
21
+ const u = Math.max(1e3, e.quietMs ?? 1500), m = e.maxWaitMs ?? 8e3, f = l(null);
22
+ v(() => {
23
+ if (!r) return;
24
+ const t = g(
25
+ () => {
26
+ for (const b of i.current)
27
+ n.invalidateQueries({ queryKey: b, refetchType: "active" });
28
+ },
29
+ { quietMs: u, maxWaitMs: m }
30
+ );
31
+ f.current = t;
32
+ const d = () => t.resume();
33
+ return document.addEventListener("visibilitychange", d), () => {
34
+ document.removeEventListener("visibilitychange", d), t.cancel(), f.current = null;
35
+ };
36
+ }, [n, r, u, m]), L(
37
+ e.collection,
38
+ (t) => {
39
+ var d;
40
+ C(t, c.current) && ((d = f.current) == null || d.poke());
41
+ },
42
+ { debounceMs: 300, enabled: r, focusable: !0 }
43
+ );
44
+ const o = q(e.items, e.keyOf, { enabled: r, resetKey: e.resetKey }), s = w(E(e.updatedAt, e.resetKey), { enabled: r }), a = k(
45
+ (t) => {
46
+ o.containerRef(t), s(t);
47
+ },
48
+ [o.containerRef, s]
49
+ );
50
+ return { entries: o.rows, ref: a };
51
+ }
52
+ function W(e) {
53
+ return !!e && e.progress == null;
54
+ }
55
+ function j(e) {
56
+ const n = y(), r = e.enabled !== !1, i = M("jobs", r), c = l(e.keys);
57
+ c.current = e.keys;
58
+ const u = l(e.onProgress);
59
+ u.current = e.onProgress;
60
+ const m = e.quietMs ?? 1e3, f = e.maxWaitMs ?? 5e3, o = l(null);
61
+ return v(() => {
62
+ if (!r) return;
63
+ const s = g(
64
+ () => {
65
+ for (const t of c.current)
66
+ n.invalidateQueries({ queryKey: t, refetchType: "active" });
67
+ },
68
+ { quietMs: m, maxWaitMs: f }
69
+ );
70
+ o.current = s;
71
+ const a = () => s.resume();
72
+ return document.addEventListener("visibilitychange", a), () => {
73
+ document.removeEventListener("visibilitychange", a), s.cancel(), o.current = null;
74
+ };
75
+ }, [n, r, m, f]), R(
76
+ "job:update",
77
+ (s) => {
78
+ var a, t;
79
+ W(s) ? (a = o.current) == null || a.poke() : s.progress && ((t = u.current) == null || t.call(u, { id: s.id, progress: s.progress }));
80
+ },
81
+ { includeOwn: !0, enabled: r }
82
+ ), i;
83
+ }
84
+ function D(e = 3e4, n = !0) {
85
+ const [r, i] = h(() => Date.now());
86
+ return v(() => {
87
+ if (!n) return;
88
+ const c = setInterval(() => i(Date.now()), e);
89
+ return () => clearInterval(c);
90
+ }, [e, n]), r;
91
+ }
92
+ export {
93
+ x as backgroundArm,
94
+ C as calendarBatchMatters,
95
+ W as isJobBoundary,
96
+ E as useBackgroundArm,
97
+ T as useLiveCalendar,
98
+ j as useLiveJobs,
99
+ D as useNowTick
100
+ };