@nivaro/react 0.2.53 → 0.2.55
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +452 -4
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +252 -2
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3968 -3618
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +598 -543
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +80 -67
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +382 -320
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +786 -639
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +94 -0
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
- package/dist/shared/components/layout-editor/AddPanel.js +226 -151
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
- package/dist/shared/components/layout-editor/CollabParts.js +175 -0
- package/dist/shared/components/layout-editor/DesignNode.js +311 -116
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
- package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
- package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
- package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +403 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +133 -0
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +116 -110
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/visible-when.js +34 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useRef as E, useEffect as T } from "react";
|
|
2
|
+
import { get as v } from "./commands.js";
|
|
3
|
+
const q = 30, w = 150, R = 3e4;
|
|
4
|
+
let d = [];
|
|
5
|
+
function L(e = Date.now(), t = q) {
|
|
6
|
+
return d = d.filter((r) => e - r < 6e4), d.length >= t ? !1 : (d.push(e), !0);
|
|
7
|
+
}
|
|
8
|
+
function b() {
|
|
9
|
+
if (typeof navigator > "u") return !1;
|
|
10
|
+
const e = navigator.connection;
|
|
11
|
+
return !!(e != null && e.saveData);
|
|
12
|
+
}
|
|
13
|
+
function I(e, t) {
|
|
14
|
+
return {
|
|
15
|
+
item: ["item", e, String(t)],
|
|
16
|
+
layout: ["active-layout", e, null, String(t)]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function S(e, t, r) {
|
|
20
|
+
const n = e.getQueryState(t);
|
|
21
|
+
return n ? n.fetchStatus === "fetching" ? !0 : n.dataUpdatedAt > 0 && r - n.dataUpdatedAt < R : !1;
|
|
22
|
+
}
|
|
23
|
+
function h(e, t, r, n = Date.now()) {
|
|
24
|
+
return b() || S(e, t, n) || !L(n) ? !1 : (e.prefetchQuery({ queryKey: t, queryFn: r, staleTime: R }), !0);
|
|
25
|
+
}
|
|
26
|
+
function P(e, t, r, n, u = {}) {
|
|
27
|
+
if (!r || n == null || n === "" || n === "new") return 0;
|
|
28
|
+
const c = I(r, n);
|
|
29
|
+
let f = 0;
|
|
30
|
+
return h(
|
|
31
|
+
e,
|
|
32
|
+
c.item,
|
|
33
|
+
() => t.request(v(`/items/${r}/${n}`)).then((s) => s.data)
|
|
34
|
+
) && f++, u.layout !== !1 && h(
|
|
35
|
+
e,
|
|
36
|
+
c.layout,
|
|
37
|
+
() => t.request(
|
|
38
|
+
v("/collection-layouts/active", { collection: r, item: String(n) })
|
|
39
|
+
).then((s) => s.data ?? null)
|
|
40
|
+
) && f++, f;
|
|
41
|
+
}
|
|
42
|
+
function _(e, t = 2e3) {
|
|
43
|
+
if (typeof window > "u") return () => {
|
|
44
|
+
};
|
|
45
|
+
const r = window;
|
|
46
|
+
if (r.requestIdleCallback) {
|
|
47
|
+
const u = r.requestIdleCallback(e, { timeout: t });
|
|
48
|
+
return () => {
|
|
49
|
+
var c;
|
|
50
|
+
return (c = r.cancelIdleCallback) == null ? void 0 : c.call(r, u);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const n = setTimeout(e, 300);
|
|
54
|
+
return () => clearTimeout(n);
|
|
55
|
+
}
|
|
56
|
+
function D(e) {
|
|
57
|
+
const t = E(e);
|
|
58
|
+
t.current = e;
|
|
59
|
+
const r = JSON.stringify(e.queryKey);
|
|
60
|
+
T(() => {
|
|
61
|
+
if (e.enabled)
|
|
62
|
+
return _(() => {
|
|
63
|
+
const n = t.current;
|
|
64
|
+
h(n.qc, n.queryKey, n.queryFn);
|
|
65
|
+
});
|
|
66
|
+
}, [e.enabled, r]);
|
|
67
|
+
}
|
|
68
|
+
function k(e, t) {
|
|
69
|
+
const r = e.getAttribute("href");
|
|
70
|
+
if (!r || r.startsWith("#") || e.hasAttribute("download") || e.target && e.target !== "_self") return null;
|
|
71
|
+
try {
|
|
72
|
+
const n = new URL(r, t);
|
|
73
|
+
return n.origin !== t ? null : n.pathname + n.search;
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function p(e) {
|
|
79
|
+
if (typeof document > "u") return () => {
|
|
80
|
+
};
|
|
81
|
+
const t = e.root ?? document, r = window.location.origin;
|
|
82
|
+
let n = null, u = null;
|
|
83
|
+
const c = () => {
|
|
84
|
+
n && clearTimeout(n), n = null, u = null;
|
|
85
|
+
}, f = (l) => {
|
|
86
|
+
var i, g;
|
|
87
|
+
const o = k(l, r);
|
|
88
|
+
if (!o) return;
|
|
89
|
+
try {
|
|
90
|
+
(i = e.preloadRoute) == null || i.call(e, o);
|
|
91
|
+
} catch {
|
|
92
|
+
}
|
|
93
|
+
const a = (g = e.matchRecord) == null ? void 0 : g.call(e, o.split("?")[0]);
|
|
94
|
+
a && e.client && P(e.qc, e.client, a.collection, a.id);
|
|
95
|
+
}, s = (l) => {
|
|
96
|
+
var a, i;
|
|
97
|
+
const o = (i = (a = l.target) == null ? void 0 : a.closest) == null ? void 0 : i.call(a, "a[href]");
|
|
98
|
+
!o || o === u || (c(), u = o, n = setTimeout(() => {
|
|
99
|
+
n = null, f(o);
|
|
100
|
+
}, w));
|
|
101
|
+
}, m = (l) => {
|
|
102
|
+
const o = l.relatedTarget;
|
|
103
|
+
u && o && u.contains(o) || c();
|
|
104
|
+
}, y = (l) => {
|
|
105
|
+
var a, i;
|
|
106
|
+
const o = (i = (a = l.target) == null ? void 0 : a.closest) == null ? void 0 : i.call(a, "a[href]");
|
|
107
|
+
o && f(o);
|
|
108
|
+
};
|
|
109
|
+
return t.addEventListener("pointerover", s, { passive: !0 }), t.addEventListener("pointerout", m, { passive: !0 }), t.addEventListener("focusin", y), () => {
|
|
110
|
+
c(), t.removeEventListener("pointerover", s), t.removeEventListener("pointerout", m), t.removeEventListener("focusin", y);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function K(e) {
|
|
114
|
+
const t = E(e);
|
|
115
|
+
t.current = e;
|
|
116
|
+
const r = e.enabled !== !1;
|
|
117
|
+
T(() => {
|
|
118
|
+
if (r)
|
|
119
|
+
return p({
|
|
120
|
+
qc: t.current.qc,
|
|
121
|
+
get client() {
|
|
122
|
+
return t.current.client;
|
|
123
|
+
},
|
|
124
|
+
matchRecord: (n) => {
|
|
125
|
+
var u, c;
|
|
126
|
+
return ((c = (u = t.current).matchRecord) == null ? void 0 : c.call(u, n)) ?? null;
|
|
127
|
+
},
|
|
128
|
+
preloadRoute: (n) => {
|
|
129
|
+
var u, c;
|
|
130
|
+
return (c = (u = t.current).preloadRoute) == null ? void 0 : c.call(u, n);
|
|
131
|
+
},
|
|
132
|
+
root: t.current.root
|
|
133
|
+
});
|
|
134
|
+
}, [r]);
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
w as INTENT_DWELL_MS,
|
|
138
|
+
q as PREFETCH_PER_MINUTE,
|
|
139
|
+
R as PREFETCH_STALE_MS,
|
|
140
|
+
p as installIntentPrefetch,
|
|
141
|
+
k as linkPath,
|
|
142
|
+
h as prefetchKey,
|
|
143
|
+
P as prefetchRecord,
|
|
144
|
+
I as recordQueryKeys,
|
|
145
|
+
L as takePrefetchToken,
|
|
146
|
+
D as useIdleNextPage,
|
|
147
|
+
K as useIntentPrefetch,
|
|
148
|
+
_ as whenIdle
|
|
149
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { useQuery as k } from "@tanstack/react-query";
|
|
2
|
+
import { useState as C, useEffect as S, useCallback as O, useMemo as j, useRef as R } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as I } from "../context.js";
|
|
4
|
+
import { post as L, get as _ } from "./commands.js";
|
|
5
|
+
import { useLiveEvent as E } from "./live.js";
|
|
6
|
+
import { useMyUserId as T, useRecordSignalPeers as q, useRecordSignalWhile as K } from "./presence-signals.js";
|
|
7
|
+
import { useOptionalRealtime as A, useRealtimeStatus as F } from "./realtime.js";
|
|
8
|
+
function P(i, c) {
|
|
9
|
+
const e = F(), s = R(!1), r = R(i);
|
|
10
|
+
r.current = i, S(() => {
|
|
11
|
+
c && ((e == null ? void 0 : e.state) === "reconnecting" ? s.current = !0 : s.current && (s.current = !1, r.current()));
|
|
12
|
+
}, [e == null ? void 0 : e.state, c]);
|
|
13
|
+
}
|
|
14
|
+
function G(i, c) {
|
|
15
|
+
const e = A(), s = T(), r = c == null ? "" : String(c), t = !!e && !!i && !!r && r !== "new", [l, g] = C([]), v = O(() => {
|
|
16
|
+
t && (e == null || e.emit("record:join", { collection: i, item: r }));
|
|
17
|
+
}, [e, i, r, t]);
|
|
18
|
+
return S(() => {
|
|
19
|
+
if (g([]), !!t)
|
|
20
|
+
return v(), () => e == null ? void 0 : e.emit("record:leave", { collection: i, item: r });
|
|
21
|
+
}, [e, i, r, t, v]), P(v, t), E(
|
|
22
|
+
"record:viewers",
|
|
23
|
+
(u) => {
|
|
24
|
+
Array.isArray(u == null ? void 0 : u.viewers) && g(u.viewers);
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
enabled: t,
|
|
28
|
+
includeOwn: !0,
|
|
29
|
+
// An older server names no record: accept, as the hosts' own hooks do.
|
|
30
|
+
match: (u) => (u == null ? void 0 : u.collection) == null || (u == null ? void 0 : u.item) == null ? !0 : u.collection === i && String(u.item) === r
|
|
31
|
+
}
|
|
32
|
+
), { viewers: j(
|
|
33
|
+
() => l.filter((u) => !s || String(u.id).toUpperCase() !== s.toUpperCase()),
|
|
34
|
+
[l, s]
|
|
35
|
+
) };
|
|
36
|
+
}
|
|
37
|
+
function H(i, c, e = {}) {
|
|
38
|
+
const s = A(), r = T(), t = c == null ? "" : String(c), l = !!s && !!i && !!t && t !== "new", [g, v] = C({});
|
|
39
|
+
S(() => v({}), [i, t]), E(
|
|
40
|
+
"field:editing",
|
|
41
|
+
(o) => {
|
|
42
|
+
typeof (o == null ? void 0 : o.field) == "string" && v((b) => {
|
|
43
|
+
const y = { ...b }, d = o.user;
|
|
44
|
+
return d && (!r || String(d.id).toUpperCase() !== r.toUpperCase()) ? y[o.field] = d : delete y[o.field], y;
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
enabled: l,
|
|
49
|
+
includeOwn: !0,
|
|
50
|
+
match: (o) => (o == null ? void 0 : o.collection) == null || (o == null ? void 0 : o.item) == null ? !0 : o.collection === i && String(o.item) === t
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
const p = O(
|
|
54
|
+
(o) => {
|
|
55
|
+
l && o && (s == null || s.emit("field:focus", { field: o, collection: i, item: t }));
|
|
56
|
+
},
|
|
57
|
+
[s, i, t, l]
|
|
58
|
+
), u = O(
|
|
59
|
+
(o) => {
|
|
60
|
+
l && o && (s == null || s.emit("field:blur", { field: o, collection: i, item: t }));
|
|
61
|
+
},
|
|
62
|
+
[s, i, t, l]
|
|
63
|
+
);
|
|
64
|
+
return S(() => {
|
|
65
|
+
if (!l || !e.capture || typeof document > "u") return;
|
|
66
|
+
const o = (d) => {
|
|
67
|
+
var n, w, a;
|
|
68
|
+
return (a = (w = (n = d.target) == null ? void 0 : n.closest) == null ? void 0 : w.call(n, "[data-field]")) == null ? void 0 : a.getAttribute("data-field");
|
|
69
|
+
}, b = (d) => {
|
|
70
|
+
const n = o(d);
|
|
71
|
+
n && p(n);
|
|
72
|
+
}, y = (d) => {
|
|
73
|
+
const n = o(d);
|
|
74
|
+
n && u(n);
|
|
75
|
+
};
|
|
76
|
+
return document.addEventListener("focusin", b), document.addEventListener("focusout", y), () => {
|
|
77
|
+
document.removeEventListener("focusin", b), document.removeEventListener("focusout", y);
|
|
78
|
+
};
|
|
79
|
+
}, [l, e.capture, p, u]), { editing: g, focus: p, blur: u };
|
|
80
|
+
}
|
|
81
|
+
function J(i, c) {
|
|
82
|
+
const e = q(i, c, "note"), [s, r] = C(!1);
|
|
83
|
+
K(i, c, "note", s);
|
|
84
|
+
const t = R(null), l = O((g) => {
|
|
85
|
+
t.current && clearTimeout(t.current), t.current = null, r(g), g && (t.current = setTimeout(() => r(!1), 6e3));
|
|
86
|
+
}, []);
|
|
87
|
+
return S(
|
|
88
|
+
() => () => {
|
|
89
|
+
t.current && clearTimeout(t.current);
|
|
90
|
+
},
|
|
91
|
+
[]
|
|
92
|
+
), { typing: e, setTyping: l };
|
|
93
|
+
}
|
|
94
|
+
const $ = {};
|
|
95
|
+
function x(i, c) {
|
|
96
|
+
return `${i}:${c}`;
|
|
97
|
+
}
|
|
98
|
+
function B(i) {
|
|
99
|
+
const c = I(), e = [...new Set(i.map((r) => r.toUpperCase()))].sort().join(","), { data: s } = k({
|
|
100
|
+
queryKey: ["presence-visible-people", e],
|
|
101
|
+
queryFn: () => c.request(
|
|
102
|
+
_(`/presence/people?ids=${encodeURIComponent(e.split(",").slice(0, 100).join(","))}`)
|
|
103
|
+
).then((r) => new Set((r.data ?? []).map((t) => String(t.user_id).toUpperCase()))).catch(() => /* @__PURE__ */ new Set()),
|
|
104
|
+
enabled: !!c && e.length > 0,
|
|
105
|
+
staleTime: 5 * 6e4
|
|
106
|
+
});
|
|
107
|
+
return e.length === 0 ? null : s ?? null;
|
|
108
|
+
}
|
|
109
|
+
function U(i) {
|
|
110
|
+
const c = /* @__PURE__ */ new Map();
|
|
111
|
+
for (const s of i) {
|
|
112
|
+
const r = s.indexOf(":");
|
|
113
|
+
if (r <= 0) continue;
|
|
114
|
+
const t = s.slice(0, r), l = c.get(t) ?? [];
|
|
115
|
+
l.push(s.slice(r + 1)), c.set(t, l);
|
|
116
|
+
}
|
|
117
|
+
const e = [];
|
|
118
|
+
for (const [s, r] of c)
|
|
119
|
+
for (let t = 0; t < r.length; t += 100)
|
|
120
|
+
e.push({ collection: s, items: r.slice(t, t + 100) });
|
|
121
|
+
return e;
|
|
122
|
+
}
|
|
123
|
+
function X(i, c = {}) {
|
|
124
|
+
const e = A(), s = I(), r = T(), t = c.enabled !== !1 && i.length > 0, l = i.filter((n) => n.collection && n.item != null).map((n) => x(n.collection, n.item)).join(""), [g, v] = C({}), [p, u] = C({}), o = R(/* @__PURE__ */ new Set()), b = O(() => {
|
|
125
|
+
if (!(!e || !t))
|
|
126
|
+
for (const n of U(o.current)) e.emit("presence:watch", n);
|
|
127
|
+
}, [e, t]);
|
|
128
|
+
S(() => {
|
|
129
|
+
if (!e || !t) return;
|
|
130
|
+
const n = new Set(l.split("").filter(Boolean)), w = [...n].filter((f) => !o.current.has(f)), a = [...o.current].filter((f) => !n.has(f));
|
|
131
|
+
o.current = n;
|
|
132
|
+
for (const f of U(w)) e.emit("presence:watch", f);
|
|
133
|
+
if (a.length) {
|
|
134
|
+
for (const f of U(a)) e.emit("presence:unwatch", f);
|
|
135
|
+
v((f) => {
|
|
136
|
+
const m = { ...f };
|
|
137
|
+
for (const h of a) delete m[h];
|
|
138
|
+
return m;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, [e, l, t]), S(() => {
|
|
142
|
+
if (e)
|
|
143
|
+
return () => {
|
|
144
|
+
o.current.size && e.emit("presence:unwatch", {}), o.current = /* @__PURE__ */ new Set(), v({});
|
|
145
|
+
};
|
|
146
|
+
}, [e]), P(b, !!e && t), E(
|
|
147
|
+
"presence:rows",
|
|
148
|
+
(n) => {
|
|
149
|
+
if (!(n != null && n.collection) || (n == null ? void 0 : n.item) == null) return;
|
|
150
|
+
const w = x(String(n.collection), String(n.item)), a = (Array.isArray(n.user_ids) ? n.user_ids : []).map(String);
|
|
151
|
+
v((f) => {
|
|
152
|
+
const m = { ...f };
|
|
153
|
+
return a.length ? m[w] = a : delete m[w], m;
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
{ enabled: !!e && t, includeOwn: !0 }
|
|
157
|
+
), S(() => {
|
|
158
|
+
if (e || !s || !t) return;
|
|
159
|
+
const n = c.pollMs ?? 3e4, w = l.split("").filter(Boolean).slice(0, 100).map((h) => {
|
|
160
|
+
const M = h.indexOf(":");
|
|
161
|
+
return { collection: h.slice(0, M), item_id: h.slice(M + 1) };
|
|
162
|
+
});
|
|
163
|
+
let a = !0;
|
|
164
|
+
const f = () => {
|
|
165
|
+
s.request(L("/presence/record-viewers", { pairs: w })).then((h) => {
|
|
166
|
+
a && u(h.data ?? {});
|
|
167
|
+
}).catch(() => {
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
f();
|
|
171
|
+
const m = n > 0 ? setInterval(f, n) : null;
|
|
172
|
+
return () => {
|
|
173
|
+
a = !1, m && clearInterval(m);
|
|
174
|
+
};
|
|
175
|
+
}, [e, s, l, t, c.pollMs]);
|
|
176
|
+
const y = j(() => [...new Set(Object.values(g).flat())], [g]), d = B(y);
|
|
177
|
+
return j(() => {
|
|
178
|
+
if (!t) return $;
|
|
179
|
+
const n = {}, w = r == null ? void 0 : r.toUpperCase();
|
|
180
|
+
if (e)
|
|
181
|
+
for (const [a, f] of Object.entries(g)) {
|
|
182
|
+
const m = f.filter((h) => h.toUpperCase() !== w);
|
|
183
|
+
m.length !== 0 && (n[a] = {
|
|
184
|
+
ids: d ? m.filter((h) => d.has(h.toUpperCase())) : [],
|
|
185
|
+
count: m.length
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else
|
|
189
|
+
for (const [a, f] of Object.entries(p)) f > 1 && (n[a] = { ids: [], count: f - 1 });
|
|
190
|
+
return n;
|
|
191
|
+
}, [t, e, g, p, d, r]);
|
|
192
|
+
}
|
|
193
|
+
export {
|
|
194
|
+
x as rowPresenceKey,
|
|
195
|
+
H as useFieldFocus,
|
|
196
|
+
G as usePresence,
|
|
197
|
+
X as useRowPresence,
|
|
198
|
+
J as useTyping
|
|
199
|
+
};
|