@remit/ui 0.0.223 → 0.0.225
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/category-presentation.d.ts +75 -0
- package/dist/category-presentation.js +94 -0
- package/dist/components/DropdownMenu.d.ts +15 -0
- package/dist/components/DropdownMenu.js +33 -0
- package/dist/components/EmptyState.d.ts +6 -0
- package/dist/components/EmptyState.js +2 -0
- package/dist/components/ErrorBanner.d.ts +27 -0
- package/dist/components/ErrorBanner.js +39 -0
- package/dist/components/ErrorBannerStack.d.ts +7 -0
- package/dist/components/ErrorBannerStack.js +7 -0
- package/dist/components/ErrorState.d.ts +9 -0
- package/dist/components/ErrorState.js +22 -0
- package/dist/components/KeyboardShortcutsModal.d.ts +11 -0
- package/dist/components/KeyboardShortcutsModal.js +26 -0
- package/dist/components/account-menu.d.ts +5 -0
- package/dist/components/account-menu.js +23 -0
- package/dist/components/account-service-change-dialog.d.ts +47 -0
- package/dist/components/account-service-change-dialog.js +60 -0
- package/dist/components/account-service-choice.d.ts +22 -0
- package/dist/components/account-service-choice.js +37 -0
- package/dist/components/account-service-status.d.ts +41 -0
- package/dist/components/account-service-status.js +45 -0
- package/dist/components/account-service-toggles.d.ts +31 -0
- package/dist/components/account-service-toggles.js +31 -0
- package/dist/components/address-display.d.ts +36 -0
- package/dist/components/address-display.js +28 -0
- package/dist/components/address-tag.d.ts +12 -0
- package/dist/components/address-tag.js +9 -0
- package/dist/components/agenda-flow.d.ts +65 -0
- package/dist/components/agenda-flow.js +363 -0
- package/dist/components/agenda-panels.d.ts +18 -0
- package/dist/components/agenda-panels.js +33 -0
- package/dist/components/app-password-hint.d.ts +5 -0
- package/dist/components/app-password-hint.js +4 -0
- package/dist/components/app-shell-slotted.d.ts +113 -0
- package/dist/components/app-shell-slotted.js +75 -0
- package/dist/components/app-shell-types.d.ts +340 -0
- package/dist/components/app-shell-types.js +72 -0
- package/dist/components/app-switcher.d.ts +15 -0
- package/dist/components/app-switcher.js +31 -0
- package/dist/components/app-top-bar.d.ts +32 -0
- package/dist/components/app-top-bar.js +19 -0
- package/dist/components/attachment-list.d.ts +59 -0
- package/dist/components/attachment-list.js +37 -0
- package/dist/components/attendee-row.d.ts +43 -0
- package/dist/components/attendee-row.js +75 -0
- package/dist/components/attention-dot.d.ts +6 -0
- package/dist/components/attention-dot.js +4 -0
- package/dist/components/auth-card.d.ts +13 -0
- package/dist/components/auth-card.js +14 -0
- package/dist/components/auth-footer.d.ts +5 -0
- package/dist/components/auth-footer.js +6 -0
- package/dist/components/auth-hero.d.ts +7 -0
- package/dist/components/auth-hero.js +5 -0
- package/dist/components/auto-moved-badge.d.ts +26 -0
- package/dist/components/auto-moved-badge.js +20 -0
- package/dist/components/avatar.d.ts +7 -0
- package/dist/components/avatar.js +39 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.js +20 -0
- package/dist/components/banner.d.ts +9 -0
- package/dist/components/banner.js +29 -0
- package/dist/components/blocked-reason.d.ts +22 -0
- package/dist/components/blocked-reason.js +18 -0
- package/dist/components/bottom-sheet.d.ts +17 -0
- package/dist/components/bottom-sheet.js +84 -0
- package/dist/components/brief-empty.d.ts +24 -0
- package/dist/components/brief-empty.js +18 -0
- package/dist/components/brief-section.d.ts +49 -0
- package/dist/components/brief-section.js +71 -0
- package/dist/components/brief-sections.d.ts +97 -0
- package/dist/components/brief-sections.js +56 -0
- package/dist/components/button.d.ts +24 -0
- package/dist/components/button.js +27 -0
- package/dist/components/calendar-clash-strip.d.ts +14 -0
- package/dist/components/calendar-clash-strip.js +10 -0
- package/dist/components/calendar-event-chip-content.d.ts +28 -0
- package/dist/components/calendar-event-chip-content.js +18 -0
- package/dist/components/calendar-event-chip.d.ts +46 -0
- package/dist/components/calendar-event-chip.js +28 -0
- package/dist/components/calendar-event-popup.d.ts +43 -0
- package/dist/components/calendar-event-popup.js +18 -0
- package/dist/components/calendar-event-sidebar.d.ts +34 -0
- package/dist/components/calendar-event-sidebar.js +16 -0
- package/dist/components/calendar-failure-note.d.ts +12 -0
- package/dist/components/calendar-failure-note.js +10 -0
- package/dist/components/calendar-grid.d.ts +26 -0
- package/dist/components/calendar-grid.js +120 -0
- package/dist/components/calendar-invite-card.d.ts +66 -0
- package/dist/components/calendar-invite-card.js +42 -0
- package/dist/components/calendar-list.d.ts +32 -0
- package/dist/components/calendar-list.js +66 -0
- package/dist/components/calendar-parse-badge.d.ts +13 -0
- package/dist/components/calendar-parse-badge.js +32 -0
- package/dist/components/calendar-popover.d.ts +25 -0
- package/dist/components/calendar-popover.js +84 -0
- package/dist/components/calendar-quick-create.d.ts +35 -0
- package/dist/components/calendar-quick-create.js +26 -0
- package/dist/components/calendar-screen-toolbar.d.ts +30 -0
- package/dist/components/calendar-screen-toolbar.js +24 -0
- package/dist/components/calendar-sheet.d.ts +14 -0
- package/dist/components/calendar-sheet.js +34 -0
- package/dist/components/calendar-side-pane.d.ts +20 -0
- package/dist/components/calendar-side-pane.js +11 -0
- package/dist/components/calendar-slot-offers.d.ts +19 -0
- package/dist/components/calendar-slot-offers.js +12 -0
- package/dist/components/calendar-suggestion-deck.d.ts +18 -0
- package/dist/components/calendar-suggestion-deck.js +51 -0
- package/dist/components/calendar-time-grid.d.ts +64 -0
- package/dist/components/calendar-time-grid.js +666 -0
- package/dist/components/calendar-toolbar.d.ts +22 -0
- package/dist/components/calendar-toolbar.js +17 -0
- package/dist/components/calendar-types.d.ts +231 -0
- package/dist/components/calendar-types.js +13 -0
- package/dist/components/calendar-year.d.ts +11 -0
- package/dist/components/calendar-year.js +9 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.js +14 -0
- package/dist/components/category-badge.d.ts +16 -0
- package/dist/components/category-badge.js +19 -0
- package/dist/components/checkbox.d.ts +10 -0
- package/dist/components/checkbox.js +20 -0
- package/dist/components/compose-action-bar.d.ts +53 -0
- package/dist/components/compose-action-bar.js +55 -0
- package/dist/components/compose-address-field.d.ts +47 -0
- package/dist/components/compose-address-field.js +141 -0
- package/dist/components/compose-attachments.d.ts +33 -0
- package/dist/components/compose-attachments.js +24 -0
- package/dist/components/compose-body-skeleton.d.ts +1 -0
- package/dist/components/compose-body-skeleton.js +2 -0
- package/dist/components/compose-body.d.ts +56 -0
- package/dist/components/compose-body.js +106 -0
- package/dist/components/compose-fab.d.ts +4 -0
- package/dist/components/compose-fab.js +7 -0
- package/dist/components/compose-form-shell.d.ts +44 -0
- package/dist/components/compose-form-shell.js +55 -0
- package/dist/components/compose-header.d.ts +39 -0
- package/dist/components/compose-header.js +27 -0
- package/dist/components/compose-language-chip.d.ts +28 -0
- package/dist/components/compose-language-chip.js +72 -0
- package/dist/components/compose-language-setting.d.ts +13 -0
- package/dist/components/compose-language-setting.js +24 -0
- package/dist/components/compose-mode-toggle.d.ts +12 -0
- package/dist/components/compose-mode-toggle.js +10 -0
- package/dist/components/compose-quote-missing-banner.d.ts +18 -0
- package/dist/components/compose-quote-missing-banner.js +17 -0
- package/dist/components/compose-smtp-missing-banner.d.ts +19 -0
- package/dist/components/compose-smtp-missing-banner.js +15 -0
- package/dist/components/compose-subject-field.d.ts +5 -0
- package/dist/components/compose-subject-field.js +2 -0
- package/dist/components/confirm-dialog.d.ts +22 -0
- package/dist/components/confirm-dialog.js +34 -0
- package/dist/components/danger-zone-section.d.ts +13 -0
- package/dist/components/danger-zone-section.js +10 -0
- package/dist/components/dialog-backdrop.d.ts +15 -0
- package/dist/components/dialog-backdrop.js +11 -0
- package/dist/components/dialog.d.ts +16 -0
- package/dist/components/dialog.js +27 -0
- package/dist/components/editor-focus.d.ts +14 -0
- package/dist/components/editor-focus.js +85 -0
- package/dist/components/email-frame-css.d.ts +103 -0
- package/dist/components/email-frame-css.js +169 -0
- package/dist/components/event-editor-pane.d.ts +18 -0
- package/dist/components/event-editor-pane.js +13 -0
- package/dist/components/event-editor.d.ts +91 -0
- package/dist/components/event-editor.js +155 -0
- package/dist/components/event-suggestion-card.d.ts +69 -0
- package/dist/components/event-suggestion-card.js +73 -0
- package/dist/components/field-label.d.ts +6 -0
- package/dist/components/field-label.js +7 -0
- package/dist/components/filter-clause-chip.d.ts +49 -0
- package/dist/components/filter-clause-chip.js +46 -0
- package/dist/components/filter-preview-count.d.ts +10 -0
- package/dist/components/filter-preview-count.js +24 -0
- package/dist/components/filter-rule-editor.d.ts +80 -0
- package/dist/components/filter-rule-editor.js +168 -0
- package/dist/components/filter-rule.d.ts +169 -0
- package/dist/components/filter-rule.js +291 -0
- package/dist/components/filter-sheet.d.ts +106 -0
- package/dist/components/filter-sheet.js +131 -0
- package/dist/components/flow-screen.d.ts +47 -0
- package/dist/components/flow-screen.js +41 -0
- package/dist/components/folder-manage-actions.d.ts +16 -0
- package/dist/components/folder-manage-actions.js +14 -0
- package/dist/components/folder-manager.d.ts +32 -0
- package/dist/components/folder-manager.js +22 -0
- package/dist/components/folder-mutation-dialog.d.ts +21 -0
- package/dist/components/folder-mutation-dialog.js +48 -0
- package/dist/components/folder-rename-dialog.d.ts +19 -0
- package/dist/components/folder-rename-dialog.js +24 -0
- package/dist/components/folder-role.d.ts +33 -0
- package/dist/components/folder-role.js +79 -0
- package/dist/components/folder-row.d.ts +60 -0
- package/dist/components/folder-row.js +28 -0
- package/dist/components/folder-sync-state.d.ts +27 -0
- package/dist/components/folder-sync-state.js +62 -0
- package/dist/components/folder-tree-picker.d.ts +77 -0
- package/dist/components/folder-tree-picker.js +281 -0
- package/dist/components/input.d.ts +20 -0
- package/dist/components/input.js +9 -0
- package/dist/components/intelligence-calendar-fixtures.d.ts +18 -0
- package/dist/components/intelligence-calendar-fixtures.js +318 -0
- package/dist/components/intelligence-calendar.d.ts +107 -0
- package/dist/components/intelligence-calendar.js +43 -0
- package/dist/components/intelligence-panel.d.ts +145 -0
- package/dist/components/intelligence-panel.js +67 -0
- package/dist/components/intelligence-section.d.ts +7 -0
- package/dist/components/intelligence-section.js +6 -0
- package/dist/components/intelligence-toggle.d.ts +27 -0
- package/dist/components/intelligence-toggle.js +21 -0
- package/dist/components/isolated-email-frame.d.ts +85 -0
- package/dist/components/isolated-email-frame.js +265 -0
- package/dist/components/kbd.d.ts +4 -0
- package/dist/components/kbd.js +6 -0
- package/dist/components/keyboard-hint-bar.d.ts +13 -0
- package/dist/components/keyboard-hint-bar.js +18 -0
- package/dist/components/label-chip.d.ts +18 -0
- package/dist/components/label-chip.js +15 -0
- package/dist/components/list-result-header.d.ts +30 -0
- package/dist/components/list-result-header.js +19 -0
- package/dist/components/mail-action-toolbar.d.ts +56 -0
- package/dist/components/mail-action-toolbar.js +29 -0
- package/dist/components/mail-header.d.ts +53 -0
- package/dist/components/mail-header.js +30 -0
- package/dist/components/mcp-connected-apps-page.d.ts +13 -0
- package/dist/components/mcp-connected-apps-page.js +13 -0
- package/dist/components/mcp-consent-page.d.ts +7 -0
- package/dist/components/mcp-consent-page.js +7 -0
- package/dist/components/mcp-device-page.d.ts +17 -0
- package/dist/components/mcp-device-page.js +24 -0
- package/dist/components/mcp-error-notice.d.ts +5 -0
- package/dist/components/mcp-error-notice.js +5 -0
- package/dist/components/mcp-error-page.d.ts +6 -0
- package/dist/components/mcp-error-page.js +6 -0
- package/dist/components/mcp-fixtures.d.ts +3 -0
- package/dist/components/mcp-fixtures.js +13 -0
- package/dist/components/mcp-login-page.d.ts +7 -0
- package/dist/components/mcp-login-page.js +8 -0
- package/dist/components/mcp-page.d.ts +16 -0
- package/dist/components/mcp-page.js +6 -0
- package/dist/components/mcp-permission-list.d.ts +5 -0
- package/dist/components/mcp-permission-list.js +5 -0
- package/dist/components/message-body-view.d.ts +66 -0
- package/dist/components/message-body-view.js +83 -0
- package/dist/components/message-list-pane.d.ts +72 -0
- package/dist/components/message-list-pane.js +133 -0
- package/dist/components/message-list-state.d.ts +78 -0
- package/dist/components/message-list-state.js +77 -0
- package/dist/components/message-report-dialog.d.ts +16 -0
- package/dist/components/message-report-dialog.js +14 -0
- package/dist/components/message-row.d.ts +93 -0
- package/dist/components/message-row.js +132 -0
- package/dist/components/message-settlement.d.ts +66 -0
- package/dist/components/message-settlement.js +38 -0
- package/dist/components/mini-month.d.ts +19 -0
- package/dist/components/mini-month.js +34 -0
- package/dist/components/mobile-message-action-bar.d.ts +45 -0
- package/dist/components/mobile-message-action-bar.js +44 -0
- package/dist/components/mobile-reading-pane.d.ts +56 -0
- package/dist/components/mobile-reading-pane.js +55 -0
- package/dist/components/mobile-search-view.d.ts +81 -0
- package/dist/components/mobile-search-view.js +32 -0
- package/dist/components/nav-link-surface.d.ts +25 -0
- package/dist/components/nav-link-surface.js +37 -0
- package/dist/components/nav-sidebar.d.ts +34 -0
- package/dist/components/nav-sidebar.js +153 -0
- package/dist/components/nav-toggle-button.d.ts +1 -0
- package/dist/components/nav-toggle-button.js +21 -0
- package/dist/components/new-folder-action.d.ts +20 -0
- package/dist/components/new-folder-action.js +8 -0
- package/dist/components/new-folder-form.d.ts +28 -0
- package/dist/components/new-folder-form.js +43 -0
- package/dist/components/outbox-row.d.ts +24 -0
- package/dist/components/outbox-row.js +56 -0
- package/dist/components/outbox-status-badge.d.ts +19 -0
- package/dist/components/outbox-status-badge.js +26 -0
- package/dist/components/pane-header.d.ts +8 -0
- package/dist/components/pane-header.js +5 -0
- package/dist/components/password-input.d.ts +13 -0
- package/dist/components/password-input.js +18 -0
- package/dist/components/plain-text-editor.d.ts +30 -0
- package/dist/components/plain-text-editor.js +121 -0
- package/dist/components/popover-menu.d.ts +110 -0
- package/dist/components/popover-menu.js +165 -0
- package/dist/components/progress-bar.d.ts +18 -0
- package/dist/components/progress-bar.js +22 -0
- package/dist/components/pull-to-refresh.d.ts +16 -0
- package/dist/components/pull-to-refresh.js +20 -0
- package/dist/components/quarantine-entry-row.d.ts +11 -0
- package/dist/components/quarantine-entry-row.js +21 -0
- package/dist/components/quarantine-fixtures.d.ts +7 -0
- package/dist/components/quarantine-fixtures.js +111 -0
- package/dist/components/quarantine-report.d.ts +146 -0
- package/dist/components/quarantine-report.js +90 -0
- package/dist/components/quarantine-section.d.ts +14 -0
- package/dist/components/quarantine-section.js +15 -0
- package/dist/components/quoted-text.d.ts +19 -0
- package/dist/components/quoted-text.js +20 -0
- package/dist/components/reading-pane-empty.d.ts +17 -0
- package/dist/components/reading-pane-empty.js +13 -0
- package/dist/components/reading-pane.d.ts +82 -0
- package/dist/components/reading-pane.js +83 -0
- package/dist/components/recurrence-scope-prompt.d.ts +20 -0
- package/dist/components/recurrence-scope-prompt.js +25 -0
- package/dist/components/refresh-button.d.ts +36 -0
- package/dist/components/refresh-button.js +33 -0
- package/dist/components/rescue-banner.d.ts +13 -0
- package/dist/components/rescue-banner.js +12 -0
- package/dist/components/rescue-candidate-row.d.ts +31 -0
- package/dist/components/rescue-candidate-row.js +19 -0
- package/dist/components/rescue-from-spam-flow.d.ts +32 -0
- package/dist/components/rescue-from-spam-flow.js +86 -0
- package/dist/components/rescue-sender-group.d.ts +46 -0
- package/dist/components/rescue-sender-group.js +69 -0
- package/dist/components/resizable.d.ts +33 -0
- package/dist/components/resizable.js +49 -0
- package/dist/components/rich-text-correction-menu.d.ts +30 -0
- package/dist/components/rich-text-correction-menu.js +74 -0
- package/dist/components/rich-text-document.d.ts +29 -0
- package/dist/components/rich-text-document.js +102 -0
- package/dist/components/rich-text-editor.d.ts +40 -0
- package/dist/components/rich-text-editor.js +746 -0
- package/dist/components/rich-text-image-node.d.ts +48 -0
- package/dist/components/rich-text-image-node.js +99 -0
- package/dist/components/rich-text-inline-images.d.ts +17 -0
- package/dist/components/rich-text-inline-images.js +180 -0
- package/dist/components/rich-text-markdown.d.ts +20 -0
- package/dist/components/rich-text-markdown.js +130 -0
- package/dist/components/rich-text-nodes.d.ts +9 -0
- package/dist/components/rich-text-nodes.js +60 -0
- package/dist/components/rich-text-spellcheck-double.d.ts +2 -0
- package/dist/components/rich-text-spellcheck-double.js +56 -0
- package/dist/components/rich-text-spellcheck-engine.d.ts +58 -0
- package/dist/components/rich-text-spellcheck-engine.js +156 -0
- package/dist/components/rich-text-spellcheck-languages.d.ts +31 -0
- package/dist/components/rich-text-spellcheck-languages.js +50 -0
- package/dist/components/rich-text-spellcheck-notice.d.ts +26 -0
- package/dist/components/rich-text-spellcheck-notice.js +55 -0
- package/dist/components/rich-text-spellcheck-provider.d.ts +28 -0
- package/dist/components/rich-text-spellcheck-provider.js +154 -0
- package/dist/components/rich-text-spellcheck-words.d.ts +19 -0
- package/dist/components/rich-text-spellcheck-words.js +26 -0
- package/dist/components/rich-text-spellcheck-worker-provider.d.ts +11 -0
- package/dist/components/rich-text-spellcheck-worker-provider.js +24 -0
- package/dist/components/rich-text-spellcheck-worker.d.ts +11 -0
- package/dist/components/rich-text-spellcheck-worker.js +79 -0
- package/dist/components/rich-text-spellcheck.d.ts +126 -0
- package/dist/components/rich-text-spellcheck.js +8 -0
- package/dist/components/rich-text-toolbar.d.ts +9 -0
- package/dist/components/rich-text-toolbar.js +88 -0
- package/dist/components/rich-text-value.d.ts +28 -0
- package/dist/components/rich-text-value.js +5 -0
- package/dist/components/role-appointment-list.d.ts +46 -0
- package/dist/components/role-appointment-list.js +125 -0
- package/dist/components/role-appointment-prompt.d.ts +78 -0
- package/dist/components/role-appointment-prompt.js +140 -0
- package/dist/components/row-actions.d.ts +45 -0
- package/dist/components/row-actions.js +42 -0
- package/dist/components/search-bar.d.ts +57 -0
- package/dist/components/search-bar.js +9 -0
- package/dist/components/search-chip-input.d.ts +138 -0
- package/dist/components/search-chip-input.js +226 -0
- package/dist/components/search-chip-keys.d.ts +92 -0
- package/dist/components/search-chip-keys.js +90 -0
- package/dist/components/search-conversion-notice.d.ts +12 -0
- package/dist/components/search-conversion-notice.js +18 -0
- package/dist/components/search-conversion.d.ts +27 -0
- package/dist/components/search-conversion.js +45 -0
- package/dist/components/search-result-row.d.ts +58 -0
- package/dist/components/search-result-row.js +41 -0
- package/dist/components/search-results.d.ts +124 -0
- package/dist/components/search-results.js +156 -0
- package/dist/components/search-token-chip.d.ts +53 -0
- package/dist/components/search-token-chip.js +49 -0
- package/dist/components/security-select.d.ts +12 -0
- package/dist/components/security-select.js +14 -0
- package/dist/components/segmented-control.d.ts +13 -0
- package/dist/components/segmented-control.js +19 -0
- package/dist/components/select.d.ts +12 -0
- package/dist/components/select.js +10 -0
- package/dist/components/selection-top-bar.d.ts +122 -0
- package/dist/components/selection-top-bar.js +48 -0
- package/dist/components/selection-wizard-fixtures.d.ts +12 -0
- package/dist/components/selection-wizard-fixtures.js +320 -0
- package/dist/components/selection-wizard.d.ts +296 -0
- package/dist/components/selection-wizard.js +280 -0
- package/dist/components/self-update-confirm-dialog.d.ts +20 -0
- package/dist/components/self-update-confirm-dialog.js +20 -0
- package/dist/components/self-update-progress-overlay.d.ts +25 -0
- package/dist/components/self-update-progress-overlay.js +44 -0
- package/dist/components/self-update-section.d.ts +24 -0
- package/dist/components/self-update-section.js +82 -0
- package/dist/components/self-update.d.ts +113 -0
- package/dist/components/self-update.js +52 -0
- package/dist/components/sender-group-switch.d.ts +16 -0
- package/dist/components/sender-group-switch.js +15 -0
- package/dist/components/sender-trust-indicator.d.ts +32 -0
- package/dist/components/sender-trust-indicator.js +44 -0
- package/dist/components/settings-screen.d.ts +50 -0
- package/dist/components/settings-screen.js +34 -0
- package/dist/components/shell-top-bar.d.ts +42 -0
- package/dist/components/shell-top-bar.js +39 -0
- package/dist/components/slide-panel.d.ts +9 -0
- package/dist/components/slide-panel.js +19 -0
- package/dist/components/spam-results-offer.d.ts +37 -0
- package/dist/components/spam-results-offer.js +28 -0
- package/dist/components/suggest-list.d.ts +32 -0
- package/dist/components/suggest-list.js +26 -0
- package/dist/components/swipeable-row.d.ts +20 -0
- package/dist/components/swipeable-row.js +122 -0
- package/dist/components/sync-warning-fixtures.d.ts +2 -0
- package/dist/components/sync-warning-fixtures.js +20 -0
- package/dist/components/sync-warning-report.d.ts +13 -0
- package/dist/components/sync-warning-report.js +21 -0
- package/dist/components/sync-warning-row.d.ts +6 -0
- package/dist/components/sync-warning-row.js +15 -0
- package/dist/components/sync-warning-section.d.ts +7 -0
- package/dist/components/sync-warning-section.js +6 -0
- package/dist/components/touch-list.d.ts +20 -0
- package/dist/components/touch-list.js +32 -0
- package/dist/components/use-compose-language.d.ts +34 -0
- package/dist/components/use-compose-language.js +40 -0
- package/dist/components/wizard.d.ts +53 -0
- package/dist/components/wizard.js +57 -0
- package/dist/filter-presets.d.ts +38 -0
- package/dist/filter-presets.js +53 -0
- package/dist/index.d.ts +226 -0
- package/dist/index.js +225 -0
- package/dist/lib/abort.d.ts +7 -0
- package/dist/lib/abort.js +10 -0
- package/dist/lib/adopted-html.d.ts +9 -0
- package/dist/lib/adopted-html.js +144 -0
- package/dist/lib/agenda-time.d.ts +155 -0
- package/dist/lib/agenda-time.js +421 -0
- package/dist/lib/attachment-file.d.ts +27 -0
- package/dist/lib/attachment-file.js +84 -0
- package/dist/lib/brief-filter-query.d.ts +57 -0
- package/dist/lib/brief-filter-query.js +127 -0
- package/dist/lib/brief-filters.d.ts +50 -0
- package/dist/lib/brief-filters.js +66 -0
- package/dist/lib/calendar-color.d.ts +20 -0
- package/dist/lib/calendar-color.js +47 -0
- package/dist/lib/calendar-event-shell.d.ts +30 -0
- package/dist/lib/calendar-event-shell.js +21 -0
- package/dist/lib/calendar-range.d.ts +10 -0
- package/dist/lib/calendar-range.js +39 -0
- package/dist/lib/calendar-slot-pick.d.ts +47 -0
- package/dist/lib/calendar-slot-pick.js +128 -0
- package/dist/lib/cid-resolver.d.ts +23 -0
- package/dist/lib/cid-resolver.js +16 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +6 -0
- package/dist/lib/compose-language.d.ts +79 -0
- package/dist/lib/compose-language.js +182 -0
- package/dist/lib/compose-mode.d.ts +29 -0
- package/dist/lib/compose-mode.js +33 -0
- package/dist/lib/detect-compose-language.d.ts +19 -0
- package/dist/lib/detect-compose-language.js +38 -0
- package/dist/lib/email-layout-clamp.d.ts +26 -0
- package/dist/lib/email-layout-clamp.js +81 -0
- package/dist/lib/email-render-treatment.d.ts +36 -0
- package/dist/lib/email-render-treatment.js +28 -0
- package/dist/lib/email-sanitizer.d.ts +89 -0
- package/dist/lib/email-sanitizer.js +416 -0
- package/dist/lib/event-drag.d.ts +20 -0
- package/dist/lib/event-drag.js +50 -0
- package/dist/lib/event-phrase.d.ts +2 -0
- package/dist/lib/event-phrase.js +11 -0
- package/dist/lib/folder-tree-focus.d.ts +8 -0
- package/dist/lib/folder-tree-focus.js +43 -0
- package/dist/lib/folder-tree.d.ts +79 -0
- package/dist/lib/folder-tree.js +156 -0
- package/dist/lib/grid-keyboard.d.ts +15 -0
- package/dist/lib/grid-keyboard.js +46 -0
- package/dist/lib/iso-week.d.ts +2 -0
- package/dist/lib/iso-week.js +13 -0
- package/dist/lib/keymap-dispatch.d.ts +69 -0
- package/dist/lib/keymap-dispatch.js +171 -0
- package/dist/lib/keymap.d.ts +68 -0
- package/dist/lib/keymap.js +220 -0
- package/dist/lib/label-color.d.ts +13 -0
- package/dist/lib/label-color.js +25 -0
- package/dist/lib/layout-breakpoints.d.ts +11 -0
- package/dist/lib/layout-breakpoints.js +11 -0
- package/dist/lib/long-press.d.ts +25 -0
- package/dist/lib/long-press.js +37 -0
- package/dist/lib/mini-month.d.ts +27 -0
- package/dist/lib/mini-month.js +33 -0
- package/dist/lib/overlay-scope.d.ts +45 -0
- package/dist/lib/overlay-scope.js +167 -0
- package/dist/lib/parse-address-input.d.ts +20 -0
- package/dist/lib/parse-address-input.js +66 -0
- package/dist/lib/popup-placement.d.ts +22 -0
- package/dist/lib/popup-placement.js +39 -0
- package/dist/lib/property-prefill.d.ts +24 -0
- package/dist/lib/property-prefill.js +133 -0
- package/dist/lib/recurrence.d.ts +69 -0
- package/dist/lib/recurrence.js +199 -0
- package/dist/lib/roving-focus.d.ts +46 -0
- package/dist/lib/roving-focus.js +92 -0
- package/dist/lib/row-keyboard.d.ts +17 -0
- package/dist/lib/row-keyboard.js +17 -0
- package/dist/lib/rule-name.d.ts +15 -0
- package/dist/lib/rule-name.js +16 -0
- package/dist/lib/search-query-words.d.ts +46 -0
- package/dist/lib/search-query-words.js +71 -0
- package/dist/lib/search-rule.d.ts +52 -0
- package/dist/lib/search-rule.js +21 -0
- package/dist/lib/sender-derivation.d.ts +51 -0
- package/dist/lib/sender-derivation.js +109 -0
- package/dist/lib/shortcut-tree.d.ts +211 -0
- package/dist/lib/shortcut-tree.js +192 -0
- package/dist/lib/suggest-keys.d.ts +46 -0
- package/dist/lib/suggest-keys.js +33 -0
- package/dist/lib/swipe-config.d.ts +17 -0
- package/dist/lib/swipe-config.js +10 -0
- package/dist/lib/time-grid-layout.d.ts +38 -0
- package/dist/lib/time-grid-layout.js +94 -0
- package/dist/lib/use-list-cursor.d.ts +61 -0
- package/dist/lib/use-list-cursor.js +160 -0
- package/dist/lib/use-list-keyboard.d.ts +24 -0
- package/dist/lib/use-list-keyboard.js +73 -0
- package/dist/lib/use-long-press.d.ts +27 -0
- package/dist/lib/use-long-press.js +100 -0
- package/dist/lib/use-match-media.d.ts +7 -0
- package/dist/lib/use-match-media.js +24 -0
- package/dist/lib/use-modal-focus.d.ts +15 -0
- package/dist/lib/use-modal-focus.js +148 -0
- package/dist/lib/use-rendered-row-ids.d.ts +10 -0
- package/dist/lib/use-rendered-row-ids.js +46 -0
- package/dist/lib/use-selection.d.ts +129 -0
- package/dist/lib/use-selection.js +202 -0
- package/dist/lib/use-suggest-list.d.ts +52 -0
- package/dist/lib/use-suggest-list.js +78 -0
- package/dist/lib/use-swipe-navigation.d.ts +21 -0
- package/dist/lib/use-swipe-navigation.js +61 -0
- package/dist/lib/use-triage-keyboard.d.ts +50 -0
- package/dist/lib/use-triage-keyboard.js +100 -0
- package/dist/lib/wizard-steps.d.ts +282 -0
- package/dist/lib/wizard-steps.js +437 -0
- package/dist/mcp-pages.d.ts +8 -0
- package/dist/mcp-pages.js +8 -0
- package/dist/rich-text.d.ts +21 -0
- package/dist/rich-text.js +18 -0
- package/dist/tokens.css +336 -0
- package/package.json +95 -81
- package/src/category-presentation.ts +0 -147
- package/src/components/DropdownMenu.tsx +0 -100
- package/src/components/EmptyState.tsx +0 -11
- package/src/components/ErrorBanner.render.test.ts +0 -107
- package/src/components/ErrorBanner.stories.tsx +0 -132
- package/src/components/ErrorBanner.tsx +0 -122
- package/src/components/ErrorBannerStack.tsx +0 -34
- package/src/components/ErrorState.render.test.ts +0 -82
- package/src/components/ErrorState.tsx +0 -80
- package/src/components/KeyboardShortcutsModal.tsx +0 -111
- package/src/components/account-menu.stories.tsx +0 -91
- package/src/components/account-menu.tsx +0 -78
- package/src/components/account-service-change-dialog.render.test.ts +0 -33
- package/src/components/account-service-change-dialog.stories.tsx +0 -66
- package/src/components/account-service-change-dialog.tsx +0 -117
- package/src/components/account-service-choice.render.test.ts +0 -126
- package/src/components/account-service-choice.stories.tsx +0 -122
- package/src/components/account-service-choice.tsx +0 -97
- package/src/components/account-service-status.stories.tsx +0 -61
- package/src/components/account-service-status.tsx +0 -89
- package/src/components/account-service-toggles.render.test.ts +0 -122
- package/src/components/account-service-toggles.stories.tsx +0 -141
- package/src/components/account-service-toggles.tsx +0 -132
- package/src/components/address-display.render.test.ts +0 -56
- package/src/components/address-display.stories.tsx +0 -55
- package/src/components/address-display.tsx +0 -132
- package/src/components/address-tag.render.test.ts +0 -28
- package/src/components/address-tag.stories.tsx +0 -41
- package/src/components/address-tag.tsx +0 -38
- package/src/components/agenda-flow.reach.test.ts +0 -374
- package/src/components/agenda-flow.render.test.ts +0 -228
- package/src/components/agenda-flow.stories.tsx +0 -231
- package/src/components/agenda-flow.tsx +0 -1122
- package/src/components/agenda-panels.render.test.ts +0 -132
- package/src/components/agenda-panels.stories.tsx +0 -137
- package/src/components/agenda-panels.tsx +0 -171
- package/src/components/app-password-hint.stories.tsx +0 -19
- package/src/components/app-password-hint.tsx +0 -24
- package/src/components/app-shell-slotted.render.test.ts +0 -136
- package/src/components/app-shell-slotted.tsx +0 -348
- package/src/components/app-shell-types.ts +0 -427
- package/src/components/app-top-bar.stories.tsx +0 -80
- package/src/components/app-top-bar.tsx +0 -66
- package/src/components/attachment-list.render.test.ts +0 -137
- package/src/components/attachment-list.stories.tsx +0 -257
- package/src/components/attachment-list.tsx +0 -259
- package/src/components/attendee-row.render.test.ts +0 -139
- package/src/components/attendee-row.stories.tsx +0 -116
- package/src/components/attendee-row.tsx +0 -194
- package/src/components/attention-dot.stories.tsx +0 -46
- package/src/components/attention-dot.tsx +0 -23
- package/src/components/auth-card.stories.tsx +0 -50
- package/src/components/auth-card.tsx +0 -32
- package/src/components/auth-footer.stories.tsx +0 -23
- package/src/components/auth-footer.tsx +0 -14
- package/src/components/auth-hero.stories.tsx +0 -19
- package/src/components/auth-hero.tsx +0 -41
- package/src/components/auto-moved-badge.stories.tsx +0 -67
- package/src/components/auto-moved-badge.tsx +0 -67
- package/src/components/avatar.tsx +0 -60
- package/src/components/badge.tsx +0 -49
- package/src/components/banner.render.test.ts +0 -51
- package/src/components/banner.stories.tsx +0 -92
- package/src/components/banner.tsx +0 -81
- package/src/components/blocked-reason.render.test.ts +0 -44
- package/src/components/blocked-reason.tsx +0 -41
- package/src/components/bottom-sheet.render.test.ts +0 -67
- package/src/components/bottom-sheet.stories.tsx +0 -154
- package/src/components/bottom-sheet.tsx +0 -168
- package/src/components/brief-empty.stories.tsx +0 -51
- package/src/components/brief-empty.tsx +0 -60
- package/src/components/brief-section.render.test.ts +0 -219
- package/src/components/brief-section.stories.tsx +0 -145
- package/src/components/brief-section.tsx +0 -202
- package/src/components/brief-sections.keyboard.test.ts +0 -226
- package/src/components/brief-sections.render.test.ts +0 -150
- package/src/components/brief-sections.stories.tsx +0 -437
- package/src/components/brief-sections.tsx +0 -233
- package/src/components/button.tsx +0 -94
- package/src/components/calendar-clash-strip.render.test.ts +0 -32
- package/src/components/calendar-clash-strip.stories.tsx +0 -56
- package/src/components/calendar-clash-strip.tsx +0 -64
- package/src/components/calendar-event-chip-content.tsx +0 -102
- package/src/components/calendar-event-chip.stories.tsx +0 -126
- package/src/components/calendar-event-chip.tsx +0 -116
- package/src/components/calendar-failure-note.tsx +0 -48
- package/src/components/calendar-grid.render.test.ts +0 -355
- package/src/components/calendar-grid.stories.tsx +0 -215
- package/src/components/calendar-grid.tsx +0 -425
- package/src/components/calendar-invite-card.render.test.ts +0 -179
- package/src/components/calendar-invite-card.stories.tsx +0 -163
- package/src/components/calendar-invite-card.tsx +0 -361
- package/src/components/calendar-list.render.test.ts +0 -111
- package/src/components/calendar-list.stories.tsx +0 -278
- package/src/components/calendar-list.tsx +0 -256
- package/src/components/calendar-parse-badge.stories.tsx +0 -46
- package/src/components/calendar-parse-badge.tsx +0 -59
- package/src/components/calendar-slot-offers.render.test.ts +0 -49
- package/src/components/calendar-slot-offers.stories.tsx +0 -85
- package/src/components/calendar-slot-offers.tsx +0 -67
- package/src/components/calendar-suggestion-deck.pointer.test.ts +0 -98
- package/src/components/calendar-suggestion-deck.render.test.ts +0 -51
- package/src/components/calendar-suggestion-deck.stories.tsx +0 -165
- package/src/components/calendar-suggestion-deck.tsx +0 -122
- package/src/components/calendar-toolbar.render.test.ts +0 -17
- package/src/components/calendar-toolbar.stories.tsx +0 -128
- package/src/components/calendar-toolbar.tsx +0 -178
- package/src/components/calendar-types.ts +0 -269
- package/src/components/card.tsx +0 -48
- package/src/components/category-badge.render.test.ts +0 -29
- package/src/components/category-badge.stories.tsx +0 -39
- package/src/components/category-badge.tsx +0 -44
- package/src/components/category-presentation.stories.tsx +0 -294
- package/src/components/checkbox.stories.tsx +0 -77
- package/src/components/checkbox.tsx +0 -78
- package/src/components/compose-action-bar.render.test.ts +0 -44
- package/src/components/compose-action-bar.stories.tsx +0 -158
- package/src/components/compose-action-bar.tsx +0 -166
- package/src/components/compose-address-field.stories.tsx +0 -332
- package/src/components/compose-address-field.tsx +0 -302
- package/src/components/compose-attachments.render.test.ts +0 -65
- package/src/components/compose-attachments.stories.tsx +0 -145
- package/src/components/compose-attachments.tsx +0 -119
- package/src/components/compose-body-skeleton.stories.tsx +0 -26
- package/src/components/compose-body-skeleton.tsx +0 -10
- package/src/components/compose-body.language.test.ts +0 -186
- package/src/components/compose-body.spellcheck.test.ts +0 -370
- package/src/components/compose-body.stories.tsx +0 -571
- package/src/components/compose-body.tsx +0 -240
- package/src/components/compose-fab.stories.tsx +0 -24
- package/src/components/compose-fab.tsx +0 -19
- package/src/components/compose-form-shell.tsx +0 -117
- package/src/components/compose-header.stories.tsx +0 -173
- package/src/components/compose-header.tsx +0 -121
- package/src/components/compose-language-chip.stories.tsx +0 -170
- package/src/components/compose-language-chip.tsx +0 -169
- package/src/components/compose-language-setting.stories.tsx +0 -82
- package/src/components/compose-language-setting.tsx +0 -106
- package/src/components/compose-mode-toggle.stories.tsx +0 -52
- package/src/components/compose-mode-toggle.tsx +0 -35
- package/src/components/compose-quote-missing-banner.tsx +0 -36
- package/src/components/compose-smtp-missing-banner.stories.tsx +0 -30
- package/src/components/compose-smtp-missing-banner.tsx +0 -51
- package/src/components/compose-subject-field.tsx +0 -22
- package/src/components/confirm-dialog.stories.tsx +0 -100
- package/src/components/confirm-dialog.tsx +0 -113
- package/src/components/danger-zone-section.tsx +0 -36
- package/src/components/dialog-backdrop.tsx +0 -30
- package/src/components/dialog.stories.tsx +0 -156
- package/src/components/dialog.tsx +0 -77
- package/src/components/editor-focus.test.ts +0 -88
- package/src/components/editor-focus.ts +0 -81
- package/src/components/email-frame-css.ts +0 -218
- package/src/components/event-detail.render.test.ts +0 -130
- package/src/components/event-detail.stories.tsx +0 -195
- package/src/components/event-detail.tsx +0 -217
- package/src/components/event-editor-pane.tsx +0 -54
- package/src/components/event-editor.render.test.ts +0 -192
- package/src/components/event-editor.stories.tsx +0 -203
- package/src/components/event-editor.tsx +0 -572
- package/src/components/event-suggestion-card.render.test.ts +0 -46
- package/src/components/event-suggestion-card.stories.tsx +0 -166
- package/src/components/event-suggestion-card.tsx +0 -272
- package/src/components/event-suggestion-card.zone-gate.test.ts +0 -322
- package/src/components/field-label.tsx +0 -19
- package/src/components/filter-clause-chip.tsx +0 -202
- package/src/components/filter-preview-count.tsx +0 -57
- package/src/components/filter-rule-editor.create.test.ts +0 -323
- package/src/components/filter-rule-editor.stories.tsx +0 -823
- package/src/components/filter-rule-editor.tsx +0 -597
- package/src/components/filter-rule.render.test.ts +0 -405
- package/src/components/filter-rule.ts +0 -396
- package/src/components/filter-sheet.render.test.ts +0 -127
- package/src/components/filter-sheet.stories.tsx +0 -172
- package/src/components/filter-sheet.tsx +0 -464
- package/src/components/flow-screen.focus.test.ts +0 -107
- package/src/components/flow-screen.tsx +0 -195
- package/src/components/folder-manage-actions.render.test.ts +0 -38
- package/src/components/folder-manage-actions.stories.tsx +0 -94
- package/src/components/folder-manage-actions.tsx +0 -54
- package/src/components/folder-manager.render.test.ts +0 -49
- package/src/components/folder-manager.stories.tsx +0 -209
- package/src/components/folder-manager.tsx +0 -80
- package/src/components/folder-mutation-dialog.render.test.ts +0 -154
- package/src/components/folder-mutation-dialog.stories.tsx +0 -72
- package/src/components/folder-mutation-dialog.tsx +0 -111
- package/src/components/folder-rename-dialog.render.test.ts +0 -37
- package/src/components/folder-rename-dialog.stories.tsx +0 -66
- package/src/components/folder-rename-dialog.tsx +0 -95
- package/src/components/folder-role.test.ts +0 -124
- package/src/components/folder-role.tsx +0 -132
- package/src/components/folder-row.render.test.ts +0 -78
- package/src/components/folder-row.stories.tsx +0 -134
- package/src/components/folder-row.tsx +0 -186
- package/src/components/folder-sync-state.stories.tsx +0 -92
- package/src/components/folder-sync-state.test.ts +0 -143
- package/src/components/folder-sync-state.tsx +0 -87
- package/src/components/folder-tree-picker.create.test.ts +0 -695
- package/src/components/folder-tree-picker.render.test.ts +0 -85
- package/src/components/folder-tree-picker.stories.tsx +0 -426
- package/src/components/folder-tree-picker.tsx +0 -535
- package/src/components/input.tsx +0 -51
- package/src/components/intelligence-calendar-fixtures.ts +0 -388
- package/src/components/intelligence-calendar.deck-zone-gate.test.ts +0 -142
- package/src/components/intelligence-calendar.render.test.ts +0 -118
- package/src/components/intelligence-calendar.tsx +0 -394
- package/src/components/intelligence-panel-calendar.stories.tsx +0 -531
- package/src/components/intelligence-panel.render.test.ts +0 -114
- package/src/components/intelligence-panel.stories.tsx +0 -218
- package/src/components/intelligence-panel.tab-strip.test.ts +0 -162
- package/src/components/intelligence-panel.tsx +0 -502
- package/src/components/intelligence-section.tsx +0 -24
- package/src/components/intelligence-toggle.render.test.ts +0 -32
- package/src/components/intelligence-toggle.tsx +0 -53
- package/src/components/isolated-email-frame.keys.test.ts +0 -43
- package/src/components/isolated-email-frame.render.test.ts +0 -197
- package/src/components/isolated-email-frame.stories.tsx +0 -909
- package/src/components/isolated-email-frame.tsx +0 -357
- package/src/components/kbd.tsx +0 -17
- package/src/components/keyboard-hint-bar.render.test.ts +0 -22
- package/src/components/keyboard-hint-bar.tsx +0 -46
- package/src/components/label-chip.render.test.ts +0 -17
- package/src/components/label-chip.stories.tsx +0 -72
- package/src/components/label-chip.tsx +0 -49
- package/src/components/list-result-header.render.test.ts +0 -43
- package/src/components/list-result-header.stories.tsx +0 -62
- package/src/components/list-result-header.tsx +0 -48
- package/src/components/mail-action-toolbar.stories.tsx +0 -56
- package/src/components/mail-action-toolbar.tsx +0 -193
- package/src/components/mail-header.render.test.ts +0 -117
- package/src/components/mail-header.stories.tsx +0 -274
- package/src/components/mail-header.tsx +0 -161
- package/src/components/mcp-connected-apps-page.stories.tsx +0 -58
- package/src/components/mcp-connected-apps-page.tsx +0 -79
- package/src/components/mcp-consent-page.stories.tsx +0 -39
- package/src/components/mcp-consent-page.tsx +0 -47
- package/src/components/mcp-device-page.stories.tsx +0 -57
- package/src/components/mcp-device-page.tsx +0 -107
- package/src/components/mcp-error-notice.stories.tsx +0 -34
- package/src/components/mcp-error-notice.tsx +0 -23
- package/src/components/mcp-error-page.stories.tsx +0 -17
- package/src/components/mcp-error-page.tsx +0 -15
- package/src/components/mcp-fixtures.ts +0 -16
- package/src/components/mcp-login-page.stories.tsx +0 -37
- package/src/components/mcp-login-page.tsx +0 -58
- package/src/components/mcp-page.stories.tsx +0 -27
- package/src/components/mcp-page.tsx +0 -35
- package/src/components/mcp-permission-list.stories.tsx +0 -21
- package/src/components/mcp-permission-list.tsx +0 -22
- package/src/components/message-body-view.render.test.ts +0 -38
- package/src/components/message-body-view.stories.tsx +0 -344
- package/src/components/message-body-view.tsx +0 -207
- package/src/components/message-list-pane.brief-filter.test.ts +0 -170
- package/src/components/message-list-pane.render.test.ts +0 -134
- package/src/components/message-list-pane.stories.tsx +0 -410
- package/src/components/message-list-pane.tsx +0 -401
- package/src/components/message-list-state.render.test.ts +0 -160
- package/src/components/message-list-state.stories.tsx +0 -353
- package/src/components/message-list-state.tsx +0 -226
- package/src/components/message-report-dialog.tsx +0 -67
- package/src/components/message-row.render.test.ts +0 -75
- package/src/components/message-row.stories.tsx +0 -359
- package/src/components/message-row.tsx +0 -417
- package/src/components/message-settlement.render.test.ts +0 -113
- package/src/components/message-settlement.stories.tsx +0 -79
- package/src/components/message-settlement.tsx +0 -142
- package/src/components/mobile-message-action-bar.render.test.ts +0 -77
- package/src/components/mobile-message-action-bar.stories.tsx +0 -75
- package/src/components/mobile-message-action-bar.tsx +0 -192
- package/src/components/mobile-reading-pane.render.test.ts +0 -79
- package/src/components/mobile-reading-pane.stories.tsx +0 -78
- package/src/components/mobile-reading-pane.tsx +0 -207
- package/src/components/mobile-search-view.render.test.ts +0 -120
- package/src/components/mobile-search-view.stories.tsx +0 -508
- package/src/components/mobile-search-view.tsx +0 -161
- package/src/components/nav-link-surface.interaction.test.ts +0 -90
- package/src/components/nav-link-surface.stories.tsx +0 -175
- package/src/components/nav-link-surface.tsx +0 -97
- package/src/components/nav-sidebar.keyboard.test.ts +0 -105
- package/src/components/nav-sidebar.render.test.ts +0 -270
- package/src/components/nav-sidebar.stories.tsx +0 -224
- package/src/components/nav-sidebar.tsx +0 -583
- package/src/components/nav-toggle-button.tsx +0 -31
- package/src/components/new-folder-action.stories.tsx +0 -92
- package/src/components/new-folder-action.tsx +0 -59
- package/src/components/new-folder-form.render.test.ts +0 -38
- package/src/components/new-folder-form.stories.tsx +0 -74
- package/src/components/new-folder-form.tsx +0 -126
- package/src/components/outbox-row.render.test.ts +0 -67
- package/src/components/outbox-row.stories.tsx +0 -61
- package/src/components/outbox-row.tsx +0 -127
- package/src/components/outbox-status-badge.tsx +0 -71
- package/src/components/overlay-escape.test.ts +0 -135
- package/src/components/pane-header.stories.tsx +0 -76
- package/src/components/pane-header.tsx +0 -33
- package/src/components/pane-layout.render.test.ts +0 -87
- package/src/components/password-input.render.test.ts +0 -107
- package/src/components/password-input.tsx +0 -45
- package/src/components/plain-text-editor.mount.test.ts +0 -194
- package/src/components/plain-text-editor.stories.tsx +0 -238
- package/src/components/plain-text-editor.tsx +0 -216
- package/src/components/popover-menu.render.test.ts +0 -55
- package/src/components/popover-menu.stories.tsx +0 -161
- package/src/components/popover-menu.tsx +0 -391
- package/src/components/primitives.stories.tsx +0 -177
- package/src/components/progress-bar.render.test.ts +0 -32
- package/src/components/progress-bar.stories.tsx +0 -35
- package/src/components/progress-bar.tsx +0 -62
- package/src/components/pull-to-refresh.stories.tsx +0 -71
- package/src/components/pull-to-refresh.tsx +0 -37
- package/src/components/quarantine-entry-row.tsx +0 -76
- package/src/components/quarantine-fixtures.ts +0 -113
- package/src/components/quarantine-report.test.ts +0 -192
- package/src/components/quarantine-report.ts +0 -244
- package/src/components/quarantine-section.render.test.ts +0 -123
- package/src/components/quarantine-section.stories.tsx +0 -93
- package/src/components/quarantine-section.tsx +0 -71
- package/src/components/quoted-text.render.test.ts +0 -39
- package/src/components/quoted-text.stories.tsx +0 -67
- package/src/components/quoted-text.tsx +0 -67
- package/src/components/reading-pane-empty.tsx +0 -44
- package/src/components/reading-pane.render.test.ts +0 -45
- package/src/components/reading-pane.stories.tsx +0 -433
- package/src/components/reading-pane.tsx +0 -368
- package/src/components/recurrence-scope-prompt.stories.tsx +0 -46
- package/src/components/recurrence-scope-prompt.tsx +0 -84
- package/src/components/refresh-button.render.test.ts +0 -68
- package/src/components/refresh-button.stories.tsx +0 -77
- package/src/components/refresh-button.tsx +0 -93
- package/src/components/rescue-banner.stories.tsx +0 -31
- package/src/components/rescue-banner.tsx +0 -50
- package/src/components/rescue-candidate-row.stories.tsx +0 -108
- package/src/components/rescue-candidate-row.tsx +0 -108
- package/src/components/rescue-from-spam-flow.render.test.ts +0 -76
- package/src/components/rescue-from-spam-flow.stories.tsx +0 -94
- package/src/components/rescue-from-spam-flow.tsx +0 -372
- package/src/components/rescue-sender-group.render.test.ts +0 -67
- package/src/components/rescue-sender-group.test.ts +0 -91
- package/src/components/rescue-sender-group.tsx +0 -173
- package/src/components/resizable.tsx +0 -97
- package/src/components/rich-text-correction-menu.tsx +0 -218
- package/src/components/rich-text-document.ts +0 -143
- package/src/components/rich-text-editor.mount.test.ts +0 -195
- package/src/components/rich-text-editor.stories.tsx +0 -1193
- package/src/components/rich-text-editor.tsx +0 -1071
- package/src/components/rich-text-formatting.test.ts +0 -136
- package/src/components/rich-text-image-node.test.ts +0 -134
- package/src/components/rich-text-image-node.ts +0 -141
- package/src/components/rich-text-inline-images.tsx +0 -222
- package/src/components/rich-text-markdown.test.ts +0 -109
- package/src/components/rich-text-markdown.ts +0 -155
- package/src/components/rich-text-nodes.ts +0 -63
- package/src/components/rich-text-paste.test.ts +0 -142
- package/src/components/rich-text-spellcheck-double.ts +0 -65
- package/src/components/rich-text-spellcheck-engine.ts +0 -267
- package/src/components/rich-text-spellcheck-languages.ts +0 -62
- package/src/components/rich-text-spellcheck-menu.test.ts +0 -814
- package/src/components/rich-text-spellcheck-notice.tsx +0 -168
- package/src/components/rich-text-spellcheck-provider.test.ts +0 -429
- package/src/components/rich-text-spellcheck-provider.ts +0 -202
- package/src/components/rich-text-spellcheck-words.ts +0 -40
- package/src/components/rich-text-spellcheck-worker-provider.ts +0 -52
- package/src/components/rich-text-spellcheck-worker.test.ts +0 -253
- package/src/components/rich-text-spellcheck-worker.ts +0 -113
- package/src/components/rich-text-spellcheck.test.ts +0 -705
- package/src/components/rich-text-spellcheck.ts +0 -130
- package/src/components/rich-text-toolbar.tsx +0 -263
- package/src/components/rich-text-value.ts +0 -35
- package/src/components/role-appointment-list.confirm-proposal.test.ts +0 -167
- package/src/components/role-appointment-list.render.test.ts +0 -290
- package/src/components/role-appointment-list.stories.tsx +0 -264
- package/src/components/role-appointment-list.tsx +0 -376
- package/src/components/role-appointment-prompt.render.test.ts +0 -213
- package/src/components/role-appointment-prompt.stories.tsx +0 -221
- package/src/components/role-appointment-prompt.tsx +0 -339
- package/src/components/row-actions.render.test.ts +0 -49
- package/src/components/row-actions.stories.tsx +0 -87
- package/src/components/row-actions.tsx +0 -139
- package/src/components/search-bar.render.test.ts +0 -28
- package/src/components/search-bar.stories.tsx +0 -48
- package/src/components/search-bar.tsx +0 -95
- package/src/components/search-chip-input.render.test.ts +0 -141
- package/src/components/search-chip-input.stories.tsx +0 -171
- package/src/components/search-chip-input.tsx +0 -439
- package/src/components/search-chip-keys.test.ts +0 -206
- package/src/components/search-chip-keys.ts +0 -154
- package/src/components/search-conversion-notice.stories.tsx +0 -35
- package/src/components/search-conversion-notice.tsx +0 -61
- package/src/components/search-conversion.render.test.ts +0 -49
- package/src/components/search-conversion.ts +0 -61
- package/src/components/search-result-row.tsx +0 -127
- package/src/components/search-results.render.test.ts +0 -379
- package/src/components/search-results.stories.tsx +0 -407
- package/src/components/search-results.tsx +0 -414
- package/src/components/search-token-chip.stories.tsx +0 -42
- package/src/components/search-token-chip.tsx +0 -173
- package/src/components/security-select.render.test.ts +0 -20
- package/src/components/security-select.tsx +0 -53
- package/src/components/segmented-control.tsx +0 -70
- package/src/components/select.tsx +0 -42
- package/src/components/selection-top-bar.render.test.ts +0 -259
- package/src/components/selection-top-bar.stories.tsx +0 -348
- package/src/components/selection-top-bar.tsx +0 -354
- package/src/components/selection-wizard-fixtures.ts +0 -333
- package/src/components/selection-wizard.render.test.ts +0 -853
- package/src/components/selection-wizard.stories.tsx +0 -1390
- package/src/components/selection-wizard.tsx +0 -1173
- package/src/components/self-update-confirm-dialog.tsx +0 -103
- package/src/components/self-update-progress-overlay.stories.tsx +0 -80
- package/src/components/self-update-progress-overlay.tsx +0 -166
- package/src/components/self-update-section.tsx +0 -547
- package/src/components/self-update.render.test.ts +0 -268
- package/src/components/self-update.stories.tsx +0 -273
- package/src/components/self-update.ts +0 -153
- package/src/components/sender-group-switch.tsx +0 -63
- package/src/components/sender-trust-indicator.render.test.ts +0 -37
- package/src/components/sender-trust-indicator.stories.tsx +0 -58
- package/src/components/sender-trust-indicator.tsx +0 -87
- package/src/components/settings-primitives.stories.tsx +0 -80
- package/src/components/settings-screen.tsx +0 -367
- package/src/components/shell-top-bar.render.test.ts +0 -75
- package/src/components/shell-top-bar.stories.tsx +0 -171
- package/src/components/shell-top-bar.tsx +0 -144
- package/src/components/slide-panel.render.test.ts +0 -67
- package/src/components/slide-panel.stories.tsx +0 -129
- package/src/components/slide-panel.tsx +0 -101
- package/src/components/spam-results-offer.render.test.ts +0 -46
- package/src/components/spam-results-offer.stories.tsx +0 -51
- package/src/components/spam-results-offer.tsx +0 -77
- package/src/components/suggest-list.render.test.ts +0 -53
- package/src/components/suggest-list.tsx +0 -96
- package/src/components/swipeable-row.gesture.test.ts +0 -363
- package/src/components/swipeable-row.render.test.ts +0 -108
- package/src/components/swipeable-row.stories.tsx +0 -255
- package/src/components/swipeable-row.tsx +0 -258
- package/src/components/sync-warning-fixtures.ts +0 -22
- package/src/components/sync-warning-report.ts +0 -38
- package/src/components/sync-warning-row.tsx +0 -51
- package/src/components/sync-warning-section.render.test.ts +0 -19
- package/src/components/sync-warning-section.stories.tsx +0 -94
- package/src/components/sync-warning-section.tsx +0 -56
- package/src/components/touch-list-body.render.test.ts +0 -62
- package/src/components/touch-list-body.stories.tsx +0 -110
- package/src/components/touch-list.follows-sections.test.ts +0 -117
- package/src/components/touch-list.tsx +0 -106
- package/src/components/use-compose-language.ts +0 -86
- package/src/components/wizard.render.test.ts +0 -27
- package/src/components/wizard.stories.tsx +0 -154
- package/src/components/wizard.tsx +0 -341
- package/src/filter-presets.test.ts +0 -24
- package/src/filter-presets.ts +0 -88
- package/src/index.ts +0 -1242
- package/src/lib/abort.ts +0 -11
- package/src/lib/adopted-html.test.ts +0 -160
- package/src/lib/adopted-html.ts +0 -171
- package/src/lib/agenda-time.test.ts +0 -596
- package/src/lib/agenda-time.ts +0 -544
- package/src/lib/attachment-file.test.ts +0 -162
- package/src/lib/attachment-file.ts +0 -94
- package/src/lib/brief-filter-query.test.ts +0 -200
- package/src/lib/brief-filter-query.ts +0 -173
- package/src/lib/brief-filters.ts +0 -111
- package/src/lib/calendar-color.ts +0 -71
- package/src/lib/calendar-event-shell.ts +0 -55
- package/src/lib/calendar-slot-pick.test.ts +0 -160
- package/src/lib/calendar-slot-pick.ts +0 -75
- package/src/lib/cid-resolver.ts +0 -35
- package/src/lib/cn.ts +0 -7
- package/src/lib/compose-language.test.ts +0 -194
- package/src/lib/compose-language.ts +0 -217
- package/src/lib/compose-mode.test.ts +0 -76
- package/src/lib/compose-mode.ts +0 -50
- package/src/lib/detect-compose-language.test.ts +0 -69
- package/src/lib/detect-compose-language.ts +0 -42
- package/src/lib/email-layout-clamp.ts +0 -81
- package/src/lib/email-render-treatment.test.ts +0 -61
- package/src/lib/email-render-treatment.ts +0 -54
- package/src/lib/email-sanitizer.remote-images.test.ts +0 -111
- package/src/lib/email-sanitizer.test.ts +0 -515
- package/src/lib/email-sanitizer.ts +0 -485
- package/src/lib/event-phrase.test.ts +0 -17
- package/src/lib/event-phrase.ts +0 -11
- package/src/lib/folder-tree-focus.test.ts +0 -98
- package/src/lib/folder-tree-focus.ts +0 -52
- package/src/lib/folder-tree.test.ts +0 -348
- package/src/lib/folder-tree.ts +0 -230
- package/src/lib/keymap-dispatch.test.ts +0 -255
- package/src/lib/keymap-dispatch.ts +0 -244
- package/src/lib/keymap.test.ts +0 -59
- package/src/lib/keymap.ts +0 -298
- package/src/lib/label-color.ts +0 -46
- package/src/lib/layout-breakpoints.ts +0 -12
- package/src/lib/overlay-scope.test.ts +0 -314
- package/src/lib/overlay-scope.ts +0 -217
- package/src/lib/parse-address-input.test.ts +0 -79
- package/src/lib/parse-address-input.ts +0 -81
- package/src/lib/property-prefill.test.ts +0 -173
- package/src/lib/property-prefill.ts +0 -151
- package/src/lib/recurrence.test.ts +0 -141
- package/src/lib/recurrence.ts +0 -263
- package/src/lib/roving-focus.test.ts +0 -230
- package/src/lib/roving-focus.ts +0 -126
- package/src/lib/row-keyboard.test.ts +0 -41
- package/src/lib/row-keyboard.ts +0 -20
- package/src/lib/rule-name.test.ts +0 -28
- package/src/lib/rule-name.ts +0 -27
- package/src/lib/search-query-words.ts +0 -93
- package/src/lib/search-rule.test.ts +0 -70
- package/src/lib/search-rule.ts +0 -69
- package/src/lib/sender-derivation.test.ts +0 -187
- package/src/lib/sender-derivation.ts +0 -118
- package/src/lib/shortcut-tree.test.ts +0 -438
- package/src/lib/shortcut-tree.ts +0 -389
- package/src/lib/suggest-keys.test.ts +0 -101
- package/src/lib/suggest-keys.ts +0 -63
- package/src/lib/swipe-config.ts +0 -11
- package/src/lib/use-list-cursor.test.ts +0 -242
- package/src/lib/use-list-cursor.ts +0 -263
- package/src/lib/use-list-keyboard.test.ts +0 -174
- package/src/lib/use-list-keyboard.ts +0 -115
- package/src/lib/use-long-press.test.ts +0 -291
- package/src/lib/use-long-press.ts +0 -133
- package/src/lib/use-match-media.ts +0 -25
- package/src/lib/use-modal-focus.test.ts +0 -500
- package/src/lib/use-modal-focus.ts +0 -158
- package/src/lib/use-rendered-row-ids.test.ts +0 -88
- package/src/lib/use-rendered-row-ids.ts +0 -56
- package/src/lib/use-selection.hook.test.ts +0 -136
- package/src/lib/use-selection.test.ts +0 -230
- package/src/lib/use-selection.ts +0 -334
- package/src/lib/use-suggest-list.test.ts +0 -214
- package/src/lib/use-suggest-list.ts +0 -142
- package/src/lib/use-swipe-navigation.test.ts +0 -162
- package/src/lib/use-swipe-navigation.ts +0 -90
- package/src/lib/use-triage-keyboard.test.ts +0 -130
- package/src/lib/use-triage-keyboard.ts +0 -140
- package/src/lib/wizard-steps.test.ts +0 -964
- package/src/lib/wizard-steps.ts +0 -724
- package/src/mcp-pages.ts +0 -36
- package/src/rich-text.ts +0 -81
- package/src/tokens.css +0 -330
- /package/{src → dist}/calendar.css +0 -0
- /package/{src → dist}/css-modules.d.ts +0 -0
|
@@ -1,1193 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
import { expect, userEvent, waitFor } from "storybook/test";
|
|
4
|
-
import { sanitizeAdoptedHtml } from "../lib/adopted-html.js";
|
|
5
|
-
import { ComposeLanguageChip } from "./compose-language-chip.js";
|
|
6
|
-
import {
|
|
7
|
-
type ComposeBodyMode,
|
|
8
|
-
ComposeModeToggle,
|
|
9
|
-
} from "./compose-mode-toggle.js";
|
|
10
|
-
import { RichTextEditor } from "./rich-text-editor.js";
|
|
11
|
-
import type { InlineImages } from "./rich-text-inline-images.js";
|
|
12
|
-
import type {
|
|
13
|
-
CheckRequest,
|
|
14
|
-
Finding,
|
|
15
|
-
SpellcheckOptions,
|
|
16
|
-
} from "./rich-text-spellcheck.js";
|
|
17
|
-
import { stubKnows } from "./rich-text-spellcheck-double.js";
|
|
18
|
-
import { findMisspellings } from "./rich-text-spellcheck-words.js";
|
|
19
|
-
import { openSpellcheckWorker } from "./rich-text-spellcheck-worker-provider.js";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The frame is the compose body region at its real geometry — a column with a
|
|
23
|
-
* height of its own — so the editor is shown claiming the space a composer
|
|
24
|
-
* gives it rather than only the space its own text needs.
|
|
25
|
-
*/
|
|
26
|
-
const meta: Meta<typeof RichTextEditor> = {
|
|
27
|
-
title: "Design System/Compose/RichTextEditor",
|
|
28
|
-
component: RichTextEditor,
|
|
29
|
-
parameters: { layout: "centered" },
|
|
30
|
-
decorators: [
|
|
31
|
-
(Story) => (
|
|
32
|
-
<div
|
|
33
|
-
data-testid="body-area"
|
|
34
|
-
className="flex h-[420px] w-[640px] flex-col overflow-auto rounded-md border border-line bg-canvas"
|
|
35
|
-
>
|
|
36
|
-
<Story />
|
|
37
|
-
</div>
|
|
38
|
-
),
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
export default meta;
|
|
42
|
-
|
|
43
|
-
type Story = StoryObj<typeof RichTextEditor>;
|
|
44
|
-
|
|
45
|
-
const RICH_DOCUMENT = [
|
|
46
|
-
"<h2>Quarterly numbers</h2>",
|
|
47
|
-
"<p>Highlights <strong>this quarter</strong>, with the detail below.</p>",
|
|
48
|
-
"<ul><li>Revenue up 14%</li><li>Costs flat</li></ul>",
|
|
49
|
-
"<table><thead><tr><th>Region</th><th>Total</th></tr></thead>",
|
|
50
|
-
"<tbody><tr><td>EMEA</td><td>412</td></tr>",
|
|
51
|
-
"<tr><td>Americas</td><td>388</td></tr></tbody></table>",
|
|
52
|
-
'<p>Source: <a href="https://example.com/report">the full report</a>.</p>',
|
|
53
|
-
].join("");
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* What a web page actually puts on the clipboard: presentation on every
|
|
57
|
-
* element, a tracking pixel, a script, and Word's conditional markup.
|
|
58
|
-
*/
|
|
59
|
-
const CLIPBOARD_HTML = [
|
|
60
|
-
'<meta charset="utf-8">',
|
|
61
|
-
"<!--[if gte mso 9]><xml><w:WordDocument/></xml><![endif]-->",
|
|
62
|
-
"<style>.hdr{color:#c00}</style>",
|
|
63
|
-
'<h3 class="hdr" style="color:#c00;font-family:Verdana">Release checklist</h3>',
|
|
64
|
-
'<ol><li style="margin:0">Cut the tag</li><li>Publish the images</li></ol>',
|
|
65
|
-
'<table style="border:2px dashed #c00"><tbody>',
|
|
66
|
-
"<tr><th>Step</th><th>Owner</th></tr>",
|
|
67
|
-
"<tr><td>Tag</td><td>Ada</td></tr></tbody></table>",
|
|
68
|
-
'<img src="http://tracker.example/px.gif" width="1" height="1">',
|
|
69
|
-
'<script>fetch("https://tracker.example/steal")</script>',
|
|
70
|
-
].join("");
|
|
71
|
-
|
|
72
|
-
const MARK =
|
|
73
|
-
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMTIwIj48cmVjdCB3aWR0aD0iMjQwIiBoZWlnaHQ9IjEyMCIgcng9IjEyIiBmaWxsPSIjMzc4MGY2Ii8+PGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iMzIiIGZpbGw9IiNmZmYiLz48L3N2Zz4=";
|
|
74
|
-
|
|
75
|
-
const WIDE_SHOT =
|
|
76
|
-
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNjAwIiBoZWlnaHQ9IjQwMCI+PHJlY3Qgd2lkdGg9IjE2MDAiIGhlaWdodD0iNDAwIiBmaWxsPSIjZTJlOGYwIi8+PHRleHQgeD0iNDAiIHk9IjIyMCIgZm9udC1mYW1pbHk9InNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iOTYiIGZpbGw9IiMzMzQxNTUiPjE2MDAgd2lkZTwvdGV4dD48L3N2Zz4=";
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* A clipboard carrying pictures, which is what a screenshot pasted out of a
|
|
80
|
-
* graphics app arrives as. The second is 1600 wide — four times the room the
|
|
81
|
-
* composer has for it.
|
|
82
|
-
*/
|
|
83
|
-
const CLIPBOARD_WITH_IMAGES = [
|
|
84
|
-
"<p>The new mark:</p>",
|
|
85
|
-
`<p><img src="${MARK}" alt="The mark"></p>`,
|
|
86
|
-
"<p>And the header it sits in:</p>",
|
|
87
|
-
`<p><img src="${WIDE_SHOT}" alt="The header, 1600 wide"></p>`,
|
|
88
|
-
"<p>Let me know which one reads better.</p>",
|
|
89
|
-
].join("");
|
|
90
|
-
|
|
91
|
-
export const Empty: Story = {
|
|
92
|
-
name: "Empty",
|
|
93
|
-
args: {},
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const RichContent: Story = {
|
|
97
|
-
name: "Rich content with a table",
|
|
98
|
-
args: { initialHtml: RICH_DOCUMENT },
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The document after that clipboard has gone through the paste profile: the
|
|
103
|
-
* heading, the list and the table survive; the styling, the pixel and the
|
|
104
|
-
* script do not.
|
|
105
|
-
*/
|
|
106
|
-
export const PasteResult: Story = {
|
|
107
|
-
name: "After pasting a web page",
|
|
108
|
-
args: { initialHtml: sanitizeAdoptedHtml(CLIPBOARD_HTML) },
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The pictures are in the document rather than gone from it (#684), and the
|
|
113
|
-
* oversized one is drawn at the width the composer has rather than pushing the
|
|
114
|
-
* message sideways. Whether a `data:` image survives the trip to a given
|
|
115
|
-
* recipient is a separate question, and #679 is where it is answered.
|
|
116
|
-
*/
|
|
117
|
-
export const PastedImages: Story = {
|
|
118
|
-
name: "After pasting images",
|
|
119
|
-
args: { initialHtml: sanitizeAdoptedHtml(CLIPBOARD_WITH_IMAGES) },
|
|
120
|
-
play: async ({ canvasElement }) => {
|
|
121
|
-
const editable = canvasElement.querySelector<HTMLElement>(
|
|
122
|
-
"[data-testid=compose-body]",
|
|
123
|
-
);
|
|
124
|
-
if (!editable) throw new Error("the editor is not mounted");
|
|
125
|
-
|
|
126
|
-
const images = [...editable.querySelectorAll("img")];
|
|
127
|
-
await expect(images).toHaveLength(2);
|
|
128
|
-
await expect(images[0]).toHaveAttribute("alt", "The mark");
|
|
129
|
-
|
|
130
|
-
// A width read before the picture decodes is 0, and 0 is under every
|
|
131
|
-
// bound this would like to assert.
|
|
132
|
-
await waitFor(() =>
|
|
133
|
-
expect(images.every((image) => image.naturalWidth > 0)).toBe(true),
|
|
134
|
-
);
|
|
135
|
-
await expect(images[1].naturalWidth).toBe(1600);
|
|
136
|
-
for (const image of images) {
|
|
137
|
-
await expect(image.getBoundingClientRect().width).toBeGreaterThan(0);
|
|
138
|
-
await expect(image.getBoundingClientRect().width).toBeLessThanOrEqual(
|
|
139
|
-
editable.clientWidth,
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* A short message leaves most of the body region empty. That region belongs to
|
|
147
|
-
* the document: the point far below the last line is the editable, and a click
|
|
148
|
-
* there lands in it.
|
|
149
|
-
*/
|
|
150
|
-
export const ClickBelowTheText: Story = {
|
|
151
|
-
name: "Clicking below the last line",
|
|
152
|
-
args: { initialHtml: "<p>Sounds good. See you at 12:30.</p>" },
|
|
153
|
-
play: async ({ canvasElement }) => {
|
|
154
|
-
const area = canvasElement.querySelector<HTMLElement>(
|
|
155
|
-
"[data-testid=body-area]",
|
|
156
|
-
);
|
|
157
|
-
const editable = canvasElement.querySelector<HTMLElement>(
|
|
158
|
-
"[data-testid=compose-body]",
|
|
159
|
-
);
|
|
160
|
-
if (!area || !editable) throw new Error("the editor is not mounted");
|
|
161
|
-
|
|
162
|
-
const box = area.getBoundingClientRect();
|
|
163
|
-
const underTheText = document.elementFromPoint(
|
|
164
|
-
box.left + box.width / 2,
|
|
165
|
-
Math.min(box.bottom - 12, window.innerHeight - 2),
|
|
166
|
-
);
|
|
167
|
-
await expect(editable.contains(underTheText)).toBe(true);
|
|
168
|
-
|
|
169
|
-
await userEvent.click(editable);
|
|
170
|
-
await expect(editable).toHaveFocus();
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* The two pinned controls, in the order compose ships them: the chip first, so
|
|
176
|
-
* one Shift+Tab out of the body still reaches the mode toggle and two reach the
|
|
177
|
-
* chip. Both hold their own state here — the editor knows nothing about either,
|
|
178
|
-
* and a pinned control that did not answer a press would read as a broken
|
|
179
|
-
* toolbar rather than a layout story.
|
|
180
|
-
*/
|
|
181
|
-
const PinnedControls = () => {
|
|
182
|
-
const [language, setLanguage] = useState("nl");
|
|
183
|
-
const [mode, setMode] = useState<ComposeBodyMode>("rich");
|
|
184
|
-
return (
|
|
185
|
-
<>
|
|
186
|
-
<ComposeLanguageChip
|
|
187
|
-
language={language}
|
|
188
|
-
languages={["nl", "en", "de"]}
|
|
189
|
-
source={language === "nl" ? "detected" : "manual"}
|
|
190
|
-
onSelect={setLanguage}
|
|
191
|
-
/>
|
|
192
|
-
<ComposeModeToggle
|
|
193
|
-
mode={mode}
|
|
194
|
-
onToggle={() => setMode(mode === "plain" ? "rich" : "plain")}
|
|
195
|
-
/>
|
|
196
|
-
</>
|
|
197
|
-
);
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const pinnedControls = <PinnedControls />;
|
|
201
|
-
|
|
202
|
-
/** The toolbar as compose ships it: the formatting cluster, then the two pinned controls. */
|
|
203
|
-
export const ToolbarInRich: Story = {
|
|
204
|
-
name: "Toolbar with the language chip and the mode toggle",
|
|
205
|
-
args: { initialHtml: RICH_DOCUMENT, lang: "nl", trailing: pinnedControls },
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* At 390 the formatting cluster runs out of room. It scrolls inside its own
|
|
210
|
-
* strip and both pinned controls stay at the right edge, rather than the
|
|
211
|
-
* cluster pushing them off the screen — which is what a flex child without
|
|
212
|
-
* `min-w-0` does. Two letters is what makes room for a second pinned item here.
|
|
213
|
-
*/
|
|
214
|
-
export const NarrowToolbar: Story = {
|
|
215
|
-
name: "Toolbar at 390",
|
|
216
|
-
args: { initialHtml: RICH_DOCUMENT, lang: "nl", trailing: pinnedControls },
|
|
217
|
-
decorators: [
|
|
218
|
-
(Story) => (
|
|
219
|
-
<div
|
|
220
|
-
data-testid="body-area"
|
|
221
|
-
className="flex h-[420px] w-[390px] flex-col overflow-auto rounded-md border border-line bg-canvas"
|
|
222
|
-
>
|
|
223
|
-
<Story />
|
|
224
|
-
</div>
|
|
225
|
-
),
|
|
226
|
-
],
|
|
227
|
-
play: async ({ canvasElement }) => {
|
|
228
|
-
const frame = canvasElement.querySelector<HTMLElement>(
|
|
229
|
-
"[data-testid=body-area]",
|
|
230
|
-
);
|
|
231
|
-
const cluster = canvasElement.querySelector<HTMLElement>(
|
|
232
|
-
"[data-testid=compose-format-cluster]",
|
|
233
|
-
);
|
|
234
|
-
const toggle = canvasElement.querySelector<HTMLElement>(
|
|
235
|
-
"[data-testid=compose-mode-toggle]",
|
|
236
|
-
);
|
|
237
|
-
const chip = canvasElement.querySelector<HTMLElement>(
|
|
238
|
-
"[data-testid=compose-language-chip]",
|
|
239
|
-
);
|
|
240
|
-
if (!frame || !cluster || !toggle || !chip)
|
|
241
|
-
throw new Error("the toolbar is not mounted");
|
|
242
|
-
|
|
243
|
-
await expect(cluster.scrollWidth).toBeGreaterThan(cluster.clientWidth);
|
|
244
|
-
const edge = frame.getBoundingClientRect().right + 1;
|
|
245
|
-
await expect(toggle.getBoundingClientRect().right).toBeLessThanOrEqual(
|
|
246
|
-
edge,
|
|
247
|
-
);
|
|
248
|
-
await expect(chip.getBoundingClientRect().left).toBeGreaterThanOrEqual(
|
|
249
|
-
frame.getBoundingClientRect().left,
|
|
250
|
-
);
|
|
251
|
-
await expect(chip.getBoundingClientRect().right).toBeLessThanOrEqual(edge);
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const MISSPELT = "Ths report is redy today, and the notes are attachd.";
|
|
256
|
-
|
|
257
|
-
const DUTCH = "De vergaderingg gaat over de begrooting.";
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* A real module worker does the checking, over Hunspell and the dictionary this
|
|
261
|
-
* build staged: the component is handed a provider and never learns where the
|
|
262
|
-
* words came from.
|
|
263
|
-
*/
|
|
264
|
-
const workerSpellcheck: SpellcheckOptions = { provider: openSpellcheckWorker };
|
|
265
|
-
|
|
266
|
-
/** A download that never finishes, which on a bad link is most of a minute. */
|
|
267
|
-
const stalledSpellcheck = (bytesTotal: number): SpellcheckOptions => ({
|
|
268
|
-
provider: async (language) => ({
|
|
269
|
-
language,
|
|
270
|
-
onStatus: (listener) => {
|
|
271
|
-
listener({ state: "opening", language, bytesLoaded: 0, bytesTotal });
|
|
272
|
-
const timer = setInterval(
|
|
273
|
-
() =>
|
|
274
|
-
listener({
|
|
275
|
-
state: "opening",
|
|
276
|
-
language,
|
|
277
|
-
bytesLoaded: Math.round(bytesTotal / 4),
|
|
278
|
-
bytesTotal,
|
|
279
|
-
}),
|
|
280
|
-
500,
|
|
281
|
-
);
|
|
282
|
-
return () => clearInterval(timer);
|
|
283
|
-
},
|
|
284
|
-
check: (request) =>
|
|
285
|
-
Promise.resolve({
|
|
286
|
-
requestId: request.requestId,
|
|
287
|
-
revision: request.revision,
|
|
288
|
-
findings: [],
|
|
289
|
-
}),
|
|
290
|
-
suggest: (request) =>
|
|
291
|
-
Promise.resolve({
|
|
292
|
-
requestId: request.requestId,
|
|
293
|
-
word: request.word,
|
|
294
|
-
suggestions: [],
|
|
295
|
-
}),
|
|
296
|
-
close: () => {},
|
|
297
|
-
}),
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
/** The dictionary answered, and what it answered was 503. */
|
|
301
|
-
const refusedSpellcheck: SpellcheckOptions = {
|
|
302
|
-
provider: async (language) => ({
|
|
303
|
-
language,
|
|
304
|
-
onStatus: (listener) => {
|
|
305
|
-
listener({
|
|
306
|
-
state: "failed",
|
|
307
|
-
language,
|
|
308
|
-
reason: "download",
|
|
309
|
-
detail: `/spellcheck/dictionaries/${language}/index.dic answered 503`,
|
|
310
|
-
});
|
|
311
|
-
return () => {};
|
|
312
|
-
},
|
|
313
|
-
check: (request) =>
|
|
314
|
-
Promise.resolve({
|
|
315
|
-
requestId: request.requestId,
|
|
316
|
-
revision: request.revision,
|
|
317
|
-
findings: [],
|
|
318
|
-
}),
|
|
319
|
-
suggest: (request) =>
|
|
320
|
-
Promise.resolve({
|
|
321
|
-
requestId: request.requestId,
|
|
322
|
-
word: request.word,
|
|
323
|
-
suggestions: [],
|
|
324
|
-
}),
|
|
325
|
-
close: () => {},
|
|
326
|
-
}),
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* The same findings, answered against the revision before the one asked for —
|
|
331
|
-
* what a slow engine looks like when the text has already moved on.
|
|
332
|
-
*/
|
|
333
|
-
const staleAnswers: string[] = [];
|
|
334
|
-
|
|
335
|
-
const staleSpellcheck: SpellcheckOptions = {
|
|
336
|
-
provider: async () => ({
|
|
337
|
-
language: "en",
|
|
338
|
-
onStatus: (listener) => {
|
|
339
|
-
listener({ state: "ready", language: "en" });
|
|
340
|
-
return () => {};
|
|
341
|
-
},
|
|
342
|
-
check: (request: CheckRequest) => {
|
|
343
|
-
staleAnswers.push(request.requestId);
|
|
344
|
-
return Promise.resolve({
|
|
345
|
-
requestId: request.requestId,
|
|
346
|
-
revision: request.revision - 1,
|
|
347
|
-
findings: request.spans.flatMap((span) =>
|
|
348
|
-
findMisspellings(span.text, stubKnows).map(
|
|
349
|
-
(range): Finding => ({
|
|
350
|
-
spanId: span.spanId,
|
|
351
|
-
start: range.start,
|
|
352
|
-
end: range.end,
|
|
353
|
-
kind: "spelling",
|
|
354
|
-
suggestions: [],
|
|
355
|
-
}),
|
|
356
|
-
),
|
|
357
|
-
),
|
|
358
|
-
});
|
|
359
|
-
},
|
|
360
|
-
suggest: (request) =>
|
|
361
|
-
Promise.resolve({
|
|
362
|
-
requestId: request.requestId,
|
|
363
|
-
word: request.word,
|
|
364
|
-
suggestions: [],
|
|
365
|
-
}),
|
|
366
|
-
close: () => {},
|
|
367
|
-
}),
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Every editor on the page shares the one registry entry, so a story reads back
|
|
372
|
-
* the marks that fall inside its own writing surface — on a docs page the
|
|
373
|
-
* neighbouring stories are drawing into it at the same time.
|
|
374
|
-
*/
|
|
375
|
-
const spellMarks = (editable: HTMLElement): AbstractRange[] => {
|
|
376
|
-
const ranges: AbstractRange[] = [];
|
|
377
|
-
CSS.highlights.forEach((highlight, name) => {
|
|
378
|
-
if (name !== "spell-error") return;
|
|
379
|
-
highlight.forEach((range) => {
|
|
380
|
-
if (editable.contains(range.startContainer)) ranges.push(range);
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
return ranges;
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
const spellMarkOffsets = (editable: HTMLElement): [number, number][] =>
|
|
387
|
-
spellMarks(editable).map((range) => [range.startOffset, range.endOffset]);
|
|
388
|
-
|
|
389
|
-
const writingSurface = (canvasElement: HTMLElement): HTMLElement => {
|
|
390
|
-
const editable = canvasElement.querySelector<HTMLElement>(
|
|
391
|
-
"[data-testid=compose-body]",
|
|
392
|
-
);
|
|
393
|
-
if (!editable) throw new Error("the editor is not mounted");
|
|
394
|
-
return editable;
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* The marks a provider produced, drawn through the CSS Custom Highlight
|
|
399
|
-
* registry: two misspelt words carry a squiggle, the browser's own checking is
|
|
400
|
-
* off while ours is on, and the document holds nothing that was not typed.
|
|
401
|
-
*/
|
|
402
|
-
export const SpellcheckMarks: Story = {
|
|
403
|
-
name: "Spellcheck marks (worker provider)",
|
|
404
|
-
args: {
|
|
405
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
406
|
-
lang: "en",
|
|
407
|
-
spellcheck: workerSpellcheck,
|
|
408
|
-
},
|
|
409
|
-
play: async ({ canvasElement }) => {
|
|
410
|
-
const editable = writingSurface(canvasElement);
|
|
411
|
-
|
|
412
|
-
await waitFor(
|
|
413
|
-
() =>
|
|
414
|
-
expect(spellMarkOffsets(editable)).toEqual([
|
|
415
|
-
[0, 3],
|
|
416
|
-
[14, 18],
|
|
417
|
-
[44, 51],
|
|
418
|
-
]),
|
|
419
|
-
{ timeout: 5000 },
|
|
420
|
-
);
|
|
421
|
-
await expect(editable.getAttribute("spellcheck")).toBe("false");
|
|
422
|
-
await expect(editable.textContent).toBe(MISSPELT);
|
|
423
|
-
await expect(editable.querySelectorAll("[data-lexical-text]")).toHaveLength(
|
|
424
|
-
1,
|
|
425
|
-
);
|
|
426
|
-
|
|
427
|
-
// The word the caret sits in is left alone until the writer moves on.
|
|
428
|
-
editable.focus();
|
|
429
|
-
caretTo(editable, 17);
|
|
430
|
-
|
|
431
|
-
await waitFor(
|
|
432
|
-
() =>
|
|
433
|
-
expect(spellMarkOffsets(editable)).toEqual([
|
|
434
|
-
[0, 3],
|
|
435
|
-
[44, 51],
|
|
436
|
-
]),
|
|
437
|
-
{ timeout: 5000 },
|
|
438
|
-
);
|
|
439
|
-
},
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* The same worker on a Dutch message, against OpenTaal's 180,745 entries. Two
|
|
444
|
-
* Dutch misspellings carry a squiggle and every other Dutch word does not —
|
|
445
|
-
* which is the whole point, since a Dutch message in an English-configured
|
|
446
|
-
* Chrome gets a squiggle under every word.
|
|
447
|
-
*/
|
|
448
|
-
export const SpellcheckDutch: Story = {
|
|
449
|
-
name: "Spellcheck in Dutch (real dictionary)",
|
|
450
|
-
args: {
|
|
451
|
-
initialHtml: `<p>${DUTCH}</p>`,
|
|
452
|
-
lang: "nl",
|
|
453
|
-
spellcheck: workerSpellcheck,
|
|
454
|
-
},
|
|
455
|
-
play: async ({ canvasElement }) => {
|
|
456
|
-
const editable = writingSurface(canvasElement);
|
|
457
|
-
await waitFor(
|
|
458
|
-
() =>
|
|
459
|
-
expect(spellMarkOffsets(editable)).toEqual([
|
|
460
|
-
[3, 15],
|
|
461
|
-
[29, 39],
|
|
462
|
-
]),
|
|
463
|
-
{ timeout: 15000 },
|
|
464
|
-
);
|
|
465
|
-
await expect(editable.getAttribute("spellcheck")).toBe("false");
|
|
466
|
-
},
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Fourteen seconds of a composer that looks like it has no opinion about
|
|
471
|
-
* spelling is the failure this must not have. The browser keeps checking, the
|
|
472
|
-
* banner names the language and its size once the wait is long enough to be
|
|
473
|
-
* worth mentioning, and cancelling leaves the writer with a way back.
|
|
474
|
-
*/
|
|
475
|
-
export const SpellcheckSlowDownload: Story = {
|
|
476
|
-
name: "Spellcheck while the dictionary downloads",
|
|
477
|
-
args: {
|
|
478
|
-
initialHtml: `<p>${DUTCH}</p>`,
|
|
479
|
-
lang: "nl",
|
|
480
|
-
spellcheck: stalledSpellcheck(702_464),
|
|
481
|
-
},
|
|
482
|
-
play: async ({ canvasElement }) => {
|
|
483
|
-
const editable = writingSurface(canvasElement);
|
|
484
|
-
await expect(editable.getAttribute("spellcheck")).toBe("true");
|
|
485
|
-
await expect(spellMarks(editable)).toHaveLength(0);
|
|
486
|
-
|
|
487
|
-
const notice = await waitFor(
|
|
488
|
-
() => {
|
|
489
|
-
const row = canvasElement.querySelector<HTMLElement>(
|
|
490
|
-
"[data-testid=spellcheck-notice]",
|
|
491
|
-
);
|
|
492
|
-
expect(row).not.toBeNull();
|
|
493
|
-
return row as HTMLElement;
|
|
494
|
-
},
|
|
495
|
-
{ timeout: 12000 },
|
|
496
|
-
);
|
|
497
|
-
await expect(notice.textContent).toContain("Nederlands");
|
|
498
|
-
await expect(notice.textContent).toContain("686 KB");
|
|
499
|
-
|
|
500
|
-
const cancel = notice.querySelector<HTMLElement>(
|
|
501
|
-
"[data-testid=spellcheck-cancel]",
|
|
502
|
-
);
|
|
503
|
-
if (!cancel)
|
|
504
|
-
throw new Error("a download nobody can stop is not a download");
|
|
505
|
-
await userEvent.click(cancel);
|
|
506
|
-
|
|
507
|
-
await waitFor(() =>
|
|
508
|
-
expect(
|
|
509
|
-
canvasElement.querySelector("[data-testid=spellcheck-retry]"),
|
|
510
|
-
).not.toBeNull(),
|
|
511
|
-
);
|
|
512
|
-
await expect(editable.getAttribute("spellcheck")).toBe("true");
|
|
513
|
-
},
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* The dead squiggle-free editor is the worst outcome, so a failure says which
|
|
518
|
-
* file, what it answered, and where to report it — and hands the spelling back
|
|
519
|
-
* to the browser rather than leaving nobody checking.
|
|
520
|
-
*/
|
|
521
|
-
export const SpellcheckDownloadFailed: Story = {
|
|
522
|
-
name: "Spellcheck when the dictionary fails to load",
|
|
523
|
-
args: {
|
|
524
|
-
initialHtml: `<p>${DUTCH}</p>`,
|
|
525
|
-
lang: "nl",
|
|
526
|
-
spellcheck: refusedSpellcheck,
|
|
527
|
-
},
|
|
528
|
-
play: async ({ canvasElement }) => {
|
|
529
|
-
const editable = writingSurface(canvasElement);
|
|
530
|
-
const detail = await waitFor(() => {
|
|
531
|
-
const row = canvasElement.querySelector<HTMLElement>(
|
|
532
|
-
"[data-testid=spellcheck-detail]",
|
|
533
|
-
);
|
|
534
|
-
expect(row).not.toBeNull();
|
|
535
|
-
return row as HTMLElement;
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
await expect(detail.textContent).toContain("answered 503");
|
|
539
|
-
await expect(
|
|
540
|
-
canvasElement.querySelector("[data-testid=spellcheck-retry]"),
|
|
541
|
-
).not.toBeNull();
|
|
542
|
-
const report = canvasElement.querySelector<HTMLAnchorElement>(
|
|
543
|
-
"[data-testid=spellcheck-report]",
|
|
544
|
-
);
|
|
545
|
-
await expect(report?.href).toContain("issues/new?title=");
|
|
546
|
-
await expect(editable.getAttribute("spellcheck")).toBe("true");
|
|
547
|
-
await expect(spellMarks(editable)).toHaveLength(0);
|
|
548
|
-
},
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
/** A language the build carries no dictionary for: the browser keeps checking. */
|
|
552
|
-
export const SpellcheckWithoutDictionary: Story = {
|
|
553
|
-
name: "Spellcheck with no dictionary for the language",
|
|
554
|
-
args: {
|
|
555
|
-
initialHtml: `<p>Vielen Dank für den Bericht.</p>`,
|
|
556
|
-
lang: "de",
|
|
557
|
-
spellcheck: workerSpellcheck,
|
|
558
|
-
},
|
|
559
|
-
play: async ({ canvasElement }) => {
|
|
560
|
-
const editable = writingSurface(canvasElement);
|
|
561
|
-
await expect(editable.getAttribute("spellcheck")).toBe("true");
|
|
562
|
-
await expect(spellMarks(editable)).toHaveLength(0);
|
|
563
|
-
},
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
/** An answer against a revision the document has moved past paints nothing. */
|
|
567
|
-
export const SpellcheckStaleAnswer: Story = {
|
|
568
|
-
name: "Spellcheck drops a stale answer",
|
|
569
|
-
args: {
|
|
570
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
571
|
-
lang: "en",
|
|
572
|
-
spellcheck: staleSpellcheck,
|
|
573
|
-
},
|
|
574
|
-
play: async ({ canvasElement }) => {
|
|
575
|
-
const editable = writingSurface(canvasElement);
|
|
576
|
-
await waitFor(() => expect(staleAnswers.length).toBeGreaterThan(0), {
|
|
577
|
-
timeout: 5000,
|
|
578
|
-
});
|
|
579
|
-
await expect(spellMarks(editable)).toHaveLength(0);
|
|
580
|
-
await expect(editable.textContent).toBe(MISSPELT);
|
|
581
|
-
},
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
const MISSPELT_MESSAGE = [
|
|
585
|
-
"Ths is the agenda for tomorow.",
|
|
586
|
-
"I attachd the budgt figures and the meetign notes,",
|
|
587
|
-
"and will confrm the schedual seperately.",
|
|
588
|
-
].join(" ");
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* The worker again, with the suggestions held back long enough to see the menu
|
|
592
|
-
* open without them. A slow engine is the normal case, not the exception: the
|
|
593
|
-
* menu is up on the click and the rows arrive after it.
|
|
594
|
-
*/
|
|
595
|
-
const slowSuggestions = (
|
|
596
|
-
delayMs: number,
|
|
597
|
-
onAddWord?: (word: string) => void,
|
|
598
|
-
): SpellcheckOptions => ({
|
|
599
|
-
onAddWord,
|
|
600
|
-
provider: async (language) => {
|
|
601
|
-
const provider = await openSpellcheckWorker(language);
|
|
602
|
-
if (!provider) return null;
|
|
603
|
-
return {
|
|
604
|
-
...provider,
|
|
605
|
-
suggest: (request) =>
|
|
606
|
-
new Promise((resolve) => {
|
|
607
|
-
setTimeout(() => resolve(provider.suggest(request)), delayMs);
|
|
608
|
-
}),
|
|
609
|
-
};
|
|
610
|
-
},
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
const markRect = (editable: HTMLElement, word: string): DOMRect => {
|
|
614
|
-
for (const range of spellMarks(editable)) {
|
|
615
|
-
const text = range.startContainer.textContent ?? "";
|
|
616
|
-
if (text.slice(range.startOffset, range.endOffset) !== word) continue;
|
|
617
|
-
return (range as Range).getBoundingClientRect();
|
|
618
|
-
}
|
|
619
|
-
throw new Error(`"${word}" carries no mark`);
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const centreOf = (box: DOMRect) => ({
|
|
623
|
-
clientX: box.left + box.width / 2,
|
|
624
|
-
clientY: box.top + box.height / 2,
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
interface Press {
|
|
628
|
-
readonly pointerType?: string;
|
|
629
|
-
readonly travel?: number;
|
|
630
|
-
readonly button?: number;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
const pressDownOn = (
|
|
634
|
-
editable: HTMLElement,
|
|
635
|
-
word: string,
|
|
636
|
-
{ pointerType = "mouse", button = 0 }: Press = {},
|
|
637
|
-
): void => {
|
|
638
|
-
editable.dispatchEvent(
|
|
639
|
-
new PointerEvent("pointerdown", {
|
|
640
|
-
bubbles: true,
|
|
641
|
-
pointerType,
|
|
642
|
-
button,
|
|
643
|
-
...centreOf(markRect(editable, word)),
|
|
644
|
-
}),
|
|
645
|
-
);
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
const pressUpOn = (
|
|
649
|
-
editable: HTMLElement,
|
|
650
|
-
word: string,
|
|
651
|
-
{ pointerType = "mouse", travel = 0, button = 0 }: Press = {},
|
|
652
|
-
): void => {
|
|
653
|
-
const at = centreOf(markRect(editable, word));
|
|
654
|
-
editable.dispatchEvent(
|
|
655
|
-
new PointerEvent("pointerup", {
|
|
656
|
-
bubbles: true,
|
|
657
|
-
pointerType,
|
|
658
|
-
button,
|
|
659
|
-
...at,
|
|
660
|
-
clientX: at.clientX + travel,
|
|
661
|
-
}),
|
|
662
|
-
);
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
const pressOn = (editable: HTMLElement, word: string, press: Press = {}) => {
|
|
666
|
-
pressDownOn(editable, word, press);
|
|
667
|
-
pressUpOn(editable, word, press);
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
const tapOn = (editable: HTMLElement, word: string): void =>
|
|
671
|
-
pressOn(editable, word, { pointerType: "touch" });
|
|
672
|
-
|
|
673
|
-
const clickOn = (editable: HTMLElement, word: string): void =>
|
|
674
|
-
pressOn(editable, word);
|
|
675
|
-
|
|
676
|
-
const caretTo = (editable: HTMLElement, offset: number): void => {
|
|
677
|
-
const line = editable.querySelector<HTMLElement>("[data-lexical-text]");
|
|
678
|
-
editable.ownerDocument
|
|
679
|
-
.getSelection()
|
|
680
|
-
?.setPosition(line?.firstChild ?? null, offset);
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
const textOf = (editable: HTMLElement): string =>
|
|
684
|
-
editable.querySelector<HTMLElement>("[data-lexical-text]")?.textContent ?? "";
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* The caret the browser would have put down under the press. Storybook's events
|
|
688
|
-
* are dispatched rather than trusted, so none of them move the caret on their
|
|
689
|
-
* own.
|
|
690
|
-
*/
|
|
691
|
-
const caretInto = (editable: HTMLElement, word: string): void =>
|
|
692
|
-
caretTo(editable, textOf(editable).indexOf(word) + 1);
|
|
693
|
-
|
|
694
|
-
const caretToEnd = (editable: HTMLElement): void =>
|
|
695
|
-
caretTo(editable, textOf(editable).length);
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* The desktop popover portals to the document body, clear of whatever
|
|
699
|
-
* ancestor would otherwise clip it, so the menu and its rows are found
|
|
700
|
-
* against the iframe document rather than `canvasElement` — the sheet below
|
|
701
|
-
* the desktop gate stays inside `canvasElement`, and this still reaches it
|
|
702
|
-
* there too.
|
|
703
|
-
*/
|
|
704
|
-
const menuRows = (
|
|
705
|
-
canvasElement: HTMLElement,
|
|
706
|
-
testId: string,
|
|
707
|
-
): HTMLElement[] => [
|
|
708
|
-
...canvasElement.ownerDocument.body.querySelectorAll<HTMLElement>(
|
|
709
|
-
`[data-testid=${testId}]`,
|
|
710
|
-
),
|
|
711
|
-
];
|
|
712
|
-
|
|
713
|
-
const spellNode = (
|
|
714
|
-
canvasElement: HTMLElement,
|
|
715
|
-
selector: string,
|
|
716
|
-
): Element | null => canvasElement.ownerDocument.body.querySelector(selector);
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* The correction menu over a marked word: up on the click with rows standing in
|
|
720
|
-
* for suggestions that have not arrived, filled when they do, and one undo away
|
|
721
|
-
* from the word that was there before.
|
|
722
|
-
*/
|
|
723
|
-
export const SpellcheckSuggestions: Story = {
|
|
724
|
-
name: "Spellcheck suggestions",
|
|
725
|
-
args: {
|
|
726
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
727
|
-
lang: "en",
|
|
728
|
-
spellcheck: slowSuggestions(600),
|
|
729
|
-
},
|
|
730
|
-
play: async ({ canvasElement }) => {
|
|
731
|
-
const editable = writingSurface(canvasElement);
|
|
732
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(3), {
|
|
733
|
-
timeout: 5000,
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
clickOn(editable, "attachd");
|
|
737
|
-
await waitFor(() =>
|
|
738
|
-
expect(spellNode(canvasElement, "[data-testid=spell-menu]")).toBeTruthy(),
|
|
739
|
-
);
|
|
740
|
-
await expect(
|
|
741
|
-
menuRows(canvasElement, "spell-suggestion-skeleton"),
|
|
742
|
-
).toHaveLength(3);
|
|
743
|
-
|
|
744
|
-
// What Hunspell offers over SCOWL, in its own order. The word the writer
|
|
745
|
-
// meant is in it, which is the whole reason for a real dictionary.
|
|
746
|
-
await waitFor(
|
|
747
|
-
() =>
|
|
748
|
-
expect(
|
|
749
|
-
menuRows(canvasElement, "spell-suggestion").map(
|
|
750
|
-
(row) => row.textContent,
|
|
751
|
-
),
|
|
752
|
-
).toEqual(["attach", "attached", "attache", "attach d"]),
|
|
753
|
-
{ timeout: 5000 },
|
|
754
|
-
);
|
|
755
|
-
|
|
756
|
-
const meant = menuRows(canvasElement, "spell-suggestion").find(
|
|
757
|
-
(row) => row.textContent === "attached",
|
|
758
|
-
);
|
|
759
|
-
if (!meant) throw new Error("no suggestion to pick");
|
|
760
|
-
await userEvent.click(meant);
|
|
761
|
-
|
|
762
|
-
await expect(editable.textContent).toBe(
|
|
763
|
-
MISSPELT.replace("attachd", "attached"),
|
|
764
|
-
);
|
|
765
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(2), {
|
|
766
|
-
timeout: 5000,
|
|
767
|
-
});
|
|
768
|
-
|
|
769
|
-
editable.focus();
|
|
770
|
-
await userEvent.keyboard("{Control>}z{/Control}");
|
|
771
|
-
await waitFor(() => expect(editable.textContent).toBe(MISSPELT), {
|
|
772
|
-
timeout: 5000,
|
|
773
|
-
});
|
|
774
|
-
},
|
|
775
|
-
};
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* A misspelt word at the right edge of a narrow, `overflow-hidden` editor —
|
|
779
|
-
* the compose body's own shape (#731). The menu portals clear of that
|
|
780
|
-
* ancestor rather than being clipped by it, and it stays inside the viewport
|
|
781
|
-
* rather than running past the container's right edge and taking the page's
|
|
782
|
-
* own scrollbar with it.
|
|
783
|
-
*/
|
|
784
|
-
export const SpellcheckNearRightEdge: Story = {
|
|
785
|
-
name: "Spellcheck menu at the right edge of a narrow editor",
|
|
786
|
-
args: {
|
|
787
|
-
initialHtml: `<p>${MISSPELT_MESSAGE}</p>`,
|
|
788
|
-
lang: "en",
|
|
789
|
-
spellcheck: workerSpellcheck,
|
|
790
|
-
},
|
|
791
|
-
decorators: [
|
|
792
|
-
(Story) => (
|
|
793
|
-
<div
|
|
794
|
-
data-testid="body-area"
|
|
795
|
-
className="flex h-[260px] w-[320px] flex-col overflow-hidden rounded-md border border-line bg-canvas"
|
|
796
|
-
>
|
|
797
|
-
<Story />
|
|
798
|
-
</div>
|
|
799
|
-
),
|
|
800
|
-
],
|
|
801
|
-
play: async ({ canvasElement }) => {
|
|
802
|
-
const editable = writingSurface(canvasElement);
|
|
803
|
-
const frame = canvasElement.querySelector<HTMLElement>(
|
|
804
|
-
"[data-testid=body-area]",
|
|
805
|
-
);
|
|
806
|
-
if (!frame) throw new Error("the narrow frame is not mounted");
|
|
807
|
-
|
|
808
|
-
await waitFor(
|
|
809
|
-
() => expect(spellMarks(editable).length).toBeGreaterThan(0),
|
|
810
|
-
{
|
|
811
|
-
timeout: 5000,
|
|
812
|
-
},
|
|
813
|
-
);
|
|
814
|
-
|
|
815
|
-
clickOn(editable, "confrm");
|
|
816
|
-
const menu = await waitFor(() => {
|
|
817
|
-
const found = spellNode(canvasElement, "[data-testid=spell-menu]");
|
|
818
|
-
if (!found) throw new Error("the menu has not opened yet");
|
|
819
|
-
return found;
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
// Portalled clear of the clipping ancestor rather than cut by it.
|
|
823
|
-
await expect(frame.contains(menu)).toBe(false);
|
|
824
|
-
|
|
825
|
-
const box = menu.getBoundingClientRect();
|
|
826
|
-
await expect(box.left).toBeGreaterThanOrEqual(0);
|
|
827
|
-
await expect(box.right).toBeLessThanOrEqual(window.innerWidth);
|
|
828
|
-
|
|
829
|
-
await expect(
|
|
830
|
-
spellNode(canvasElement, "[data-testid=spell-ignore]")?.textContent,
|
|
831
|
-
).toBe("Ignore for now");
|
|
832
|
-
},
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
/**
|
|
836
|
-
* Ignoring a word takes its marks off for as long as the composer is open, and
|
|
837
|
-
* later passes over the same text leave it alone. Nothing is written down: the
|
|
838
|
-
* next composer marks it again.
|
|
839
|
-
*/
|
|
840
|
-
export const SpellcheckSessionIgnore: Story = {
|
|
841
|
-
name: "Spellcheck ignores a word for the session",
|
|
842
|
-
args: {
|
|
843
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
844
|
-
lang: "en",
|
|
845
|
-
spellcheck: workerSpellcheck,
|
|
846
|
-
},
|
|
847
|
-
play: async ({ canvasElement }) => {
|
|
848
|
-
const editable = writingSurface(canvasElement);
|
|
849
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(3), {
|
|
850
|
-
timeout: 5000,
|
|
851
|
-
});
|
|
852
|
-
|
|
853
|
-
clickOn(editable, "attachd");
|
|
854
|
-
const [ignore] = await waitFor(() => {
|
|
855
|
-
const rows = menuRows(canvasElement, "spell-ignore");
|
|
856
|
-
expect(rows).toHaveLength(1);
|
|
857
|
-
return rows;
|
|
858
|
-
});
|
|
859
|
-
if (!ignore) throw new Error("the menu offers no way to ignore");
|
|
860
|
-
await userEvent.click(ignore);
|
|
861
|
-
|
|
862
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(2));
|
|
863
|
-
|
|
864
|
-
// Typed onto the end rather than clicked into: a click on this surface is
|
|
865
|
-
// now how the corrections open, and it would take the keyboard with it.
|
|
866
|
-
editable.focus();
|
|
867
|
-
caretToEnd(editable);
|
|
868
|
-
await userEvent.keyboard(" Attachd again.");
|
|
869
|
-
await waitFor(
|
|
870
|
-
() =>
|
|
871
|
-
expect(
|
|
872
|
-
spellMarks(editable).filter((range) => {
|
|
873
|
-
const text = range.startContainer.textContent ?? "";
|
|
874
|
-
return (
|
|
875
|
-
text.slice(range.startOffset, range.endOffset).toLowerCase() ===
|
|
876
|
-
"attachd"
|
|
877
|
-
);
|
|
878
|
-
}),
|
|
879
|
-
).toHaveLength(0),
|
|
880
|
-
{ timeout: 5000 },
|
|
881
|
-
);
|
|
882
|
-
},
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
* A plain left click is what opens the corrections: a tablet has no right button
|
|
887
|
-
* and nothing should be hidden behind one. The caret the click puts down is
|
|
888
|
-
* reading rather than writing, so the squiggle it landed on stays where it is —
|
|
889
|
-
* clicking a marked word must not be what unmarks it. The next key is the writer
|
|
890
|
-
* back at the text, and the word under the caret goes quiet again.
|
|
891
|
-
*/
|
|
892
|
-
export const SpellcheckClickOpensCorrections: Story = {
|
|
893
|
-
name: "Spellcheck opens on a click",
|
|
894
|
-
args: {
|
|
895
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
896
|
-
lang: "en",
|
|
897
|
-
spellcheck: workerSpellcheck,
|
|
898
|
-
},
|
|
899
|
-
play: async ({ canvasElement }) => {
|
|
900
|
-
const editable = writingSurface(canvasElement);
|
|
901
|
-
const marked: [number, number][] = [
|
|
902
|
-
[0, 3],
|
|
903
|
-
[14, 18],
|
|
904
|
-
[44, 51],
|
|
905
|
-
];
|
|
906
|
-
await waitFor(() => expect(spellMarkOffsets(editable)).toEqual(marked), {
|
|
907
|
-
timeout: 5000,
|
|
908
|
-
});
|
|
909
|
-
|
|
910
|
-
editable.focus();
|
|
911
|
-
pressDownOn(editable, "redy");
|
|
912
|
-
caretInto(editable, "redy");
|
|
913
|
-
pressUpOn(editable, "redy");
|
|
914
|
-
|
|
915
|
-
await waitFor(() =>
|
|
916
|
-
expect(
|
|
917
|
-
spellNode(canvasElement, "[data-testid=spell-word]")?.textContent,
|
|
918
|
-
).toBe("redy"),
|
|
919
|
-
);
|
|
920
|
-
// Long enough for the caret the click put down to have been read and
|
|
921
|
-
// another checking pass to have gone by. It is still not what unmarks the
|
|
922
|
-
// word: this is the writer looking at the corrections for it.
|
|
923
|
-
await new Promise((rested) => setTimeout(rested, 600));
|
|
924
|
-
await expect(spellMarkOffsets(editable)).toEqual(marked);
|
|
925
|
-
|
|
926
|
-
await userEvent.keyboard("{Escape}");
|
|
927
|
-
await waitFor(() =>
|
|
928
|
-
expect(spellNode(canvasElement, "[data-testid=spell-menu]")).toBeNull(),
|
|
929
|
-
);
|
|
930
|
-
|
|
931
|
-
caretInto(editable, "redy");
|
|
932
|
-
editable.dispatchEvent(
|
|
933
|
-
new KeyboardEvent("keydown", { key: "ArrowLeft", bubbles: true }),
|
|
934
|
-
);
|
|
935
|
-
await waitFor(
|
|
936
|
-
() =>
|
|
937
|
-
expect(spellMarkOffsets(editable)).toEqual([
|
|
938
|
-
[0, 3],
|
|
939
|
-
[44, 51],
|
|
940
|
-
]),
|
|
941
|
-
{ timeout: 5000 },
|
|
942
|
-
);
|
|
943
|
-
},
|
|
944
|
-
};
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* The same rows below the desktop gate: a tap in a marked word raises the sheet
|
|
948
|
-
* rather than a popover under the thumb that opened it.
|
|
949
|
-
*/
|
|
950
|
-
export const SpellcheckOnTouch: Story = {
|
|
951
|
-
name: "Spellcheck corrections on a phone",
|
|
952
|
-
globals: { viewport: { value: "mobile" } },
|
|
953
|
-
args: {
|
|
954
|
-
initialHtml: `<p>${MISSPELT}</p>`,
|
|
955
|
-
lang: "en",
|
|
956
|
-
spellcheck: workerSpellcheck,
|
|
957
|
-
},
|
|
958
|
-
decorators: [
|
|
959
|
-
(Story) => (
|
|
960
|
-
<div
|
|
961
|
-
data-testid="body-area"
|
|
962
|
-
className="relative flex h-[560px] w-[360px] flex-col overflow-hidden rounded-md border border-line bg-canvas"
|
|
963
|
-
>
|
|
964
|
-
<Story />
|
|
965
|
-
</div>
|
|
966
|
-
),
|
|
967
|
-
],
|
|
968
|
-
play: async ({ canvasElement }) => {
|
|
969
|
-
const editable = writingSurface(canvasElement);
|
|
970
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(3), {
|
|
971
|
-
timeout: 5000,
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
tapOn(editable, "redy");
|
|
975
|
-
await waitFor(() =>
|
|
976
|
-
expect(spellNode(canvasElement, "[data-testid=spell-menu]")).toBeTruthy(),
|
|
977
|
-
);
|
|
978
|
-
await expect(
|
|
979
|
-
spellNode(canvasElement, "[aria-label='Close corrections']"),
|
|
980
|
-
).toBeTruthy();
|
|
981
|
-
},
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
* The other things a pointer does over a marked word: dragging out a selection
|
|
986
|
-
* with either a finger or a mouse, and the right button, which belongs to the
|
|
987
|
-
* browser's own menu. A sheet over the top of any of them is the one thing they
|
|
988
|
-
* must not get. Closing the sheet hands the caret back.
|
|
989
|
-
*/
|
|
990
|
-
export const SpellcheckLeavesAPointerAlone: Story = {
|
|
991
|
-
...SpellcheckOnTouch,
|
|
992
|
-
name: "Spellcheck leaves a drag and the right button alone",
|
|
993
|
-
play: async ({ canvasElement }) => {
|
|
994
|
-
const editable = writingSurface(canvasElement);
|
|
995
|
-
await waitFor(() => expect(spellMarks(editable).length).toBe(3), {
|
|
996
|
-
timeout: 5000,
|
|
997
|
-
});
|
|
998
|
-
const menu = () => spellNode(canvasElement, "[data-testid=spell-menu]");
|
|
999
|
-
|
|
1000
|
-
pressOn(editable, "redy", { pointerType: "touch", travel: 40 });
|
|
1001
|
-
await expect(menu()).toBeNull();
|
|
1002
|
-
|
|
1003
|
-
pressOn(editable, "redy", { travel: 40 });
|
|
1004
|
-
await expect(menu()).toBeNull();
|
|
1005
|
-
|
|
1006
|
-
pressOn(editable, "redy", { button: 2 });
|
|
1007
|
-
await expect(menu()).toBeNull();
|
|
1008
|
-
|
|
1009
|
-
const contextMenu = new MouseEvent("contextmenu", {
|
|
1010
|
-
bubbles: true,
|
|
1011
|
-
cancelable: true,
|
|
1012
|
-
...centreOf(markRect(editable, "redy")),
|
|
1013
|
-
});
|
|
1014
|
-
editable.dispatchEvent(contextMenu);
|
|
1015
|
-
await expect(contextMenu.defaultPrevented).toBe(false);
|
|
1016
|
-
await expect(menu()).toBeNull();
|
|
1017
|
-
|
|
1018
|
-
tapOn(editable, "redy");
|
|
1019
|
-
await waitFor(() => expect(menu()).toBeTruthy());
|
|
1020
|
-
|
|
1021
|
-
await userEvent.click(
|
|
1022
|
-
spellNode(
|
|
1023
|
-
canvasElement,
|
|
1024
|
-
"[aria-label='Close corrections']",
|
|
1025
|
-
) as HTMLElement,
|
|
1026
|
-
);
|
|
1027
|
-
await waitFor(() => expect(menu()).toBeNull());
|
|
1028
|
-
await waitFor(() => expect(document.activeElement).toBe(editable));
|
|
1029
|
-
},
|
|
1030
|
-
};
|
|
1031
|
-
|
|
1032
|
-
/**
|
|
1033
|
-
* The whole experience, hands on: type into a message full of misspellings,
|
|
1034
|
-
* click a squiggle (or put the caret in one and press Ctrl+.), pick a
|
|
1035
|
-
* correction, ignore a word, or add it to the list this mount keeps. The
|
|
1036
|
-
* theme toolbar switches both surfaces.
|
|
1037
|
-
*/
|
|
1038
|
-
const SpellcheckWorkbench = () => {
|
|
1039
|
-
const [added, setAdded] = useState<string[]>([]);
|
|
1040
|
-
const spellcheck = useMemo(
|
|
1041
|
-
() => slowSuggestions(450, (word) => setAdded((words) => [...words, word])),
|
|
1042
|
-
[],
|
|
1043
|
-
);
|
|
1044
|
-
|
|
1045
|
-
return (
|
|
1046
|
-
<>
|
|
1047
|
-
<RichTextEditor
|
|
1048
|
-
initialHtml={`<p>${MISSPELT_MESSAGE}</p><p>Anything you type here is checked the same way.</p>`}
|
|
1049
|
-
lang="en"
|
|
1050
|
-
spellcheck={spellcheck}
|
|
1051
|
-
trailing={pinnedControls}
|
|
1052
|
-
/>
|
|
1053
|
-
<p
|
|
1054
|
-
data-testid="spell-added-words"
|
|
1055
|
-
className="shrink-0 border-t border-line px-3 py-2 text-xs text-fg-subtle"
|
|
1056
|
-
>
|
|
1057
|
-
{added.length === 0
|
|
1058
|
-
? "Added to the dictionary: nothing yet."
|
|
1059
|
-
: `Added to the dictionary: ${added.join(", ")}.`}
|
|
1060
|
-
</p>
|
|
1061
|
-
</>
|
|
1062
|
-
);
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
export const SpellcheckPlayground: Story = {
|
|
1066
|
-
name: "Spellcheck playground",
|
|
1067
|
-
render: () => <SpellcheckWorkbench />,
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
|
-
export const SpellcheckPlaygroundOnTouch: Story = {
|
|
1071
|
-
name: "Spellcheck playground on a phone",
|
|
1072
|
-
globals: { viewport: { value: "mobile" } },
|
|
1073
|
-
render: () => <SpellcheckWorkbench />,
|
|
1074
|
-
decorators: [
|
|
1075
|
-
(Story) => (
|
|
1076
|
-
<div
|
|
1077
|
-
data-testid="body-area"
|
|
1078
|
-
className="relative flex h-[640px] w-[360px] flex-col overflow-hidden rounded-md border border-line bg-canvas"
|
|
1079
|
-
>
|
|
1080
|
-
<Story />
|
|
1081
|
-
</div>
|
|
1082
|
-
),
|
|
1083
|
-
],
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* The toolbar and the body share one scroller, so twenty lines of typing would
|
|
1088
|
-
* carry the toolbar off the top with them. It stays at the top of the body
|
|
1089
|
-
* while the text moves under it.
|
|
1090
|
-
*/
|
|
1091
|
-
export const StickyToolbar: Story = {
|
|
1092
|
-
name: "Toolbar over a scrolled body",
|
|
1093
|
-
args: {
|
|
1094
|
-
initialHtml: `${RICH_DOCUMENT}${"<p>Another line of the message.</p>".repeat(30)}`,
|
|
1095
|
-
lang: "nl",
|
|
1096
|
-
trailing: pinnedControls,
|
|
1097
|
-
},
|
|
1098
|
-
play: async ({ canvasElement }) => {
|
|
1099
|
-
const frame = canvasElement.querySelector<HTMLElement>(
|
|
1100
|
-
"[data-testid=body-area]",
|
|
1101
|
-
);
|
|
1102
|
-
const toggle = canvasElement.querySelector<HTMLElement>(
|
|
1103
|
-
"[data-testid=compose-mode-toggle]",
|
|
1104
|
-
);
|
|
1105
|
-
if (!frame || !toggle) throw new Error("the toolbar is not mounted");
|
|
1106
|
-
|
|
1107
|
-
frame.scrollTop = 400;
|
|
1108
|
-
await expect(frame.scrollTop).toBeGreaterThan(0);
|
|
1109
|
-
await expect(
|
|
1110
|
-
toggle.getBoundingClientRect().top - frame.getBoundingClientRect().top,
|
|
1111
|
-
).toBeLessThan(60);
|
|
1112
|
-
},
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
const pasteScreenshot = async (editable: HTMLElement): Promise<void> => {
|
|
1116
|
-
const canvas = document.createElement("canvas");
|
|
1117
|
-
canvas.width = 480;
|
|
1118
|
-
canvas.height = 200;
|
|
1119
|
-
const context = canvas.getContext("2d");
|
|
1120
|
-
if (!context) throw new Error("no 2d canvas to draw the screenshot on");
|
|
1121
|
-
context.fillStyle = "#e2e8f0";
|
|
1122
|
-
context.fillRect(0, 0, 480, 200);
|
|
1123
|
-
context.fillStyle = "#3780f6";
|
|
1124
|
-
for (const [index, height] of [60, 120, 90, 160].entries()) {
|
|
1125
|
-
context.fillRect(40 + index * 110, 180 - height, 70, height);
|
|
1126
|
-
}
|
|
1127
|
-
const blob = await new Promise<Blob | null>((resolve) =>
|
|
1128
|
-
canvas.toBlob(resolve, "image/png"),
|
|
1129
|
-
);
|
|
1130
|
-
if (!blob) throw new Error("the screenshot could not be encoded");
|
|
1131
|
-
const clipboard = new DataTransfer();
|
|
1132
|
-
clipboard.items.add(new File([blob], "chart.png", { type: "image/png" }));
|
|
1133
|
-
editable.dispatchEvent(
|
|
1134
|
-
new ClipboardEvent("paste", {
|
|
1135
|
-
clipboardData: clipboard,
|
|
1136
|
-
bubbles: true,
|
|
1137
|
-
cancelable: true,
|
|
1138
|
-
}),
|
|
1139
|
-
);
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
const storyInlineImages: InlineImages = {
|
|
1143
|
-
attach: (files, placement) => {
|
|
1144
|
-
for (const file of files) placement?.stored(file, `${file.name}@remit`);
|
|
1145
|
-
},
|
|
1146
|
-
owns: (contentId) => contentId.endsWith("@remit"),
|
|
1147
|
-
resolve: async () => null,
|
|
1148
|
-
onRemoved: () => () => {},
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
const InlineImageComposer = () => {
|
|
1152
|
-
const [outgoing, setOutgoing] = useState("");
|
|
1153
|
-
return (
|
|
1154
|
-
<>
|
|
1155
|
-
<RichTextEditor
|
|
1156
|
-
initialHtml="<p>This week's numbers:</p>"
|
|
1157
|
-
onChange={(value) => setOutgoing(value.html)}
|
|
1158
|
-
inlineImages={storyInlineImages}
|
|
1159
|
-
/>
|
|
1160
|
-
<output data-testid="outgoing-html" className="sr-only">
|
|
1161
|
-
{outgoing}
|
|
1162
|
-
</output>
|
|
1163
|
-
</>
|
|
1164
|
-
);
|
|
1165
|
-
};
|
|
1166
|
-
|
|
1167
|
-
export const PastedInlineImage: Story = {
|
|
1168
|
-
name: "Pasting a screenshot inline",
|
|
1169
|
-
render: () => <InlineImageComposer />,
|
|
1170
|
-
play: async ({ canvasElement }) => {
|
|
1171
|
-
const editable = canvasElement.querySelector<HTMLElement>(
|
|
1172
|
-
"[data-testid=compose-body]",
|
|
1173
|
-
);
|
|
1174
|
-
const outgoing = canvasElement.querySelector<HTMLElement>(
|
|
1175
|
-
"[data-testid=outgoing-html]",
|
|
1176
|
-
);
|
|
1177
|
-
if (!editable || !outgoing) throw new Error("the editor is not mounted");
|
|
1178
|
-
|
|
1179
|
-
await userEvent.click(editable);
|
|
1180
|
-
await pasteScreenshot(editable);
|
|
1181
|
-
|
|
1182
|
-
const image = await waitFor(() => {
|
|
1183
|
-
const shown = editable.querySelector("img");
|
|
1184
|
-
if (!shown) throw new Error("the screenshot is not in the body");
|
|
1185
|
-
return shown;
|
|
1186
|
-
});
|
|
1187
|
-
await expect(image).toHaveAttribute("alt", "chart.png");
|
|
1188
|
-
await waitFor(() => expect(image.naturalWidth).toBe(480));
|
|
1189
|
-
await waitFor(() =>
|
|
1190
|
-
expect(outgoing.textContent).toContain('src="cid:chart.png@remit"'),
|
|
1191
|
-
);
|
|
1192
|
-
},
|
|
1193
|
-
};
|