@rapidmx/web-client 0.9.0 → 0.11.0
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/README.md +373 -88
- package/apps/admin/_layout.tsx +8 -2
- package/apps/admin/index.tsx +7 -1
- package/apps/admin/ingest-queue/index.tsx +2 -1
- package/apps/admin/mailboxes/[uid].tsx +23 -10
- package/apps/admin/quarantine/index.tsx +2 -1
- package/apps/admin/signing-certificates/index.tsx +343 -0
- package/apps/escrow/_layout.tsx +8 -2
- package/apps/shared/appearance/AppearanceForm.tsx +392 -0
- package/apps/shared/appearance/AppearanceHead.tsx +49 -0
- package/apps/shared/appearance/AppearanceProvider.tsx +470 -0
- package/apps/shared/appearance/ColorField.tsx +107 -0
- package/apps/shared/appearance/appearanceCache.ts +106 -0
- package/apps/shared/appearance/appearanceContext.ts +77 -0
- package/apps/shared/appearance/bootScript.ts +35 -0
- package/apps/shared/appearance/color.ts +169 -0
- package/apps/shared/appearance/photo.ts +88 -0
- package/apps/shared/appearance/resolvedTheme.ts +67 -0
- package/apps/shared/appearance/theme.ts +355 -0
- package/apps/shared/auth/accountUrl.ts +9 -0
- package/apps/shared/auth/adminAccess.ts +99 -0
- package/apps/shared/components/admin/layout/AdminShell.tsx +22 -10
- package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +107 -60
- package/apps/shared/components/admin/settings/BrandingForm.tsx +24 -0
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +2 -1
- package/apps/shared/components/admin/settings/PluginsManager.tsx +228 -25
- package/apps/shared/components/admin/setup/SetupWizard.tsx +2 -1
- package/apps/shared/components/calendar/CalendarListSidebar.tsx +4 -5
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +8 -2
- package/apps/shared/components/contacts/ContactForm.tsx +11 -5
- package/apps/shared/components/contacts/ContactsSidebar.tsx +5 -3
- package/apps/shared/components/contacts/ContactsToolbar.tsx +98 -115
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +25 -8
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +13 -6
- package/apps/shared/components/layout/AppShell.tsx +477 -288
- package/apps/shared/components/layout/BrandingChrome.tsx +200 -13
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +398 -389
- package/apps/shared/components/layout/MailboxProvisioning.tsx +168 -164
- package/apps/shared/components/layout/RailIcon.tsx +100 -0
- package/apps/shared/components/layout/ResponsiveToolbar.tsx +315 -0
- package/apps/shared/components/layout/ThemeSwitch.tsx +84 -0
- package/apps/shared/components/layout/UserMenu.tsx +372 -185
- package/apps/shared/components/mail/ConversationList.tsx +271 -262
- package/apps/shared/components/mail/ConversationThreadPane.tsx +147 -94
- package/apps/shared/components/mail/LazyReadingPane.tsx +113 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +227 -222
- package/apps/shared/components/mail/MessageDetailPane.tsx +1537 -1387
- package/apps/shared/components/mail/OutboxBadge.tsx +44 -0
- package/apps/shared/components/mail/OutboxRowStatus.tsx +31 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +312 -160
- package/apps/shared/components/mail/compose/ComposeToolbar.tsx +422 -418
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1644 -1736
- package/apps/shared/components/mail/compose/ComposeWindowPlaceholder.tsx +111 -0
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +147 -118
- package/apps/shared/components/mail/compose/composePerf.ts +46 -0
- package/apps/shared/components/mail/compose/encryptionRequirement.ts +86 -0
- package/apps/shared/components/mail/compose/quotedBody.ts +161 -100
- package/apps/shared/components/mail/layout/MailShell.tsx +490 -472
- package/apps/shared/components/mail/reading/EncryptedBody.tsx +65 -0
- package/apps/shared/components/mail/reading/EncryptedPreview.tsx +35 -0
- package/apps/shared/components/mail/reading/MessageBody.tsx +240 -0
- package/apps/shared/components/mail/reading/MessageCard.tsx +174 -0
- package/apps/shared/components/mail/reading/bodyContent.ts +100 -0
- package/apps/shared/components/mail/reading/bodyHtml.ts +298 -0
- package/apps/shared/components/mail/reading/color.ts +245 -0
- package/apps/shared/components/mail/reading/frameControl.ts +142 -0
- package/apps/shared/components/mail/reading/frameDocument.ts +123 -0
- package/apps/shared/components/mail/reading/safeDocument.ts +24 -0
- package/apps/shared/components/mail/reading/themeAdaptation.ts +221 -0
- package/apps/shared/components/mail/reading/themeSurface.ts +90 -0
- package/apps/shared/components/mail/reading/viewOriginal.ts +38 -0
- package/apps/shared/components/mail/unreadStyle.tsx +75 -0
- package/apps/shared/components/settings/SigningCertificateCard.tsx +344 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +253 -240
- package/apps/shared/components/sharing/PrincipalPicker.tsx +145 -0
- package/apps/shared/components/tasks/TasksSidebar.tsx +5 -3
- package/apps/shared/components/tasks/layout/TasksShell.tsx +24 -8
- package/apps/shared/keyboard/GlobalShortcuts.tsx +51 -0
- package/apps/shared/keyboard/ShortcutProvider.tsx +62 -0
- package/apps/shared/keyboard/ShortcutsDialog.tsx +84 -0
- package/apps/shared/keyboard/dispatch.ts +124 -0
- package/apps/shared/keyboard/format.ts +89 -0
- package/apps/shared/keyboard/keymap.ts +114 -0
- package/apps/shared/keyboard/match.ts +44 -0
- package/apps/shared/keyboard/parse.ts +136 -0
- package/apps/shared/keyboard/platform.ts +34 -0
- package/apps/shared/keyboard/registry.ts +65 -0
- package/apps/shared/keyboard/targets.ts +79 -0
- package/apps/shared/keyboard/useShortcut.ts +50 -0
- package/apps/shared/keyboard/useShortcutProps.ts +17 -0
- package/apps/shared/mail/folderCounts.ts +308 -0
- package/apps/shared/mail/folderTree.ts +143 -0
- package/apps/shared/mail/listSnapshots.ts +87 -0
- package/apps/shared/mail/messageReadState.ts +85 -0
- package/apps/shared/mail/newMailNotifications.ts +183 -0
- package/apps/shared/mail/outbox/UnlockBridge.tsx +23 -0
- package/apps/shared/mail/outbox/composeBridge.ts +69 -0
- package/apps/shared/mail/outbox/outboxState.ts +88 -0
- package/apps/shared/mail/outbox/pendingSends.ts +146 -0
- package/apps/shared/mail/outbox/sendDecision.ts +157 -0
- package/apps/shared/mail/outbox/sendJob.ts +427 -0
- package/apps/shared/mail/outbox/sendOutcomes.ts +146 -0
- package/apps/shared/mail/outbox/sendState.ts +35 -0
- package/apps/shared/mail/outbox/useOutboxStatus.ts +61 -0
- package/apps/shared/mail/useMailConnection.ts +203 -0
- package/apps/shared/mail/useMailLiveUpdates.ts +277 -224
- package/apps/shared/mail/useMarkMessageRead.ts +47 -0
- package/apps/shared/mail/useNewMailNotifications.ts +178 -0
- package/apps/shared/mail/useUnreadTitle.ts +42 -0
- package/apps/shared/navigation/AppRouter.tsx +300 -0
- package/apps/shared/navigation/appHrefs.ts +23 -0
- package/apps/shared/navigation/frameContext.tsx +35 -0
- package/apps/shared/navigation/idle.ts +45 -0
- package/apps/shared/navigation/routerContext.tsx +83 -0
- package/apps/shared/navigation/routes.ts +72 -0
- package/apps/shared/notifications/NotificationCenter.tsx +215 -0
- package/apps/shared/notifications/NotificationHistoryDialog.tsx +90 -0
- package/apps/shared/notifications/apiErrors.ts +98 -0
- package/apps/shared/notifications/headerOffset.ts +35 -0
- package/apps/shared/notifications/pushStatus.ts +56 -0
- package/apps/shared/notifications/store.ts +549 -0
- package/apps/shared/notifications/systemErrors.ts +63 -0
- package/apps/shared/notifications/useNotifications.ts +41 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +114 -98
- package/apps/shared/signing/enrollmentStorage.ts +33 -0
- package/apps/shared/signing/enrollmentTracker.ts +385 -0
- package/apps/shared/signing/enrollmentView.ts +251 -0
- package/apps/shared/signing/signingInfo.ts +58 -0
- package/apps/shared/signing/useNow.ts +19 -0
- package/apps/shared/signing/useSigningEnrollmentWatcher.ts +90 -0
- package/apps/shared/styles/app.css +108 -10
- package/apps/www/_layout.tsx +8 -2
- package/apps/www/_routedPage.tsx +24 -0
- package/apps/www/_routes.ts +36 -0
- package/apps/www/calendar/index.tsx +64 -33
- package/apps/www/contacts/[uid].tsx +109 -107
- package/apps/www/contacts/index.tsx +62 -42
- package/apps/www/index.tsx +2291 -1917
- package/apps/www/messages/[uid].tsx +108 -101
- package/apps/www/settings/appearance/index.tsx +21 -0
- package/apps/www/settings/auto-reply/index.tsx +7 -8
- package/apps/www/settings/encryption/index.tsx +1287 -1249
- package/apps/www/settings/filters/[uid].tsx +7 -2
- package/apps/www/settings/filters/index.tsx +102 -99
- package/apps/www/settings/filters/new/index.tsx +140 -133
- package/apps/www/settings/labels/index.tsx +204 -201
- package/apps/www/settings/privacy/index.tsx +7 -9
- package/apps/www/settings/read-receipts/index.tsx +7 -8
- package/apps/www/settings/sharing/index.tsx +256 -274
- package/apps/www/settings/signatures/[uid].tsx +172 -167
- package/apps/www/settings/signatures/index.tsx +88 -85
- package/apps/www/settings/signatures/new/index.tsx +135 -129
- package/apps/www/tasks/index.tsx +29 -18
- package/dist/apps/admin/_layout.d.ts +5 -1
- package/dist/apps/admin/_layout.js +3 -2
- package/dist/apps/admin/index.js +3 -2
- package/dist/apps/admin/ingest-queue/index.js +2 -1
- package/dist/apps/admin/mailboxes/[uid].js +9 -6
- package/dist/apps/admin/quarantine/index.js +2 -1
- package/dist/apps/admin/signing-certificates/index.d.ts +3 -0
- package/dist/apps/admin/signing-certificates/index.js +161 -0
- package/dist/apps/escrow/_layout.d.ts +5 -1
- package/dist/apps/escrow/_layout.js +3 -2
- package/dist/apps/shared/appearance/AppearanceForm.d.ts +7 -0
- package/dist/apps/shared/appearance/AppearanceForm.js +131 -0
- package/dist/apps/shared/appearance/AppearanceHead.d.ts +15 -0
- package/dist/apps/shared/appearance/AppearanceHead.js +31 -0
- package/dist/apps/shared/appearance/AppearanceProvider.d.ts +32 -0
- package/dist/apps/shared/appearance/AppearanceProvider.js +390 -0
- package/dist/apps/shared/appearance/ColorField.d.ts +22 -0
- package/dist/apps/shared/appearance/ColorField.js +40 -0
- package/dist/apps/shared/appearance/appearanceCache.d.ts +45 -0
- package/dist/apps/shared/appearance/appearanceCache.js +80 -0
- package/dist/apps/shared/appearance/appearanceContext.d.ts +45 -0
- package/dist/apps/shared/appearance/appearanceContext.js +29 -0
- package/dist/apps/shared/appearance/bootScript.d.ts +16 -0
- package/dist/apps/shared/appearance/bootScript.js +33 -0
- package/dist/apps/shared/appearance/color.d.ts +65 -0
- package/dist/apps/shared/appearance/color.js +132 -0
- package/dist/apps/shared/appearance/photo.d.ts +17 -0
- package/dist/apps/shared/appearance/photo.js +79 -0
- package/dist/apps/shared/appearance/resolvedTheme.d.ts +21 -0
- package/dist/apps/shared/appearance/resolvedTheme.js +55 -0
- package/dist/apps/shared/appearance/theme.d.ts +111 -0
- package/dist/apps/shared/appearance/theme.js +251 -0
- package/dist/apps/shared/auth/accountUrl.d.ts +2 -0
- package/dist/apps/shared/auth/accountUrl.js +8 -0
- package/dist/apps/shared/auth/adminAccess.d.ts +30 -0
- package/dist/apps/shared/auth/adminAccess.js +89 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +1 -1
- package/dist/apps/shared/components/admin/layout/AdminShell.js +16 -6
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +10 -5
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +49 -34
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +2 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +7 -1
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +1 -1
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +106 -20
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +2 -1
- package/dist/apps/shared/components/calendar/CalendarListSidebar.js +8 -8
- package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +1 -1
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +8 -4
- package/dist/apps/shared/components/contacts/ContactForm.js +1 -1
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +4 -2
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +6 -2
- package/dist/apps/shared/components/contacts/ContactsToolbar.js +28 -10
- package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +1 -1
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +19 -6
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +7 -4
- package/dist/apps/shared/components/layout/AppShell.d.ts +34 -4
- package/dist/apps/shared/components/layout/AppShell.js +122 -17
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +69 -10
- package/dist/apps/shared/components/layout/BrandingChrome.js +140 -12
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +10 -9
- package/dist/apps/shared/components/layout/MailboxProvisioning.js +3 -1
- package/dist/apps/shared/components/layout/RailIcon.d.ts +21 -0
- package/dist/apps/shared/components/layout/RailIcon.js +85 -0
- package/dist/apps/shared/components/layout/ResponsiveToolbar.d.ts +55 -0
- package/dist/apps/shared/components/layout/ResponsiveToolbar.js +199 -0
- package/dist/apps/shared/components/layout/ThemeSwitch.d.ts +9 -0
- package/dist/apps/shared/components/layout/ThemeSwitch.js +54 -0
- package/dist/apps/shared/components/layout/UserMenu.d.ts +25 -3
- package/dist/apps/shared/components/layout/UserMenu.js +88 -7
- package/dist/apps/shared/components/mail/ConversationList.js +5 -11
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +6 -2
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +87 -40
- package/dist/apps/shared/components/mail/LazyReadingPane.d.ts +9 -0
- package/dist/apps/shared/components/mail/LazyReadingPane.js +83 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +6 -4
- package/dist/apps/shared/components/mail/MailSelectionBar.js +11 -4
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +25 -8
- package/dist/apps/shared/components/mail/MessageDetailPane.js +167 -73
- package/dist/apps/shared/components/mail/OutboxBadge.d.ts +17 -0
- package/dist/apps/shared/components/mail/OutboxBadge.js +18 -0
- package/dist/apps/shared/components/mail/OutboxRowStatus.d.ts +10 -0
- package/dist/apps/shared/components/mail/OutboxRowStatus.js +19 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +38 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +97 -6
- package/dist/apps/shared/components/mail/compose/ComposeToolbar.js +4 -3
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +3 -2
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +316 -339
- package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.d.ts +19 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.js +33 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +9 -1
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +20 -2
- package/dist/apps/shared/components/mail/compose/composePerf.d.ts +16 -0
- package/dist/apps/shared/components/mail/compose/composePerf.js +41 -0
- package/dist/apps/shared/components/mail/compose/encryptionRequirement.d.ts +49 -0
- package/dist/apps/shared/components/mail/compose/encryptionRequirement.js +35 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +13 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.js +67 -11
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +14 -4
- package/dist/apps/shared/components/mail/layout/MailShell.js +90 -104
- package/dist/apps/shared/components/mail/reading/EncryptedBody.d.ts +21 -0
- package/dist/apps/shared/components/mail/reading/EncryptedBody.js +22 -0
- package/dist/apps/shared/components/mail/reading/EncryptedPreview.d.ts +18 -0
- package/dist/apps/shared/components/mail/reading/EncryptedPreview.js +22 -0
- package/dist/apps/shared/components/mail/reading/MessageBody.d.ts +32 -0
- package/dist/apps/shared/components/mail/reading/MessageBody.js +136 -0
- package/dist/apps/shared/components/mail/reading/MessageCard.d.ts +62 -0
- package/dist/apps/shared/components/mail/reading/MessageCard.js +58 -0
- package/dist/apps/shared/components/mail/reading/bodyContent.d.ts +38 -0
- package/dist/apps/shared/components/mail/reading/bodyContent.js +84 -0
- package/dist/apps/shared/components/mail/reading/bodyHtml.d.ts +47 -0
- package/dist/apps/shared/components/mail/reading/bodyHtml.js +267 -0
- package/dist/apps/shared/components/mail/reading/color.d.ts +63 -0
- package/dist/apps/shared/components/mail/reading/color.js +201 -0
- package/dist/apps/shared/components/mail/reading/frameControl.d.ts +33 -0
- package/dist/apps/shared/components/mail/reading/frameControl.js +120 -0
- package/dist/apps/shared/components/mail/reading/frameDocument.d.ts +52 -0
- package/dist/apps/shared/components/mail/reading/frameDocument.js +98 -0
- package/dist/apps/shared/components/mail/reading/safeDocument.d.ts +3 -0
- package/dist/apps/shared/components/mail/reading/safeDocument.js +12 -0
- package/dist/apps/shared/components/mail/reading/themeAdaptation.d.ts +56 -0
- package/dist/apps/shared/components/mail/reading/themeAdaptation.js +144 -0
- package/dist/apps/shared/components/mail/reading/themeSurface.d.ts +17 -0
- package/dist/apps/shared/components/mail/reading/themeSurface.js +83 -0
- package/dist/apps/shared/components/mail/reading/viewOriginal.d.ts +9 -0
- package/dist/apps/shared/components/mail/reading/viewOriginal.js +32 -0
- package/dist/apps/shared/components/mail/unreadStyle.d.ts +45 -0
- package/dist/apps/shared/components/mail/unreadStyle.js +61 -0
- package/dist/apps/shared/components/settings/SigningCertificateCard.d.ts +32 -0
- package/dist/apps/shared/components/settings/SigningCertificateCard.js +98 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +1 -1
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +16 -5
- package/dist/apps/shared/components/sharing/PrincipalPicker.d.ts +26 -0
- package/dist/apps/shared/components/sharing/PrincipalPicker.js +77 -0
- package/dist/apps/shared/components/tasks/TasksSidebar.js +4 -2
- package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +1 -1
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +18 -6
- package/dist/apps/shared/keyboard/GlobalShortcuts.d.ts +14 -0
- package/dist/apps/shared/keyboard/GlobalShortcuts.js +37 -0
- package/dist/apps/shared/keyboard/ShortcutProvider.d.ts +20 -0
- package/dist/apps/shared/keyboard/ShortcutProvider.js +52 -0
- package/dist/apps/shared/keyboard/ShortcutsDialog.d.ts +14 -0
- package/dist/apps/shared/keyboard/ShortcutsDialog.js +42 -0
- package/dist/apps/shared/keyboard/dispatch.d.ts +16 -0
- package/dist/apps/shared/keyboard/dispatch.js +109 -0
- package/dist/apps/shared/keyboard/format.d.ts +12 -0
- package/dist/apps/shared/keyboard/format.js +74 -0
- package/dist/apps/shared/keyboard/keymap.d.ts +294 -0
- package/dist/apps/shared/keyboard/keymap.js +84 -0
- package/dist/apps/shared/keyboard/match.d.ts +20 -0
- package/dist/apps/shared/keyboard/match.js +31 -0
- package/dist/apps/shared/keyboard/parse.d.ts +31 -0
- package/dist/apps/shared/keyboard/parse.js +107 -0
- package/dist/apps/shared/keyboard/platform.d.ts +15 -0
- package/dist/apps/shared/keyboard/platform.js +22 -0
- package/dist/apps/shared/keyboard/registry.d.ts +39 -0
- package/dist/apps/shared/keyboard/registry.js +33 -0
- package/dist/apps/shared/keyboard/targets.d.ts +14 -0
- package/dist/apps/shared/keyboard/targets.js +67 -0
- package/dist/apps/shared/keyboard/useShortcut.d.ts +19 -0
- package/dist/apps/shared/keyboard/useShortcut.js +35 -0
- package/dist/apps/shared/keyboard/useShortcutProps.d.ts +10 -0
- package/dist/apps/shared/keyboard/useShortcutProps.js +15 -0
- package/dist/apps/shared/mail/folderCounts.d.ts +78 -0
- package/dist/apps/shared/mail/folderCounts.js +218 -0
- package/dist/apps/shared/mail/folderTree.d.ts +55 -0
- package/dist/apps/shared/mail/folderTree.js +116 -0
- package/dist/apps/shared/mail/listSnapshots.d.ts +46 -0
- package/dist/apps/shared/mail/listSnapshots.js +43 -0
- package/dist/apps/shared/mail/messageReadState.d.ts +32 -0
- package/dist/apps/shared/mail/messageReadState.js +63 -0
- package/dist/apps/shared/mail/newMailNotifications.d.ts +62 -0
- package/dist/apps/shared/mail/newMailNotifications.js +138 -0
- package/dist/apps/shared/mail/outbox/UnlockBridge.d.ts +5 -0
- package/dist/apps/shared/mail/outbox/UnlockBridge.js +18 -0
- package/dist/apps/shared/mail/outbox/composeBridge.d.ts +34 -0
- package/dist/apps/shared/mail/outbox/composeBridge.js +32 -0
- package/dist/apps/shared/mail/outbox/outboxState.d.ts +41 -0
- package/dist/apps/shared/mail/outbox/outboxState.js +42 -0
- package/dist/apps/shared/mail/outbox/pendingSends.d.ts +39 -0
- package/dist/apps/shared/mail/outbox/pendingSends.js +109 -0
- package/dist/apps/shared/mail/outbox/sendDecision.d.ts +80 -0
- package/dist/apps/shared/mail/outbox/sendDecision.js +94 -0
- package/dist/apps/shared/mail/outbox/sendJob.d.ts +68 -0
- package/dist/apps/shared/mail/outbox/sendJob.js +319 -0
- package/dist/apps/shared/mail/outbox/sendOutcomes.d.ts +3 -0
- package/dist/apps/shared/mail/outbox/sendOutcomes.js +141 -0
- package/dist/apps/shared/mail/outbox/sendState.d.ts +25 -0
- package/dist/apps/shared/mail/outbox/sendState.js +8 -0
- package/dist/apps/shared/mail/outbox/useOutboxStatus.d.ts +11 -0
- package/dist/apps/shared/mail/outbox/useOutboxStatus.js +49 -0
- package/dist/apps/shared/mail/useMailConnection.d.ts +56 -0
- package/dist/apps/shared/mail/useMailConnection.js +138 -0
- package/dist/apps/shared/mail/useMailLiveUpdates.d.ts +29 -9
- package/dist/apps/shared/mail/useMailLiveUpdates.js +60 -32
- package/dist/apps/shared/mail/useMarkMessageRead.d.ts +12 -0
- package/dist/apps/shared/mail/useMarkMessageRead.js +44 -0
- package/dist/apps/shared/mail/useNewMailNotifications.d.ts +35 -0
- package/dist/apps/shared/mail/useNewMailNotifications.js +130 -0
- package/dist/apps/shared/mail/useUnreadTitle.d.ts +18 -0
- package/dist/apps/shared/mail/useUnreadTitle.js +31 -0
- package/dist/apps/shared/navigation/AppRouter.d.ts +52 -0
- package/dist/apps/shared/navigation/AppRouter.js +242 -0
- package/dist/apps/shared/navigation/appHrefs.d.ts +14 -0
- package/dist/apps/shared/navigation/appHrefs.js +20 -0
- package/dist/apps/shared/navigation/frameContext.d.ts +19 -0
- package/dist/apps/shared/navigation/frameContext.js +24 -0
- package/dist/apps/shared/navigation/idle.d.ts +14 -0
- package/dist/apps/shared/navigation/idle.js +43 -0
- package/dist/apps/shared/navigation/routerContext.d.ts +37 -0
- package/dist/apps/shared/navigation/routerContext.js +56 -0
- package/dist/apps/shared/navigation/routes.d.ts +32 -0
- package/dist/apps/shared/navigation/routes.js +37 -0
- package/dist/apps/shared/notifications/NotificationCenter.d.ts +19 -0
- package/dist/apps/shared/notifications/NotificationCenter.js +90 -0
- package/dist/apps/shared/notifications/NotificationHistoryDialog.d.ts +10 -0
- package/dist/apps/shared/notifications/NotificationHistoryDialog.js +36 -0
- package/dist/apps/shared/notifications/apiErrors.d.ts +19 -0
- package/dist/apps/shared/notifications/apiErrors.js +86 -0
- package/dist/apps/shared/notifications/headerOffset.d.ts +8 -0
- package/dist/apps/shared/notifications/headerOffset.js +33 -0
- package/dist/apps/shared/notifications/pushStatus.d.ts +9 -0
- package/dist/apps/shared/notifications/pushStatus.js +54 -0
- package/dist/apps/shared/notifications/store.d.ts +136 -0
- package/dist/apps/shared/notifications/store.js +416 -0
- package/dist/apps/shared/notifications/systemErrors.d.ts +9 -0
- package/dist/apps/shared/notifications/systemErrors.js +58 -0
- package/dist/apps/shared/notifications/useNotifications.d.ts +17 -0
- package/dist/apps/shared/notifications/useNotifications.js +18 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.js +17 -3
- package/dist/apps/shared/signing/enrollmentStorage.d.ts +10 -0
- package/dist/apps/shared/signing/enrollmentStorage.js +33 -0
- package/dist/apps/shared/signing/enrollmentTracker.d.ts +73 -0
- package/dist/apps/shared/signing/enrollmentTracker.js +307 -0
- package/dist/apps/shared/signing/enrollmentView.d.ts +57 -0
- package/dist/apps/shared/signing/enrollmentView.js +214 -0
- package/dist/apps/shared/signing/signingInfo.d.ts +11 -0
- package/dist/apps/shared/signing/signingInfo.js +48 -0
- package/dist/apps/shared/signing/useNow.d.ts +2 -0
- package/dist/apps/shared/signing/useNow.js +18 -0
- package/dist/apps/shared/signing/useSigningEnrollmentWatcher.d.ts +16 -0
- package/dist/apps/shared/signing/useSigningEnrollmentWatcher.js +87 -0
- package/dist/apps/shared/styles/app.css +108 -10
- package/dist/apps/www/_layout.d.ts +5 -1
- package/dist/apps/www/_layout.js +3 -2
- package/dist/apps/www/_routedPage.d.ts +12 -0
- package/dist/apps/www/_routedPage.js +19 -0
- package/dist/apps/www/_routes.d.ts +11 -0
- package/dist/apps/www/_routes.js +30 -0
- package/dist/apps/www/calendar/index.d.ts +2 -2
- package/dist/apps/www/calendar/index.js +41 -11
- package/dist/apps/www/contacts/[uid].d.ts +3 -9
- package/dist/apps/www/contacts/[uid].js +11 -9
- package/dist/apps/www/contacts/index.d.ts +2 -2
- package/dist/apps/www/contacts/index.js +30 -24
- package/dist/apps/www/index.d.ts +2 -2
- package/dist/apps/www/index.js +332 -48
- package/dist/apps/www/messages/[uid].d.ts +3 -7
- package/dist/apps/www/messages/[uid].js +10 -5
- package/dist/apps/www/settings/appearance/index.d.ts +4 -0
- package/dist/apps/www/settings/appearance/index.js +13 -0
- package/dist/apps/www/settings/auto-reply/index.d.ts +2 -2
- package/dist/apps/www/settings/auto-reply/index.js +6 -7
- package/dist/apps/www/settings/encryption/index.d.ts +2 -2
- package/dist/apps/www/settings/encryption/index.js +106 -96
- package/dist/apps/www/settings/filters/[uid].d.ts +2 -2
- package/dist/apps/www/settings/filters/[uid].js +6 -2
- package/dist/apps/www/settings/filters/index.d.ts +2 -2
- package/dist/apps/www/settings/filters/index.js +3 -1
- package/dist/apps/www/settings/filters/new/index.d.ts +2 -2
- package/dist/apps/www/settings/filters/new/index.js +9 -3
- package/dist/apps/www/settings/labels/index.d.ts +2 -2
- package/dist/apps/www/settings/labels/index.js +3 -1
- package/dist/apps/www/settings/privacy/index.d.ts +2 -2
- package/dist/apps/www/settings/privacy/index.js +8 -9
- package/dist/apps/www/settings/read-receipts/index.d.ts +2 -2
- package/dist/apps/www/settings/read-receipts/index.js +6 -7
- package/dist/apps/www/settings/sharing/index.d.ts +2 -2
- package/dist/apps/www/settings/sharing/index.js +22 -34
- package/dist/apps/www/settings/signatures/[uid].d.ts +2 -2
- package/dist/apps/www/settings/signatures/[uid].js +6 -2
- package/dist/apps/www/settings/signatures/index.d.ts +2 -2
- package/dist/apps/www/settings/signatures/index.js +3 -1
- package/dist/apps/www/settings/signatures/new/index.d.ts +2 -2
- package/dist/apps/www/settings/signatures/new/index.js +9 -4
- package/dist/apps/www/tasks/index.d.ts +2 -2
- package/dist/apps/www/tasks/index.js +22 -16
- package/package.json +2 -2
- package/apps/shared/components/mail/compose/SendFailureAlert.tsx +0 -48
- package/dist/apps/shared/components/mail/compose/SendFailureAlert.d.ts +0 -14
- package/dist/apps/shared/components/mail/compose/SendFailureAlert.js +0 -11
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { FormEvent, useEffect, useState } from "react";
|
|
6
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
+
import {
|
|
8
|
+
MailboxAccessRole,
|
|
9
|
+
ResolvedPrincipal,
|
|
10
|
+
resolveMailboxPrincipal,
|
|
11
|
+
setMailboxAccess,
|
|
12
|
+
} from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
13
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
14
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
15
|
+
|
|
16
|
+
export interface PrincipalPickerProps {
|
|
17
|
+
mailboxUid: string;
|
|
18
|
+
/** What each access level is called on this page. */
|
|
19
|
+
roleLabels: Record<MailboxAccessRole, string>;
|
|
20
|
+
/** Text put in the box to start with - a stored entry being replaced, say. */
|
|
21
|
+
initialPrincipal?: string;
|
|
22
|
+
/** The access level pre-selected. */
|
|
23
|
+
defaultRole?: MailboxAccessRole;
|
|
24
|
+
/** What the box asks for. */
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/** Called once the grant is saved, with the person it went to. */
|
|
27
|
+
onGranted: (person: ResolvedPrincipal, role: MailboxAccessRole) => void | Promise<void>;
|
|
28
|
+
/** Shown as a Cancel button next to the box when set (replacing an entry). */
|
|
29
|
+
onCancel?: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Who a resolved person is, for a person to check before saving: their name and address, else their uid. */
|
|
33
|
+
export function describePerson(person: ResolvedPrincipal): string {
|
|
34
|
+
if (person.displayName && person.address) return `${person.displayName} <${person.address}>`;
|
|
35
|
+
return person.displayName ?? person.address ?? `user ${person.userUid}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* "Who?" for a sharing screen. What is typed - a mailbox address, an auth-server username or e-mail alias, or a user id -
|
|
40
|
+
* is RESOLVED by the server (`resolveMailboxPrincipal()`) to the person it names before anything is saved, and the person
|
|
41
|
+
* is shown (name and address) for the caller to confirm; only then is the grant made, against that person's uid. Free text
|
|
42
|
+
* is never stored: an ACL record matches a user uid and nothing else, so a grant to a typed username applies to nobody.
|
|
43
|
+
*/
|
|
44
|
+
export default function PrincipalPicker({ mailboxUid, roleLabels, initialPrincipal, defaultRole = "viewer", placeholder, onGranted, onCancel }: PrincipalPickerProps) {
|
|
45
|
+
const [typed, setTyped] = useState(initialPrincipal ?? "");
|
|
46
|
+
const [role, setRole] = useState<MailboxAccessRole>(defaultRole);
|
|
47
|
+
const [person, setPerson] = useState<ResolvedPrincipal | null>(null);
|
|
48
|
+
const [busy, setBusy] = useState(false);
|
|
49
|
+
const [error, setError] = useState<string | null>(null);
|
|
50
|
+
|
|
51
|
+
// A stored entry being replaced is looked up straight away, so its person is shown without a click.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (initialPrincipal) {
|
|
54
|
+
void find(initialPrincipal);
|
|
55
|
+
}
|
|
56
|
+
}, [initialPrincipal]);
|
|
57
|
+
|
|
58
|
+
async function find(principal: string) {
|
|
59
|
+
setBusy(true);
|
|
60
|
+
setError(null);
|
|
61
|
+
setPerson(null);
|
|
62
|
+
try {
|
|
63
|
+
setPerson(await resolveMailboxPrincipal(mailboxUid, principal));
|
|
64
|
+
} catch (err) {
|
|
65
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not look that person up.");
|
|
66
|
+
} finally {
|
|
67
|
+
setBusy(false);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function handleFind(e: FormEvent) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
const principal = typed.trim();
|
|
74
|
+
if (principal) {
|
|
75
|
+
void find(principal);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Only reachable from the confirm button, which only renders once `person` is set.
|
|
80
|
+
async function handleGrant() {
|
|
81
|
+
setBusy(true);
|
|
82
|
+
setError(null);
|
|
83
|
+
try {
|
|
84
|
+
await setMailboxAccess(mailboxUid, person!.userUid, role);
|
|
85
|
+
await onGranted(person!, role);
|
|
86
|
+
setTyped("");
|
|
87
|
+
setPerson(null);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not grant access.");
|
|
90
|
+
} finally {
|
|
91
|
+
setBusy(false);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className="flex flex-col gap-2">
|
|
97
|
+
{error && <Alert>{error}</Alert>}
|
|
98
|
+
<form onSubmit={handleFind} className="flex gap-2">
|
|
99
|
+
<input
|
|
100
|
+
type="text"
|
|
101
|
+
aria-label="Who to share with"
|
|
102
|
+
placeholder={placeholder ?? "Email address, username or user id"}
|
|
103
|
+
className="flex-1 text-sm border border-border rounded-sm py-1.5 px-2 bg-surface text-text"
|
|
104
|
+
value={typed}
|
|
105
|
+
onChange={(e) => {
|
|
106
|
+
setTyped(e.target.value);
|
|
107
|
+
setPerson(null);
|
|
108
|
+
}}
|
|
109
|
+
disabled={busy}
|
|
110
|
+
/>
|
|
111
|
+
<select
|
|
112
|
+
aria-label="Access level"
|
|
113
|
+
className="text-sm border border-border rounded-sm py-1.5 px-2 bg-surface text-text"
|
|
114
|
+
value={role}
|
|
115
|
+
onChange={(e) => setRole(e.target.value as MailboxAccessRole)}
|
|
116
|
+
disabled={busy}
|
|
117
|
+
>
|
|
118
|
+
{(Object.keys(roleLabels) as MailboxAccessRole[]).map((value) => (
|
|
119
|
+
<option key={value} value={value}>
|
|
120
|
+
{roleLabels[value]}
|
|
121
|
+
</option>
|
|
122
|
+
))}
|
|
123
|
+
</select>
|
|
124
|
+
<Button type="submit" variant="secondary" loading={busy && !person} disabled={busy} className="!w-auto">
|
|
125
|
+
Find
|
|
126
|
+
</Button>
|
|
127
|
+
{onCancel && (
|
|
128
|
+
<Button type="button" variant="text" className="!w-auto" onClick={onCancel}>
|
|
129
|
+
Cancel
|
|
130
|
+
</Button>
|
|
131
|
+
)}
|
|
132
|
+
</form>
|
|
133
|
+
{person && (
|
|
134
|
+
<div className="flex items-center justify-between gap-3 text-sm py-2 px-3 border border-border rounded-sm">
|
|
135
|
+
<span>
|
|
136
|
+
Share with <strong className="break-all">{describePerson(person)}</strong> as <em>{roleLabels[role]}</em>?
|
|
137
|
+
</span>
|
|
138
|
+
<Button type="button" loading={busy} disabled={busy} className="!w-auto" onClick={() => void handleGrant()}>
|
|
139
|
+
Grant
|
|
140
|
+
</Button>
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
@@ -7,6 +7,7 @@ import { HiOutlineBars3 } from "react-icons/hi2";
|
|
|
7
7
|
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
8
|
import { Task, TaskList, createTaskList, listTaskLists } from "@rapidmx/react-shared/tasks/tasksApi.js";
|
|
9
9
|
import Drawer from "@rapidmx/react-shared/components/overlays/Drawer.js";
|
|
10
|
+
import { notifyApiError } from "../../notifications/apiErrors.js";
|
|
10
11
|
|
|
11
12
|
export type TasksView =
|
|
12
13
|
| { type: "myDay" }
|
|
@@ -102,7 +103,8 @@ export default function TasksSidebar({ mailboxUid, tasks, userUid, active, onSel
|
|
|
102
103
|
setNewListName("");
|
|
103
104
|
setAddingList(false);
|
|
104
105
|
} catch (err) {
|
|
105
|
-
|
|
106
|
+
// A pop-up: `listsError` is only the lists' own load failure.
|
|
107
|
+
notifyApiError(err, "Couldn't create the list");
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -184,13 +186,13 @@ export default function TasksSidebar({ mailboxUid, tasks, userUid, active, onSel
|
|
|
184
186
|
<>
|
|
185
187
|
<button
|
|
186
188
|
type="button"
|
|
187
|
-
className="
|
|
189
|
+
className="lg:hidden m-3 mb-0 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text"
|
|
188
190
|
aria-label="Open tasks menu"
|
|
189
191
|
onClick={() => setDrawerOpen(true)}
|
|
190
192
|
>
|
|
191
193
|
<HiOutlineBars3 size={20} aria-hidden="true" />
|
|
192
194
|
</button>
|
|
193
|
-
<nav aria-label="Tasks" className="hidden
|
|
195
|
+
<nav aria-label="Tasks" className="hidden lg:flex w-56 shrink-0 border-r border-border flex-col gap-4 p-3 overflow-y-auto">
|
|
194
196
|
{navContent("desktop")}
|
|
195
197
|
</nav>
|
|
196
198
|
<Drawer open={drawerOpen} onClose={() => setDrawerOpen(false)} title="Tasks">
|
|
@@ -10,6 +10,7 @@ import { Folder, Mailbox, listFolders, listMailboxes } from "@rapidmx/react-shar
|
|
|
10
10
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
11
|
import Skeleton, { SkeletonList } from "@rapidmx/react-shared/components/feedback/Skeleton.js";
|
|
12
12
|
import AppShell, { AppShellProps } from "../../layout/AppShell.js";
|
|
13
|
+
import { useLocationSearch, useNavigate } from "../../../navigation/AppRouter.js";
|
|
13
14
|
import MailboxProvisioning from "../../layout/MailboxProvisioning.js";
|
|
14
15
|
|
|
15
16
|
export type TasksShellProps = Omit<AppShellProps, "active">;
|
|
@@ -47,6 +48,7 @@ export default function TasksShell({
|
|
|
47
48
|
impersonating,
|
|
48
49
|
impersonationBaseUrl,
|
|
49
50
|
trusted,
|
|
51
|
+
trustedRoles,
|
|
50
52
|
pluginNav,
|
|
51
53
|
children,
|
|
52
54
|
}: PropsWithChildren<TasksShellProps>) {
|
|
@@ -58,9 +60,18 @@ export default function TasksShell({
|
|
|
58
60
|
const [requestedMailboxUid, setRequestedMailboxUid] = useState<string | null>(null);
|
|
59
61
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
60
62
|
|
|
63
|
+
// Read from the router's location, so a mailbox change (a link, or `navigate()`) takes effect without a page load - and in an
|
|
64
|
+
// effect, not during render, so the server render and the hydrating render agree.
|
|
65
|
+
const search = useLocationSearch();
|
|
66
|
+
const navigate = useNavigate();
|
|
61
67
|
useEffect(() => {
|
|
62
|
-
setRequestedMailboxUid(new URLSearchParams(
|
|
63
|
-
}, []);
|
|
68
|
+
setRequestedMailboxUid(new URLSearchParams(search).get("mailboxUid"));
|
|
69
|
+
}, [search]);
|
|
70
|
+
// Choosing a folder (or mailbox) changes the URL without a page load now, so the drawer that held the choice - which used to go
|
|
71
|
+
// with the page - is closed here.
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setDrawerOpen(false);
|
|
74
|
+
}, [search]);
|
|
64
75
|
|
|
65
76
|
useEffect(() => {
|
|
66
77
|
if (!userUid) {
|
|
@@ -144,7 +155,7 @@ export default function TasksShell({
|
|
|
144
155
|
className="w-full text-sm border border-border rounded-sm py-1.5 px-2 bg-surface"
|
|
145
156
|
value={mailboxUid}
|
|
146
157
|
onChange={(e) => {
|
|
147
|
-
|
|
158
|
+
navigate(`/tasks?mailboxUid=${encodeURIComponent(e.target.value)}`);
|
|
148
159
|
}}
|
|
149
160
|
>
|
|
150
161
|
{mailboxes.map((mb) => (
|
|
@@ -160,19 +171,23 @@ export default function TasksShell({
|
|
|
160
171
|
</>
|
|
161
172
|
);
|
|
162
173
|
|
|
174
|
+
// With a single mailbox and no error this column would be empty: no 224 px of nothing beside the tasks' own menu.
|
|
175
|
+
const hasSidebar = mailboxes.length > 1 || !!folderError;
|
|
163
176
|
inner = (
|
|
164
177
|
<>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
178
|
+
{hasSidebar && (
|
|
179
|
+
<aside className="hidden lg:flex w-56 shrink-0 bg-surface border-r border-border flex-col p-3 gap-3">
|
|
180
|
+
{sidebarContent("desktop")}
|
|
181
|
+
</aside>
|
|
182
|
+
)}
|
|
168
183
|
<Drawer open={drawerOpen} onClose={() => setDrawerOpen(false)} title="Mailbox">
|
|
169
184
|
<div className="flex flex-col gap-3">{sidebarContent("mobile")}</div>
|
|
170
185
|
</Drawer>
|
|
171
186
|
<main className="flex-1 min-w-0 flex flex-col">
|
|
172
|
-
{
|
|
187
|
+
{hasSidebar && (
|
|
173
188
|
<button
|
|
174
189
|
type="button"
|
|
175
|
-
className="
|
|
190
|
+
className="lg:hidden m-3 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text"
|
|
176
191
|
aria-label="Open mailbox switcher"
|
|
177
192
|
onClick={() => setDrawerOpen(true)}
|
|
178
193
|
>
|
|
@@ -193,6 +208,7 @@ export default function TasksShell({
|
|
|
193
208
|
impersonating={impersonating}
|
|
194
209
|
impersonationBaseUrl={impersonationBaseUrl}
|
|
195
210
|
trusted={trusted}
|
|
211
|
+
trustedRoles={trustedRoles}
|
|
196
212
|
pluginNav={pluginNav}
|
|
197
213
|
>
|
|
198
214
|
{inner}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { accountUrlOf } from "../auth/accountUrl.js";
|
|
6
|
+
import { APP_HREFS, SETTINGS_HREF, isSettingsPath } from "../navigation/appHrefs.js";
|
|
7
|
+
import { useNavigate } from "../navigation/routerContext.js";
|
|
8
|
+
import { SHORTCUTS } from "./keymap.js";
|
|
9
|
+
import { useShortcut } from "./useShortcut.js";
|
|
10
|
+
|
|
11
|
+
export interface GlobalShortcutsProps {
|
|
12
|
+
/** auth-server's base URL - "Go to Account" is offered only when it is set. */
|
|
13
|
+
authServerUrl?: string;
|
|
14
|
+
/** Opens the keyboard shortcuts dialog, or closes it if it is open. */
|
|
15
|
+
onToggleHelp: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The shortcuts that work in every view: the "Go to ..." navigation set and the keyboard help. Mounted once by `AppChrome`, next to the
|
|
20
|
+
* `ShortcutProvider`, so it works from Settings and every app alike. Renders nothing.
|
|
21
|
+
*
|
|
22
|
+
* In-app places go through the client-side router (`useNavigate()`); Account is another origin, so it is a plain navigation. Asking for the
|
|
23
|
+
* page you are already on does nothing - but the key is still taken, so the browser doesn't act on it either.
|
|
24
|
+
*/
|
|
25
|
+
export function GlobalShortcuts({ authServerUrl, onToggleHelp }: GlobalShortcutsProps) {
|
|
26
|
+
const navigate = useNavigate();
|
|
27
|
+
const accountUrl = accountUrlOf(authServerUrl);
|
|
28
|
+
|
|
29
|
+
/** A handler that goes to `href` unless the address bar's path says it is already there. */
|
|
30
|
+
const goTo = (href: string, isHere: (pathname: string) => boolean) => () => {
|
|
31
|
+
if (!isHere(window.location.pathname)) {
|
|
32
|
+
navigate(href);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const isPath = (path: string) => (pathname: string) => pathname === path;
|
|
36
|
+
|
|
37
|
+
useShortcut(SHORTCUTS.global.mail, goTo(APP_HREFS.mail, isPath(APP_HREFS.mail)));
|
|
38
|
+
useShortcut(SHORTCUTS.global.calendar, goTo(APP_HREFS.calendar, isPath(APP_HREFS.calendar)));
|
|
39
|
+
useShortcut(SHORTCUTS.global.contacts, goTo(APP_HREFS.contacts, isPath(APP_HREFS.contacts)));
|
|
40
|
+
useShortcut(SHORTCUTS.global.tasks, goTo(APP_HREFS.tasks, isPath(APP_HREFS.tasks)));
|
|
41
|
+
useShortcut(SHORTCUTS.global.settings, goTo(SETTINGS_HREF, isSettingsPath));
|
|
42
|
+
useShortcut(
|
|
43
|
+
SHORTCUTS.global.account,
|
|
44
|
+
() => {
|
|
45
|
+
window.location.href = accountUrl!;
|
|
46
|
+
},
|
|
47
|
+
{ enabled: !!accountUrl },
|
|
48
|
+
);
|
|
49
|
+
useShortcut(SHORTCUTS.global.help, onToggleHelp);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { PropsWithChildren, createContext, useContext, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
6
|
+
import { dispatchKeyEvent } from "./dispatch.js";
|
|
7
|
+
import { KeyEnvironment, SERVER_ENVIRONMENT, currentEnvironment } from "./platform.js";
|
|
8
|
+
import { Registration, ShortcutRegistry } from "./registry.js";
|
|
9
|
+
|
|
10
|
+
interface ShortcutContextValue {
|
|
11
|
+
registry: ShortcutRegistry;
|
|
12
|
+
env: KeyEnvironment;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ShortcutContext = createContext<ShortcutContextValue | null>(null);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The web client's one keyboard layer. Mounted once, by `AppChrome` (the frame that stays mounted as the router swaps pages), so shortcuts
|
|
19
|
+
* work in every view - mail, calendar, contacts, tasks, settings - and a page change only changes which handlers are registered.
|
|
20
|
+
*
|
|
21
|
+
* One `keydown` listener on `document` (bubbling, so what a widget handles itself and `preventDefault()`s is left alone) hands each key to
|
|
22
|
+
* `dispatchKeyEvent()`. Views claim keys with `useShortcut()`. Outside a provider - an admin page, a component rendered on its own - that
|
|
23
|
+
* hook does nothing.
|
|
24
|
+
*
|
|
25
|
+
* The platform (macOS, the desktop client) is read after mount, never during render, so the server render and hydration agree.
|
|
26
|
+
*/
|
|
27
|
+
export function ShortcutProvider({ children }: PropsWithChildren) {
|
|
28
|
+
const registry = useMemo(() => new ShortcutRegistry(), []);
|
|
29
|
+
const [env, setEnv] = useState<KeyEnvironment>(SERVER_ENVIRONMENT);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setEnv(currentEnvironment());
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
35
|
+
dispatchKeyEvent(registry, event, currentEnvironment(), document);
|
|
36
|
+
}
|
|
37
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
38
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
39
|
+
}, [registry]);
|
|
40
|
+
const value = useMemo(() => ({ registry, env }), [registry, env]);
|
|
41
|
+
return <ShortcutContext.Provider value={value}>{children}</ShortcutContext.Provider>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The registry, or `null` outside a `ShortcutProvider`. */
|
|
45
|
+
export function useShortcutRegistry(): ShortcutRegistry | null {
|
|
46
|
+
return useContext(ShortcutContext)?.registry ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The platform as the keyboard layer sees it - `SERVER_ENVIRONMENT` until the client has mounted, and outside a provider. */
|
|
50
|
+
export function useKeyEnvironment(): KeyEnvironment {
|
|
51
|
+
return useContext(ShortcutContext)?.env ?? SERVER_ENVIRONMENT;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const NO_REGISTRATIONS: readonly Registration[] = [];
|
|
55
|
+
const getNoRegistrations = () => NO_REGISTRATIONS;
|
|
56
|
+
const NEVER = () => () => undefined;
|
|
57
|
+
|
|
58
|
+
/** Everything registered right now, updating as views mount and unmount - what the help dialog lists. Empty outside a provider. */
|
|
59
|
+
export function useRegisteredShortcuts(): readonly Registration[] {
|
|
60
|
+
const registry = useShortcutRegistry();
|
|
61
|
+
return useSyncExternalStore(registry?.subscribe ?? NEVER, registry?.getSnapshot ?? getNoRegistrations, getNoRegistrations);
|
|
62
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React from "react";
|
|
6
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
7
|
+
import { formatSpec, specsFor } from "./format.js";
|
|
8
|
+
import { HELP_SCOPES, SCOPE_LABELS, SHORTCUTS, ShortcutDef, shortcutRank } from "./keymap.js";
|
|
9
|
+
import { useKeyEnvironment, useRegisteredShortcuts } from "./ShortcutProvider.js";
|
|
10
|
+
import { useShortcut } from "./useShortcut.js";
|
|
11
|
+
|
|
12
|
+
export interface ShortcutsDialogProps {
|
|
13
|
+
open: boolean;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Keys({ shortcut }: { shortcut: ShortcutDef }) {
|
|
18
|
+
const env = useKeyEnvironment();
|
|
19
|
+
return (
|
|
20
|
+
<span className="flex flex-wrap justify-end gap-x-1.5 gap-y-1 shrink-0">
|
|
21
|
+
{specsFor(shortcut, env).map((spec, index) => (
|
|
22
|
+
<React.Fragment key={spec}>
|
|
23
|
+
{index > 0 && <span className="text-xs text-text-muted self-center">or</span>}
|
|
24
|
+
<kbd className="px-1.5 py-0.5 rounded-sm border border-border bg-surface-alt text-xs font-sans font-semibold whitespace-nowrap">
|
|
25
|
+
{formatSpec(spec, env)}
|
|
26
|
+
</kbd>
|
|
27
|
+
</React.Fragment>
|
|
28
|
+
))}
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The keyboard shortcuts help dialog: what can be done from the keyboard *here*. It lists what is registered right now (see
|
|
35
|
+
* `useRegisteredShortcuts()`), so it shows the global shortcuts and those of the view that is on screen - and the compose window's while one
|
|
36
|
+
* is open - in groups, with the platform's own key names (Ctrl or Cmd, Alt or Option), and in the desktop client also the keys only it has.
|
|
37
|
+
* A shortcut a view cannot do at the moment (no message selected) is not registered, and so not listed.
|
|
38
|
+
*
|
|
39
|
+
* Built on `Modal`: focus moves into the dialog and stays there, Escape closes it, and it has an accessible name. `?` and Ctrl+/ close it too.
|
|
40
|
+
*/
|
|
41
|
+
export default function ShortcutsDialog({ open, onClose }: ShortcutsDialogProps) {
|
|
42
|
+
// Mounted only while open: the body subscribes to the registry, which every view's shortcuts change as it mounts - not something the
|
|
43
|
+
// whole app should re-render for while the dialog is closed.
|
|
44
|
+
return open ? <ShortcutsDialogBody onClose={onClose} /> : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function ShortcutsDialogBody({ onClose }: { onClose: () => void }) {
|
|
48
|
+
const registrations = useRegisteredShortcuts();
|
|
49
|
+
useShortcut(SHORTCUTS.global.help, onClose, { scope: "dialog" });
|
|
50
|
+
const groups = HELP_SCOPES.map((scope) => {
|
|
51
|
+
const listed = new Map<string, ShortcutDef>();
|
|
52
|
+
for (const registration of registrations) {
|
|
53
|
+
if (registration.scope === scope) {
|
|
54
|
+
listed.set(registration.shortcut.id, registration.shortcut);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { scope, shortcuts: [...listed.values()].sort((a, b) => shortcutRank(a) - shortcutRank(b)) };
|
|
58
|
+
}).filter((group) => group.shortcuts.length > 0);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Modal open onClose={onClose} title="Keyboard shortcuts">
|
|
62
|
+
<div className="flex flex-col gap-5">
|
|
63
|
+
{groups.map(({ scope, shortcuts }) => (
|
|
64
|
+
<section key={scope} aria-labelledby={`shortcuts-${scope}`}>
|
|
65
|
+
<h3 id={`shortcuts-${scope}`} className="text-xs font-bold uppercase tracking-wide text-text-muted mb-2">
|
|
66
|
+
{SCOPE_LABELS[scope]}
|
|
67
|
+
</h3>
|
|
68
|
+
<ul className="flex flex-col gap-1.5">
|
|
69
|
+
{shortcuts.map((shortcut) => (
|
|
70
|
+
<li key={shortcut.id} className="flex items-start justify-between gap-4 text-sm">
|
|
71
|
+
<span>{shortcut.label}</span>
|
|
72
|
+
<Keys shortcut={shortcut} />
|
|
73
|
+
</li>
|
|
74
|
+
))}
|
|
75
|
+
</ul>
|
|
76
|
+
</section>
|
|
77
|
+
))}
|
|
78
|
+
<p className="text-xs text-text-muted border-t border-border pt-3">
|
|
79
|
+
Some browsers keep a few keys for themselves, so a shortcut may not work everywhere.
|
|
80
|
+
</p>
|
|
81
|
+
</div>
|
|
82
|
+
</Modal>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import type { ShortcutScope } from "./keymap.js";
|
|
6
|
+
import { matchesEvent } from "./match.js";
|
|
7
|
+
import { ParsedSpec, resolveModifiers } from "./parse.js";
|
|
8
|
+
import type { KeyEnvironment } from "./platform.js";
|
|
9
|
+
import type { Registration, ShortcutRegistry } from "./registry.js";
|
|
10
|
+
import { isActivatable, isInPopoverDialog, isInWidget, isModalOpen, isPopupOpenAt, isTextEntry, regionScopeOf } from "./targets.js";
|
|
11
|
+
|
|
12
|
+
/** The keys of the four view scopes: only the mounted view has registrations, so precedence among them is moot. */
|
|
13
|
+
const VIEW_SCOPES: readonly ShortcutScope[] = ["mail", "calendar", "contacts", "tasks"];
|
|
14
|
+
|
|
15
|
+
/** Keys that move the caret or delete text, which a text field owns even with Ctrl or Alt held (word jumps, delete-word). */
|
|
16
|
+
const EDITING_KEYS = new Set(["arrowup", "arrowdown", "arrowleft", "arrowright", "home", "end", "pageup", "pagedown", "backspace", "delete"]);
|
|
17
|
+
|
|
18
|
+
/** The Copy / Cut / Paste / Select all / Undo / Redo / Find chords: never a shortcut, anywhere - they act on the page's selection, not on a view. */
|
|
19
|
+
function isReservedChord(parsed: ParsedSpec, env: KeyEnvironment): boolean {
|
|
20
|
+
const modifiers = resolveModifiers(parsed, env);
|
|
21
|
+
return (modifiers.ctrl || modifiers.meta) && !modifiers.alt && !modifiers.shift && ["a", "c", "v", "x", "z", "y", "f"].includes(parsed.key);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Paste as plain text (Ctrl+Shift+V) and Redo (Ctrl+Shift+Z): text-editing chords in a field, free everywhere else (Ctrl+Shift+V is Move to). */
|
|
25
|
+
function isShiftedEditingChord(parsed: ParsedSpec, env: KeyEnvironment): boolean {
|
|
26
|
+
const modifiers = resolveModifiers(parsed, env);
|
|
27
|
+
return (modifiers.ctrl || modifiers.meta) && !modifiers.alt && modifiers.shift && ["z", "v"].includes(parsed.key);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Whether `parsed` may fire with the event on this target.
|
|
32
|
+
*
|
|
33
|
+
* A text field (input, textarea, select, contenteditable - the rich-text editor) keeps everything that types or edits: bare keys
|
|
34
|
+
* (`j`, `?`, Delete), the caret keys with any modifier, and paste-as-plain-text and redo. A chord with Ctrl/Cmd/Alt works from one (that is how Ctrl+Enter sends from
|
|
35
|
+
* the body), except that Option on a Mac and Ctrl+Alt (AltGr) elsewhere type characters, so those don't. Escape works from a field unless a
|
|
36
|
+
* popup it owns is open (or it is in a popover dialog of its own). Outside a field, a bare key still isn't taken from a widget that reads keys itself (an open menu, a list box), and
|
|
37
|
+
* Enter/Space are left to the button or link that has the focus - unless the shortcut asked for them.
|
|
38
|
+
*/
|
|
39
|
+
function allowedOnTarget(registration: Registration, parsed: ParsedSpec, target: EventTarget | null, env: KeyEnvironment): boolean {
|
|
40
|
+
const modifiers = resolveModifiers(parsed, env);
|
|
41
|
+
const command = modifiers.ctrl || modifiers.meta || modifiers.alt;
|
|
42
|
+
if (parsed.key === "escape" && (isPopupOpenAt(target) || isInPopoverDialog(target))) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (isTextEntry(target)) {
|
|
46
|
+
if (parsed.key === "escape") {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (!command || EDITING_KEYS.has(parsed.key) || isShiftedEditingChord(parsed, env)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return !(modifiers.alt && !modifiers.meta && (env.mac || modifiers.ctrl));
|
|
53
|
+
}
|
|
54
|
+
if (!command) {
|
|
55
|
+
if (isInWidget(target)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if ((parsed.key === "enter" || parsed.key === " ") && !registration.shortcut.allowOnActivatable && isActivatable(target)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The scopes that may act on this event, highest precedence first. */
|
|
66
|
+
function activeScopes(event: KeyboardEvent, doc: Document): readonly ShortcutScope[] {
|
|
67
|
+
if (isModalOpen(doc)) {
|
|
68
|
+
return ["dialog"];
|
|
69
|
+
}
|
|
70
|
+
if (regionScopeOf(event.target) === "compose") {
|
|
71
|
+
return ["compose", "global"];
|
|
72
|
+
}
|
|
73
|
+
return [...VIEW_SCOPES, "global"];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Whether the registration applies to where the event happened (a compose window's shortcuts only inside it). */
|
|
77
|
+
function inContainer(registration: Registration, event: KeyboardEvent): boolean {
|
|
78
|
+
if (!registration.container) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return !!registration.container.current?.contains(event.target as Node | null);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Handles one `keydown`: finds the registered shortcut it is, and runs its handler. Returns whether a handler ran - and only then is the
|
|
86
|
+
* event's default prevented and its propagation stopped, so a key nobody claims (or a handler that declines) behaves exactly as if this layer
|
|
87
|
+
* did not exist.
|
|
88
|
+
*
|
|
89
|
+
* Skipped outright: an event some other handler already `defaultPrevented` (a menu, the rich-text editor's own bindings), one from an IME
|
|
90
|
+
* composition, a bare modifier key, and the Copy/Cut/Paste/Select all/Undo/Redo/Find chords. A held key repeats: an action that is not
|
|
91
|
+
* marked `repeat` runs on the first press only, and the repeats are swallowed (so a browser doesn't reload on a held Ctrl+R) without running it.
|
|
92
|
+
*
|
|
93
|
+
* Which registration wins: the dialog scope alone while a modal is open; else, inside a compose window, `compose` then `global`; else
|
|
94
|
+
* whichever view is mounted, then `global`. Within a scope the most recently mounted registration goes first, and one that returns
|
|
95
|
+
* `false` passes the key on to the next.
|
|
96
|
+
*/
|
|
97
|
+
export function dispatchKeyEvent(registry: ShortcutRegistry, event: KeyboardEvent, env: KeyEnvironment, doc: Document): boolean {
|
|
98
|
+
if (event.defaultPrevented || event.isComposing || event.key === "Process" || ["Control", "Shift", "Alt", "Meta"].includes(event.key)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
const scopes = activeScopes(event, doc);
|
|
102
|
+
const candidates = registry
|
|
103
|
+
.getSnapshot()
|
|
104
|
+
.filter((registration) => scopes.includes(registration.scope) && inContainer(registration, event))
|
|
105
|
+
.sort((a, b) => scopes.indexOf(a.scope) - scopes.indexOf(b.scope) || b.order - a.order);
|
|
106
|
+
for (const registration of candidates) {
|
|
107
|
+
const specs = env.electron ? [...registration.keys, ...registration.electronKeys] : registration.keys;
|
|
108
|
+
const parsed = specs.find((spec) => matchesEvent(spec, event, env));
|
|
109
|
+
if (!parsed || isReservedChord(parsed, env) || !allowedOnTarget(registration, parsed, event.target, env)) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (event.repeat && !registration.shortcut.repeat) {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
if (registration.run(event) !== false) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|