@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.
- package/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1727 -19
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +544 -504
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/cbv/column-totals.js +75 -67
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
- package/dist/shared/components/queue/queue-totals.js +92 -0
- package/dist/shared/components/queue/worklist-helpers.js +18 -14
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-link.js +56 -50
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createContext as p, useCallback as d, useContext as m, useSyncExternalStore as b } from "react";
|
|
2
|
+
import { useItemNavigation as k } from "../context.js";
|
|
3
|
+
const w = p(null);
|
|
4
|
+
let l = null;
|
|
5
|
+
const i = /* @__PURE__ */ new Set();
|
|
6
|
+
function x(e) {
|
|
7
|
+
l = e;
|
|
8
|
+
for (const t of i) t();
|
|
9
|
+
return () => {
|
|
10
|
+
if (l === e) {
|
|
11
|
+
l = null;
|
|
12
|
+
for (const t of i) t();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const I = (e) => (i.add(e), () => {
|
|
17
|
+
i.delete(e);
|
|
18
|
+
});
|
|
19
|
+
function S() {
|
|
20
|
+
const e = m(w), t = b(
|
|
21
|
+
I,
|
|
22
|
+
() => l,
|
|
23
|
+
() => null
|
|
24
|
+
);
|
|
25
|
+
return e ?? t;
|
|
26
|
+
}
|
|
27
|
+
function _(e) {
|
|
28
|
+
return !!e && (!!e.metaKey || !!e.ctrlKey || !!e.shiftKey || e.button === 1);
|
|
29
|
+
}
|
|
30
|
+
function c(e) {
|
|
31
|
+
return !!e && !/^(nivaro_|directus_)/i.test(e) && e !== "__chat__";
|
|
32
|
+
}
|
|
33
|
+
function C(e, t, o) {
|
|
34
|
+
return _(e) ? "new-tab" : t && c(o) ? "peek" : "navigate";
|
|
35
|
+
}
|
|
36
|
+
function y() {
|
|
37
|
+
const e = S(), { open: t, urlFor: o } = k();
|
|
38
|
+
return d(
|
|
39
|
+
(r, n, a) => {
|
|
40
|
+
var s, f;
|
|
41
|
+
const u = C(n, !!e, r.collection);
|
|
42
|
+
return u === "new-tab" ? ((s = n == null ? void 0 : n.preventDefault) == null || s.call(n), window.open(
|
|
43
|
+
o({ collection: r.collection, itemId: r.itemId }),
|
|
44
|
+
"_blank",
|
|
45
|
+
"noopener"
|
|
46
|
+
)) : u === "peek" && e ? ((f = n == null ? void 0 : n.preventDefault) == null || f.call(n), e.open(r, a)) : t({ collection: r.collection, itemId: r.itemId }), u;
|
|
47
|
+
},
|
|
48
|
+
[e, t, o]
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function P(e, t, o) {
|
|
52
|
+
return t <= 0 || e < 0 ? null : o === "ArrowDown" ? e < t - 1 ? e + 1 : null : o === "ArrowUp" && e > 0 ? e - 1 : null;
|
|
53
|
+
}
|
|
54
|
+
function h(e) {
|
|
55
|
+
const t = e.target ?? null;
|
|
56
|
+
return t ? t.kind !== "record" && t.kind !== "sla" || t.focus || t.tab || t.query || !t.collection || t.id == null || !c(t.collection) ? null : { collection: t.collection, itemId: String(t.id), title: e.subject ?? null } : !e.collection || e.item == null || String(e.item) === "" || !c(e.collection) ? null : { collection: e.collection, itemId: String(e.item), title: e.subject ?? null };
|
|
57
|
+
}
|
|
58
|
+
function D(e) {
|
|
59
|
+
const t = e;
|
|
60
|
+
return !t || typeof t.closest != "function" ? !1 : t.isContentEditable ? !0 : !!t.closest(
|
|
61
|
+
'input, textarea, select, [contenteditable="true"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="grid"], [role="slider"], [role="tablist"], [role="radiogroup"], [data-radix-popper-content-wrapper]'
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
w as RecordPeekContext,
|
|
66
|
+
D as arrowsBelongElsewhere,
|
|
67
|
+
_ as isNewTabClick,
|
|
68
|
+
h as notificationPeekTarget,
|
|
69
|
+
C as peekDecision,
|
|
70
|
+
P as peekStep,
|
|
71
|
+
c as peekable,
|
|
72
|
+
x as registerRecordPeekHost,
|
|
73
|
+
y as usePeekOrOpen,
|
|
74
|
+
S as useRecordPeek
|
|
75
|
+
};
|
|
@@ -1,126 +1,146 @@
|
|
|
1
1
|
import { useRef as w, useEffect as R, useState as k } from "react";
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return r ? `${
|
|
2
|
+
const m = "nvr-record-tabs";
|
|
3
|
+
function A(r) {
|
|
4
|
+
return r ? `${m}:${r}` : m;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return r &&
|
|
6
|
+
function S(r, s) {
|
|
7
|
+
return r && s != null && s !== "new" ? `${r}:${s}` : "";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function C() {
|
|
10
10
|
try {
|
|
11
11
|
return crypto.randomUUID();
|
|
12
12
|
} catch {
|
|
13
13
|
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
const l =
|
|
17
|
-
function
|
|
16
|
+
const l = C(), v = /* @__PURE__ */ new Map();
|
|
17
|
+
function $(r, s) {
|
|
18
18
|
if (typeof BroadcastChannel > "u") return null;
|
|
19
|
-
const
|
|
20
|
-
let
|
|
21
|
-
if (!
|
|
22
|
-
let
|
|
19
|
+
const t = A(r);
|
|
20
|
+
let i = v.get(t);
|
|
21
|
+
if (!i) {
|
|
22
|
+
let e;
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
e = new BroadcastChannel(t);
|
|
25
25
|
} catch {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const b =
|
|
28
|
+
const a = /* @__PURE__ */ new Set();
|
|
29
|
+
e.onmessage = (y) => {
|
|
30
|
+
const b = y.data;
|
|
31
31
|
if (!(!b || b.tab === l))
|
|
32
|
-
for (const
|
|
33
|
-
},
|
|
32
|
+
for (const c of a) c(b);
|
|
33
|
+
}, i = { ch: e, listeners: a }, v.set(t, i);
|
|
34
34
|
}
|
|
35
|
-
const { ch:
|
|
36
|
-
return
|
|
37
|
-
post: (
|
|
35
|
+
const { ch: n, listeners: o } = i;
|
|
36
|
+
return o.add(s), {
|
|
37
|
+
post: (e) => {
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
n.postMessage(e);
|
|
40
40
|
} catch {
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
close: () => {
|
|
44
|
-
var
|
|
45
|
-
|
|
44
|
+
var e;
|
|
45
|
+
o.delete(s), o.size === 0 && ((e = v.get(t)) == null ? void 0 : e.ch) === n && (v.delete(t), n.close());
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
function D(r) {
|
|
50
|
+
if (!Array.isArray(r)) return null;
|
|
51
|
+
const s = [
|
|
52
|
+
...new Set(
|
|
53
|
+
r.filter(
|
|
54
|
+
(t) => typeof t == "string" && t.length > 0 && t.length <= 128 && !/^[_$]/.test(t)
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
];
|
|
58
|
+
return s.length > 0 ? s.slice(0, 200) : null;
|
|
59
|
+
}
|
|
60
|
+
function U(r, s, t, i, n) {
|
|
61
|
+
const o = S(t, i);
|
|
62
|
+
if (!o) return;
|
|
63
|
+
const e = $(r, () => {
|
|
64
|
+
}), a = s === "saved" ? D(n) : null;
|
|
65
|
+
e == null || e.post(a ? { type: "saved", tab: l, key: o, fields: a } : { type: s, tab: l, key: o }), e == null || e.close();
|
|
55
66
|
}
|
|
56
|
-
function L(r,
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
67
|
+
function L(r, s, t, i, n) {
|
|
68
|
+
const o = S(t, i);
|
|
69
|
+
if (!o) return () => {
|
|
59
70
|
};
|
|
60
|
-
const
|
|
61
|
-
|
|
71
|
+
const e = $(r, (a) => {
|
|
72
|
+
a.type === s && a.key === o && n({ fields: a.type === "saved" ? D(a.fields) : null });
|
|
62
73
|
});
|
|
63
|
-
return () =>
|
|
74
|
+
return () => e == null ? void 0 : e.close();
|
|
75
|
+
}
|
|
76
|
+
function x(r, s, t, i, n) {
|
|
77
|
+
const o = w(n);
|
|
78
|
+
o.current = n, R(() => {
|
|
79
|
+
if (!(!t || i == null))
|
|
80
|
+
return L(r, s, t, i, (e) => o.current(e));
|
|
81
|
+
}, [r, s, t, i]);
|
|
64
82
|
}
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
83
|
+
function B(r) {
|
|
84
|
+
return r.otherDirty ? r.dirty ? {
|
|
85
|
+
tone: "both",
|
|
86
|
+
// The second save asks about any field changed in both (the conflict path).
|
|
87
|
+
text: "Unsaved changes in another tab too. Save one first."
|
|
88
|
+
} : { tone: "quiet", text: "Also open in another tab — editing there" } : null;
|
|
71
89
|
}
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
90
|
+
function M(r, s, t, i) {
|
|
91
|
+
const n = S(r, s), [o, e] = k([]), a = w(null), y = w(t);
|
|
92
|
+
y.current = t, R(() => {
|
|
93
|
+
if (e([]), !n) return;
|
|
94
|
+
const c = document.title;
|
|
77
95
|
let f = null;
|
|
78
|
-
const h =
|
|
79
|
-
if (u.key ===
|
|
80
|
-
if (u.type === "hello") p({ type: "state", tab: l, key:
|
|
96
|
+
const h = $(i, (u) => {
|
|
97
|
+
if (u.key === n) {
|
|
98
|
+
if (u.type === "hello") p({ type: "state", tab: l, key: n, dirty: y.current });
|
|
81
99
|
else if (u.type === "state")
|
|
82
|
-
|
|
83
|
-
const g =
|
|
100
|
+
e((d) => {
|
|
101
|
+
const g = d.filter((E) => E !== u.tab);
|
|
84
102
|
return u.dirty ? [...g, u.tab] : g;
|
|
85
103
|
});
|
|
86
|
-
else if (u.type === "bye")
|
|
104
|
+
else if (u.type === "bye") e((d) => d.filter((g) => g !== u.tab));
|
|
87
105
|
else if (u.type === "focus" && u.target === l) {
|
|
88
106
|
try {
|
|
89
107
|
window.focus();
|
|
90
108
|
} catch {
|
|
91
109
|
}
|
|
92
110
|
if (document.visibilityState !== "visible") {
|
|
93
|
-
document.title = `● Unsaved changes here — ${
|
|
94
|
-
const
|
|
95
|
-
document.title =
|
|
111
|
+
document.title = `● Unsaved changes here — ${c}`;
|
|
112
|
+
const d = () => {
|
|
113
|
+
document.title = c, document.removeEventListener("visibilitychange", d);
|
|
96
114
|
};
|
|
97
|
-
document.addEventListener("visibilitychange",
|
|
115
|
+
document.addEventListener("visibilitychange", d), f && clearTimeout(f), f = setTimeout(d, 3e4);
|
|
98
116
|
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
});
|
|
102
120
|
if (!h) return;
|
|
103
|
-
|
|
121
|
+
a.current = h;
|
|
104
122
|
const p = h.post;
|
|
105
|
-
p({ type: "hello", tab: l, key:
|
|
106
|
-
const
|
|
107
|
-
return window.addEventListener("pagehide",
|
|
108
|
-
|
|
123
|
+
p({ type: "hello", tab: l, key: n }), p({ type: "state", tab: l, key: n, dirty: y.current });
|
|
124
|
+
const T = () => p({ type: "bye", tab: l, key: n });
|
|
125
|
+
return window.addEventListener("pagehide", T), () => {
|
|
126
|
+
T(), window.removeEventListener("pagehide", T), f && clearTimeout(f), h.close(), a.current = null;
|
|
109
127
|
};
|
|
110
|
-
}, [
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
}, [
|
|
128
|
+
}, [n, i]), R(() => {
|
|
129
|
+
var c;
|
|
130
|
+
n && ((c = a.current) == null || c.post({ type: "state", tab: l, key: n, dirty: t }));
|
|
131
|
+
}, [n, t]);
|
|
114
132
|
const b = () => {
|
|
115
133
|
var f;
|
|
116
|
-
const
|
|
117
|
-
!
|
|
134
|
+
const c = o[o.length - 1];
|
|
135
|
+
!c || !n || (f = a.current) == null || f.post({ type: "focus", tab: l, key: n, target: c });
|
|
118
136
|
};
|
|
119
|
-
return { otherDirty:
|
|
137
|
+
return { otherDirty: o.length > 0, focusOther: b };
|
|
120
138
|
}
|
|
121
139
|
export {
|
|
122
|
-
|
|
140
|
+
U as announceRecordTabs,
|
|
141
|
+
B as otherTabNote,
|
|
142
|
+
D as savedFieldNames,
|
|
123
143
|
L as subscribeRecordTabs,
|
|
124
|
-
|
|
125
|
-
|
|
144
|
+
M as useRecordTabs,
|
|
145
|
+
x as useRecordTabsSignal
|
|
126
146
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback as a, useSyncExternalStore as m } from "react";
|
|
2
|
+
import { formatRelative as b } from "./utils.js";
|
|
3
|
+
const y = 3e4, i = /* @__PURE__ */ new Set();
|
|
4
|
+
let n = null, s = !1;
|
|
5
|
+
function u() {
|
|
6
|
+
for (const t of [...i])
|
|
7
|
+
try {
|
|
8
|
+
t();
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function c() {
|
|
13
|
+
n || i.size === 0 || typeof document < "u" && document.visibilityState === "hidden" || (n = setInterval(u, y));
|
|
14
|
+
}
|
|
15
|
+
function f() {
|
|
16
|
+
n && clearInterval(n), n = null;
|
|
17
|
+
}
|
|
18
|
+
function p() {
|
|
19
|
+
typeof document > "u" || (document.visibilityState === "visible" ? (u(), c()) : f());
|
|
20
|
+
}
|
|
21
|
+
function S(t) {
|
|
22
|
+
return i.add(t), !s && typeof document < "u" && (s = !0, document.addEventListener("visibilitychange", p)), c(), () => {
|
|
23
|
+
i.delete(t), i.size === 0 && f();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function v(t, o) {
|
|
27
|
+
if (t == null || t === "") return !0;
|
|
28
|
+
const e = new Date(t).getTime();
|
|
29
|
+
return Number.isNaN(e) || o - e > 7 * 864e5;
|
|
30
|
+
}
|
|
31
|
+
function h(t, o = (e) => b(e)) {
|
|
32
|
+
const e = () => t == null || t === "" ? "" : o(t), r = v(t, Date.now()), l = a(
|
|
33
|
+
(d) => r ? () => {
|
|
34
|
+
} : S(d),
|
|
35
|
+
[r]
|
|
36
|
+
);
|
|
37
|
+
return m(l, e, e);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
S as subscribeRelativeTick,
|
|
41
|
+
h as useRelativeText
|
|
42
|
+
};
|