@adecore/agents-react 0.31.12 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agents/AccountDot.js +57 -6
- package/dist/agents/AgentIcon.js +88 -12
- package/dist/agents/ModelOptionControl.js +153 -18
- package/dist/agents/ProviderLogo.js +49 -4
- package/dist/agents/account-limits.js +17 -14
- package/dist/agents/accounts.js +99 -67
- package/dist/agents/agent-marks.js +5 -3
- package/dist/agents/model-name.js +42 -31
- package/dist/agents/model-options.js +8 -8
- package/dist/agents/model-requirement.js +17 -14
- package/dist/agents/option-words.d.ts +7 -0
- package/dist/agents/option-words.js +35 -0
- package/dist/agents/provider-paths.js +6 -6
- package/dist/agents/status-look.js +32 -12
- package/dist/chat/account-choice.d.ts +13 -0
- package/dist/chat/account-choice.js +90 -20
- package/dist/chat/actions.js +126 -59
- package/dist/chat/activity.js +5 -5
- package/dist/chat/attachments.js +74 -53
- package/dist/chat/bookmarks.js +58 -48
- package/dist/chat/chat-client.js +344 -263
- package/dist/chat/chat-references.js +3 -3
- package/dist/chat/composer-effort.d.ts +5 -0
- package/dist/chat/composer-effort.js +26 -0
- package/dist/chat/composer-send.js +13 -13
- package/dist/chat/drafts.js +115 -79
- package/dist/chat/forks.js +81 -24
- package/dist/chat/guards.js +15 -43
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +3 -2
- package/dist/chat/logic/ansi.js +170 -167
- package/dist/chat/logic/answers.js +2 -2
- package/dist/chat/logic/bookmarks.js +19 -19
- package/dist/chat/logic/command-looks.js +138 -96
- package/dist/chat/logic/context-usage.js +13 -9
- package/dist/chat/logic/continue-after-stop.js +15 -19
- package/dist/chat/logic/effort.d.ts +14 -0
- package/dist/chat/logic/effort.js +34 -0
- package/dist/chat/logic/embedded-code.js +387 -326
- package/dist/chat/logic/fork.js +134 -110
- package/dist/chat/logic/generated-image.js +54 -23
- package/dist/chat/logic/goal.js +28 -20
- package/dist/chat/logic/handback.js +6 -6
- package/dist/chat/logic/json.js +2 -2
- package/dist/chat/logic/limit.js +46 -30
- package/dist/chat/logic/picker-entries.d.ts +5 -3
- package/dist/chat/logic/picker-entries.js +83 -43
- package/dist/chat/logic/resume-compaction.d.ts +14 -1
- package/dist/chat/logic/resume-compaction.js +93 -24
- package/dist/chat/logic/scrubber.js +188 -136
- package/dist/chat/logic/thought.js +13 -16
- package/dist/chat/logic/thread-cards.js +60 -48
- package/dist/chat/logic/timeline-copy.js +30 -38
- package/dist/chat/logic/timeline-target.js +92 -63
- package/dist/chat/logic/timeline.js +499 -355
- package/dist/chat/logic/tool-catalog.js +54 -34
- package/dist/chat/logic/tools.js +106 -82
- package/dist/chat/logic/visual-height.js +18 -18
- package/dist/chat/logic/visual-viewport.js +6 -3
- package/dist/chat/logic/welcome.js +9 -9
- package/dist/chat/logic/workflow.d.ts +10 -0
- package/dist/chat/logic/workflow.js +130 -32
- package/dist/chat/mentions.js +149 -109
- package/dist/chat/persisted-json.js +51 -54
- package/dist/chat/preferences.d.ts +4 -0
- package/dist/chat/preferences.js +162 -84
- package/dist/chat/prompt-hold.js +9 -9
- package/dist/chat/quote.js +21 -30
- package/dist/chat/reading-width.js +12 -10
- package/dist/chat/recent-messages.js +34 -21
- package/dist/chat/resume-compaction-dismissals.js +25 -5
- package/dist/chat/runtime-modes.js +3 -3
- package/dist/chat/send-key.js +11 -7
- package/dist/chat/stash.js +89 -69
- package/dist/chat/subagent-conversation.js +181 -139
- package/dist/chat/subagent-list.js +65 -67
- package/dist/chat/subagent-support.js +12 -7
- package/dist/chat/subagent-view.js +132 -44
- package/dist/chat/thumbnails.js +88 -60
- package/dist/chat/timeline-flash.js +24 -12
- package/dist/chat/timeline-scroll.js +116 -86
- package/dist/chat/ui/AccountPill.js +126 -15
- package/dist/chat/ui/AnsiOutput.js +62 -6
- package/dist/chat/ui/BookmarkMarker.js +231 -41
- package/dist/chat/ui/BookmarkSubmenu.js +165 -18
- package/dist/chat/ui/ChatActivity.js +649 -70
- package/dist/chat/ui/ChatReferenceChip.js +104 -9
- package/dist/chat/ui/CodeBlock.js +132 -58
- package/dist/chat/ui/Composer.js +866 -132
- package/dist/chat/ui/ComposerInput.js +309 -120
- package/dist/chat/ui/DiffPool.js +75 -14
- package/dist/chat/ui/EditDiff.js +160 -21
- package/dist/chat/ui/FadingWords.js +32 -3
- package/dist/chat/ui/GoalDock.js +235 -42
- package/dist/chat/ui/ImageView.js +617 -61
- package/dist/chat/ui/LimitState.js +446 -72
- package/dist/chat/ui/Markdown.js +991 -173
- package/dist/chat/ui/MermaidBlock.js +285 -79
- package/dist/chat/ui/MessageActions.js +251 -39
- package/dist/chat/ui/ModelMarks.js +55 -5
- package/dist/chat/ui/Pickers.js +664 -113
- package/dist/chat/ui/PromptComposer.js +281 -51
- package/dist/chat/ui/QuoteButton.js +151 -57
- package/dist/chat/ui/ResumeCompactionDock.d.ts +6 -2
- package/dist/chat/ui/ResumeCompactionDock.js +141 -6
- package/dist/chat/ui/RowTime.js +59 -5
- package/dist/chat/ui/RunSettings.js +1744 -154
- package/dist/chat/ui/Scrubber.js +517 -88
- package/dist/chat/ui/ShellCommand.js +183 -107
- package/dist/chat/ui/SubagentControls.js +212 -24
- package/dist/chat/ui/SubagentInfo.js +170 -13
- package/dist/chat/ui/SubagentStopButton.js +115 -24
- package/dist/chat/ui/SubagentTimeline.js +357 -91
- package/dist/chat/ui/Timeline.js +988 -476
- package/dist/chat/ui/TimelineMenu.js +552 -37
- package/dist/chat/ui/UnifiedDiff.js +234 -27
- package/dist/chat/ui/UploadThumb.js +37 -7
- package/dist/chat/ui/VisualDialogs.js +251 -20
- package/dist/chat/ui/VisualFrame.js +321 -95
- package/dist/chat/ui/Welcome.js +72 -7
- package/dist/chat/ui/chips.js +1 -1
- package/dist/chat/ui/code-lines.js +36 -36
- package/dist/chat/ui/code-streaming.js +1 -1
- package/dist/chat/ui/code-theme.js +7 -7
- package/dist/chat/ui/composer/ComposerControls.js +329 -21
- package/dist/chat/ui/composer/ComposerMenu.js +358 -30
- package/dist/chat/ui/composer/DraftParts.js +185 -11
- package/dist/chat/ui/composer/QueuedMessages.js +138 -13
- package/dist/chat/ui/composer/chips.js +29 -19
- package/dist/chat/ui/composer/editor.js +79 -63
- package/dist/chat/ui/composer/insert.js +26 -12
- package/dist/chat/ui/composer/key-handler.js +180 -127
- package/dist/chat/ui/composer/keys.js +90 -73
- package/dist/chat/ui/composer/menu-aria.js +18 -9
- package/dist/chat/ui/composer/placeholder.js +78 -31
- package/dist/chat/ui/composer/surface.js +13 -37
- package/dist/chat/ui/composer/use-chat-controls.js +230 -90
- package/dist/chat/ui/composer/use-compaction-offer.js +50 -18
- package/dist/chat/ui/composer/use-composer-draft.js +65 -34
- package/dist/chat/ui/composer/use-composer-menus.js +478 -193
- package/dist/chat/ui/composer/use-composer-submit.js +251 -109
- package/dist/chat/ui/composer/use-continuable-turn.js +33 -6
- package/dist/chat/ui/composer/use-draft-files.js +245 -93
- package/dist/chat/ui/composer/use-effort-stepper.d.ts +13 -0
- package/dist/chat/ui/composer/use-effort-stepper.js +88 -0
- package/dist/chat/ui/composer/use-notice.js +61 -16
- package/dist/chat/ui/composer/use-pending-requests.js +38 -17
- package/dist/chat/ui/composer/use-prompt-history.js +117 -45
- package/dist/chat/ui/composer/use-prompt-hold.js +119 -35
- package/dist/chat/ui/composer/use-take-back.js +94 -72
- package/dist/chat/ui/diff/ApprovalReview.js +101 -23
- package/dist/chat/ui/diff/DiffFallbackBoundary.js +21 -13
- package/dist/chat/ui/diff/DiffOmitted.js +56 -6
- package/dist/chat/ui/diff/DiffStack.js +92 -8
- package/dist/chat/ui/diff/DiffUnavailable.js +56 -6
- package/dist/chat/ui/diff/EditorEditDiff.js +263 -51
- package/dist/chat/ui/diff/EditorPatchDiff.js +39 -14
- package/dist/chat/ui/diff/LegacyDiffPool.js +27 -10
- package/dist/chat/ui/diff/LegacyEditDiff.js +97 -20
- package/dist/chat/ui/diff/LegacyUnifiedDiff.js +172 -42
- package/dist/chat/ui/diff/RawDiff.js +65 -5
- package/dist/chat/ui/diff/ReviewDiff.js +77 -5
- package/dist/chat/ui/diff/diff-props.js +1 -1
- package/dist/chat/ui/diff/diff-source-budget.js +46 -35
- package/dist/chat/ui/diff/editor-edit-model.js +18 -14
- package/dist/chat/ui/diff/review-plan.js +63 -40
- package/dist/chat/ui/diff/review-settle.js +24 -9
- package/dist/chat/ui/diff/syntax-runtime.js +236 -201
- package/dist/chat/ui/diff/use-review-stack.js +146 -25
- package/dist/chat/ui/diff-syntax.js +70 -58
- package/dist/chat/ui/diff-theme.js +31 -12
- package/dist/chat/ui/file-links.js +39 -10
- package/dist/chat/ui/find-reveal.js +29 -8
- package/dist/chat/ui/full-diff.js +17 -12
- package/dist/chat/ui/highlighter.js +143 -113
- package/dist/chat/ui/icons.js +16 -7
- package/dist/chat/ui/index.js +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +556 -82
- package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +73 -5
- package/dist/chat/ui/intelligent-ui/UiReply.js +666 -262
- package/dist/chat/ui/intelligent-ui/block-local.js +59 -31
- package/dist/chat/ui/intelligent-ui/chart-data.js +77 -67
- package/dist/chat/ui/intelligent-ui/node-text.js +77 -91
- package/dist/chat/ui/intelligent-ui/registry.js +46 -46
- package/dist/chat/ui/intelligent-ui/render-context.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/base-land.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/binding.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/chart.js +1223 -123
- package/dist/chat/ui/intelligent-ui/renderers/choices.js +312 -34
- package/dist/chat/ui/intelligent-ui/renderers/content.js +1241 -86
- package/dist/chat/ui/intelligent-ui/renderers/data.js +619 -54
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +868 -67
- package/dist/chat/ui/intelligent-ui/renderers/links.js +366 -62
- package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +118 -60
- package/dist/chat/ui/intelligent-ui/renderers/map-style.js +85 -78
- package/dist/chat/ui/intelligent-ui/renderers/map-view.js +282 -217
- package/dist/chat/ui/intelligent-ui/renderers/map.js +621 -69
- package/dist/chat/ui/intelligent-ui/renderers/place-point.js +15 -8
- package/dist/chat/ui/intelligent-ui/renderers/structure.js +262 -20
- package/dist/chat/ui/intelligent-ui/renderers/text.js +674 -49
- package/dist/chat/ui/intelligent-ui/reply-parts.js +24 -15
- package/dist/chat/ui/intelligent-ui/table-data.js +97 -57
- package/dist/chat/ui/intelligent-ui/tones.js +31 -31
- package/dist/chat/ui/intelligent-ui/use-in-view.js +30 -12
- package/dist/chat/ui/intelligent-ui/use-later.js +28 -13
- package/dist/chat/ui/intelligent-ui/use-truncated.js +45 -21
- package/dist/chat/ui/intelligent-ui/use-ui-links.js +296 -109
- package/dist/chat/ui/intelligent-ui/use-ui-queries.js +256 -246
- package/dist/chat/ui/markdown-blocks.js +296 -262
- package/dist/chat/ui/mermaid.d.ts +8 -20
- package/dist/chat/ui/mermaid.js +47 -84
- package/dist/chat/ui/quote-selection.js +32 -29
- package/dist/chat/ui/rehype-chips.js +35 -23
- package/dist/chat/ui/rehype-fade.js +28 -17
- package/dist/chat/ui/remark-html-as-text.js +22 -15
- package/dist/chat/ui/reply-context.js +1 -1
- package/dist/chat/ui/reveal.js +161 -72
- package/dist/chat/ui/rows/ForksRow.js +226 -24
- package/dist/chat/ui/rows/GeneratedImageRow.js +541 -87
- package/dist/chat/ui/rows/MessageRows.js +1706 -159
- package/dist/chat/ui/rows/RowContainer.js +57 -7
- package/dist/chat/ui/rows/Rows.js +463 -54
- package/dist/chat/ui/rows/SubagentRow.js +577 -60
- package/dist/chat/ui/rows/TaskRow.js +359 -40
- package/dist/chat/ui/rows/VisualRow.js +233 -11
- package/dist/chat/ui/rows/WorkRows.d.ts +3 -0
- package/dist/chat/ui/rows/WorkRows.js +1945 -164
- package/dist/chat/ui/rows/WorkflowRow.js +756 -37
- package/dist/chat/ui/rows/row-rhythm.js +27 -17
- package/dist/chat/ui/theme-watch.js +26 -23
- package/dist/chat/ui/timestamp-format.js +4 -1
- package/dist/chat/ui/use-diff-source-tokens.js +70 -34
- package/dist/chat/ui/useToggleSet.js +51 -19
- package/dist/chat/ui/visual-theme.js +153 -128
- package/dist/chat/visual-bridge.js +123 -123
- package/dist/chat/visual-viewport.js +94 -83
- package/dist/chat/visuals.js +13 -5
- package/dist/host-hooks.d.ts +29 -0
- package/dist/host-hooks.js +78 -0
- package/dist/host.js +120 -48
- package/dist/index.js +1 -1
- package/dist/lazy.js +38 -32
- package/dist/locales/en/agent-chat.d.ts +42 -0
- package/dist/locales/en/agent-chat.js +755 -713
- package/dist/locales/en/agent-prompts.js +42 -42
- package/dist/locales/en/agent-providers.d.ts +1 -0
- package/dist/locales/en/agent-providers.js +166 -165
- package/dist/locales/en/agent-usage.d.ts +6 -0
- package/dist/locales/en/agent-usage.js +129 -123
- package/dist/locales/nl/agent-chat.d.ts +42 -0
- package/dist/locales/nl/agent-chat.js +755 -713
- package/dist/locales/nl/agent-prompts.js +42 -42
- package/dist/locales/nl/agent-providers.d.ts +1 -0
- package/dist/locales/nl/agent-providers.js +166 -165
- package/dist/locales/nl/agent-usage.d.ts +6 -0
- package/dist/locales/nl/agent-usage.js +129 -123
- package/dist/locales.js +14 -14
- package/dist/mounted-registry.js +31 -30
- package/dist/port-transport.js +122 -111
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/logic/focus.js +15 -14
- package/dist/prompts/logic/keys.js +93 -59
- package/dist/prompts/logic/prompts.js +27 -14
- package/dist/prompts/logic/subjects.js +60 -46
- package/dist/prompts/logic/useFocusAfterAnswer.js +60 -20
- package/dist/prompts/logic/usePromptSession.js +88 -77
- package/dist/prompts/ui/ApprovalBody.js +246 -27
- package/dist/prompts/ui/PromptActions.js +215 -9
- package/dist/prompts/ui/PromptCard.js +215 -36
- package/dist/prompts/ui/PromptView.js +372 -34
- package/dist/prompts/ui/QuestionBody.js +269 -73
- package/dist/providers/AccountColors.js +36 -5
- package/dist/providers/AccountDetail.js +683 -50
- package/dist/providers/AccountVariables.js +139 -32
- package/dist/providers/AddAccountForm.js +125 -38
- package/dist/providers/CliDetail.js +343 -36
- package/dist/providers/InstallPage.js +644 -59
- package/dist/providers/ProviderList.d.ts +2 -1
- package/dist/providers/ProviderList.js +215 -23
- package/dist/providers/ProvidersPane.d.ts +4 -2
- package/dist/providers/ProvidersPane.js +244 -64
- package/dist/providers/account-actions.js +54 -30
- package/dist/providers/index.js +1 -1
- package/dist/providers/install-steps.js +12 -9
- package/dist/providers/pane-target.d.ts +3 -0
- package/dist/providers/pane-target.js +34 -13
- package/dist/providers/parts.js +62 -12
- package/dist/providers/provider-abilities.js +5 -5
- package/dist/providers/provider-groups.js +75 -40
- package/dist/providers/variables.js +73 -39
- package/dist/scope.js +6 -6
- package/dist/settings/sections.js +18 -18
- package/dist/state/chats.js +404 -192
- package/dist/state/index.js +1 -1
- package/dist/state/provider-accounts.js +70 -47
- package/dist/state/providers.js +45 -16
- package/dist/state/usage.js +154 -77
- package/dist/storage.js +69 -68
- package/dist/testing/index.js +1 -1
- package/dist/testing/prompts.js +105 -67
- package/dist/transport.js +10 -10
- package/dist/ui/PlainTextarea.js +27 -3
- package/dist/usage/LimitsList.js +646 -40
- package/dist/usage/UsageBreakdown.js +879 -38
- package/dist/usage/UsageChart.js +311 -32
- package/dist/usage/UsageDialog.js +46 -4
- package/dist/usage/UsageLimits.js +467 -34
- package/dist/usage/UsageLimitsCard.js +95 -11
- package/dist/usage/UsagePage.js +817 -96
- package/dist/usage/UsagePane.js +164 -10
- package/dist/usage/UsageSummary.js +151 -6
- package/dist/usage/UsageTiles.js +164 -14
- package/dist/usage/format.js +32 -32
- package/dist/usage/index.d.ts +1 -1
- package/dist/usage/index.js +2 -1
- package/dist/usage/limit-groups.d.ts +2 -0
- package/dist/usage/limit-groups.js +77 -59
- package/dist/usage/limits.js +78 -43
- package/dist/usage/money.js +20 -4
- package/dist/usage/summary.js +85 -64
- package/package.json +9 -9
- package/src/agents/ModelOptionControl.tsx +3 -1
- package/src/agents/option-words.ts +27 -0
- package/src/chat/account-choice.ts +41 -1
- package/src/chat/composer-effort.ts +32 -0
- package/src/chat/forks.ts +4 -5
- package/src/chat/index.ts +3 -1
- package/src/chat/logic/effort.ts +32 -0
- package/src/chat/logic/picker-entries.ts +45 -10
- package/src/chat/logic/resume-compaction.ts +95 -17
- package/src/chat/logic/timeline.ts +11 -3
- package/src/chat/logic/workflow.ts +86 -4
- package/src/chat/preferences.ts +35 -0
- package/src/chat/subagent-view.ts +2 -3
- package/src/chat/ui/AnsiOutput.tsx +1 -2
- package/src/chat/ui/BookmarkSubmenu.tsx +3 -3
- package/src/chat/ui/ChatActivity.tsx +14 -22
- package/src/chat/ui/ChatReferenceChip.tsx +2 -3
- package/src/chat/ui/Composer.tsx +15 -7
- package/src/chat/ui/EditDiff.tsx +2 -3
- package/src/chat/ui/LimitState.tsx +2 -2
- package/src/chat/ui/Markdown.tsx +10 -8
- package/src/chat/ui/MermaidBlock.tsx +57 -49
- package/src/chat/ui/Pickers.tsx +49 -29
- package/src/chat/ui/PromptComposer.tsx +7 -9
- package/src/chat/ui/ResumeCompactionDock.tsx +16 -4
- package/src/chat/ui/RunSettings.tsx +67 -28
- package/src/chat/ui/Scrubber.tsx +3 -3
- package/src/chat/ui/ShellCommand.tsx +2 -0
- package/src/chat/ui/SubagentInfo.tsx +2 -3
- package/src/chat/ui/SubagentTimeline.tsx +12 -16
- package/src/chat/ui/Timeline.tsx +6 -6
- package/src/chat/ui/UnifiedDiff.tsx +3 -4
- package/src/chat/ui/VisualFrame.tsx +5 -8
- package/src/chat/ui/code-theme.ts +4 -4
- package/src/chat/ui/composer/placeholder.ts +2 -2
- package/src/chat/ui/composer/use-compaction-offer.ts +36 -16
- package/src/chat/ui/composer/use-composer-menus.ts +4 -9
- package/src/chat/ui/composer/use-composer-submit.ts +2 -1
- package/src/chat/ui/composer/use-effort-stepper.ts +56 -0
- package/src/chat/ui/composer/use-notice.ts +2 -2
- package/src/chat/ui/diff/EditorEditDiff.tsx +9 -13
- package/src/chat/ui/diff/LegacyEditDiff.tsx +12 -17
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +13 -21
- package/src/chat/ui/diff/use-review-stack.ts +4 -4
- package/src/chat/ui/diff-theme.ts +3 -3
- package/src/chat/ui/file-links.ts +2 -2
- package/src/chat/ui/intelligent-ui/UiReply.tsx +2 -0
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +5 -6
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -1
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +2 -1
- package/src/chat/ui/intelligent-ui/use-truncated.ts +16 -19
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +3 -3
- package/src/chat/ui/mermaid.ts +52 -96
- package/src/chat/ui/rows/ForksRow.tsx +3 -5
- package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -1
- package/src/chat/ui/rows/MessageRows.tsx +12 -21
- package/src/chat/ui/rows/SubagentRow.tsx +3 -3
- package/src/chat/ui/rows/TaskRow.tsx +1 -1
- package/src/chat/ui/rows/WorkRows.tsx +11 -6
- package/src/chat/ui/rows/WorkflowRow.tsx +144 -54
- package/src/chat/ui/useToggleSet.ts +15 -18
- package/src/chat/ui/visual-theme.ts +2 -3
- package/src/host-hooks.ts +113 -0
- package/src/lazy.tsx +2 -0
- package/src/locales/en/agent-chat.ts +142 -108
- package/src/locales/en/agent-prompts.ts +7 -7
- package/src/locales/en/agent-providers.ts +35 -34
- package/src/locales/en/agent-usage.ts +26 -20
- package/src/locales/nl/agent-chat.ts +134 -100
- package/src/locales/nl/agent-prompts.ts +5 -5
- package/src/locales/nl/agent-providers.ts +33 -32
- package/src/locales/nl/agent-usage.ts +25 -20
- package/src/providers/CliDetail.tsx +2 -1
- package/src/providers/InstallPage.tsx +2 -4
- package/src/providers/ProviderList.tsx +12 -2
- package/src/providers/ProvidersPane.tsx +45 -15
- package/src/providers/pane-target.ts +20 -4
- package/src/state/chats.ts +2 -2
- package/src/usage/LimitsList.tsx +12 -13
- package/src/usage/UsageBreakdown.tsx +17 -6
- package/src/usage/UsageLimits.tsx +2 -1
- package/src/usage/UsagePage.tsx +3 -3
- package/src/usage/index.ts +1 -1
- package/src/usage/limit-groups.ts +12 -0
- package/src/usage/limits.ts +2 -2
- package/src/usage/money.ts +1 -2
|
@@ -5,146 +5,199 @@ import { STASH_SHORTCUT } from '../../stash.js';
|
|
|
5
5
|
import { pageTimeline } from '../../timeline-scroll.js';
|
|
6
6
|
import { enterAction, inCode, inFenceBody, inOpenFence, listItemAt, recallDirection, tabSpaces } from './keys.js';
|
|
7
7
|
const SEND_HOW = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
send: 'default',
|
|
9
|
+
'send-alternate': 'alternate',
|
|
10
|
+
'send-and-new': 'and-new'
|
|
11
11
|
};
|
|
12
12
|
/* In a fence Tab indents like a code editor; anywhere else it keeps moving the focus. */
|
|
13
13
|
function indentInFence(e, view) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const {
|
|
15
|
+
state
|
|
16
|
+
} = view;
|
|
17
|
+
const {
|
|
18
|
+
from,
|
|
19
|
+
to,
|
|
20
|
+
head
|
|
21
|
+
} = state.selection.main;
|
|
22
|
+
const tree = ensureSyntaxTree(state, state.doc.length, 50) ?? syntaxTree(state);
|
|
23
|
+
if (!inFenceBody(tree, state.doc.toString(), head)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
// Handled even when there is nothing to outdent, so Shift+Tab never throws the focus out of a block.
|
|
27
|
+
if (e.shiftKey) {
|
|
28
|
+
indentLess(view);
|
|
29
|
+
} else if (from !== to) {
|
|
30
|
+
indentMore(view);
|
|
31
|
+
} else {
|
|
32
|
+
view.dispatch(state.replaceSelection(tabSpaces(head - state.doc.lineAt(head).from)), {
|
|
33
|
+
scrollIntoView: true,
|
|
34
|
+
userEvent: 'input'
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/* The keys an open picker takes: the arrows walk it, and Tab (or Enter, outside the commands) picks. */
|
|
40
|
+
function pickInMenu(e, {
|
|
41
|
+
menus,
|
|
42
|
+
setText
|
|
43
|
+
}) {
|
|
44
|
+
const {
|
|
45
|
+
activeIndex
|
|
46
|
+
} = menus;
|
|
47
|
+
if (menus.commandMenuOpen) {
|
|
48
|
+
if (menus.moveInMenu(e.key, menus.commands.length)) {
|
|
49
|
+
return true;
|
|
19
50
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
51
|
+
if (e.key === 'Tab') {
|
|
52
|
+
const chosen = menus.commands[activeIndex];
|
|
53
|
+
if (chosen.skill) {
|
|
54
|
+
menus.chooseSkill(chosen.name);
|
|
55
|
+
} else {
|
|
56
|
+
setText(`/${chosen.name} `);
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
23
59
|
}
|
|
24
|
-
|
|
25
|
-
|
|
60
|
+
}
|
|
61
|
+
if (menus.skillMenuOpen) {
|
|
62
|
+
if (menus.moveInMenu(e.key, menus.skillMatches.length)) {
|
|
63
|
+
return true;
|
|
26
64
|
}
|
|
27
|
-
|
|
28
|
-
|
|
65
|
+
if (e.key === 'Tab' || e.key === 'Enter') {
|
|
66
|
+
menus.chooseSkill((menus.skillMatches[activeIndex] ?? menus.skillMatches[0]).name);
|
|
67
|
+
return true;
|
|
29
68
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const { activeIndex } = menus;
|
|
35
|
-
if (menus.commandMenuOpen) {
|
|
36
|
-
if (menus.moveInMenu(e.key, menus.commands.length)) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (e.key === 'Tab') {
|
|
40
|
-
const chosen = menus.commands[activeIndex];
|
|
41
|
-
if (chosen.skill) {
|
|
42
|
-
menus.chooseSkill(chosen.name);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setText(`/${chosen.name} `);
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (menus.skillMenuOpen) {
|
|
51
|
-
if (menus.moveInMenu(e.key, menus.skillMatches.length)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
if (e.key === 'Tab' || e.key === 'Enter') {
|
|
55
|
-
menus.chooseSkill((menus.skillMatches[activeIndex] ?? menus.skillMatches[0]).name);
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
69
|
+
}
|
|
70
|
+
if (menus.mentionMenuOpen && menus.mentionCount > 0) {
|
|
71
|
+
if (menus.moveInMenu(e.key, menus.mentionCount)) {
|
|
72
|
+
return true;
|
|
58
73
|
}
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (e.key === 'Tab' || e.key === 'Enter') {
|
|
64
|
-
menus.chooseMentionAt(activeIndex);
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
74
|
+
if (e.key === 'Tab' || e.key === 'Enter') {
|
|
75
|
+
menus.chooseMentionAt(activeIndex);
|
|
76
|
+
return true;
|
|
67
77
|
}
|
|
68
|
-
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
69
80
|
}
|
|
70
81
|
/* Enter sends, adds a line, or carries a list on, by the send key and where the caret is. */
|
|
71
|
-
function enter(e, view, {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
function enter(e, view, {
|
|
83
|
+
host,
|
|
84
|
+
sendKey,
|
|
85
|
+
submit
|
|
86
|
+
}) {
|
|
87
|
+
const {
|
|
88
|
+
state
|
|
89
|
+
} = view;
|
|
90
|
+
const {
|
|
91
|
+
from,
|
|
92
|
+
to,
|
|
93
|
+
head
|
|
94
|
+
} = state.selection.main;
|
|
95
|
+
// Parsed to the end, since the fence that closes the block can sit after the caret.
|
|
96
|
+
const tree = ensureSyntaxTree(state, state.doc.length, 50) ?? syntaxTree(state);
|
|
97
|
+
const line = state.doc.lineAt(head);
|
|
98
|
+
const list = from === to && !inCode(tree, state.doc.toString(), head) ? listItemAt(line.text) : null;
|
|
99
|
+
const action = enterAction({
|
|
100
|
+
shift: e.shiftKey,
|
|
101
|
+
mod: isModHeld(e, host.isApplePlatform()),
|
|
102
|
+
alt: e.altKey
|
|
103
|
+
}, {
|
|
104
|
+
inOpenFence: inOpenFence(tree, head),
|
|
105
|
+
list,
|
|
106
|
+
column: head - line.from,
|
|
107
|
+
sendKey,
|
|
108
|
+
multiline: state.doc.lines > 1,
|
|
109
|
+
startsNewChat: host.openNewChat !== null
|
|
110
|
+
});
|
|
111
|
+
if (action === 'newline') {
|
|
112
|
+
return insertNewline(view);
|
|
113
|
+
}
|
|
114
|
+
if (action === 'continue-list') {
|
|
115
|
+
if (list) {
|
|
116
|
+
view.dispatch({
|
|
117
|
+
changes: {
|
|
118
|
+
from: head,
|
|
119
|
+
insert: `\n${list.next}`
|
|
120
|
+
},
|
|
121
|
+
selection: {
|
|
122
|
+
anchor: head + 1 + list.next.length
|
|
123
|
+
},
|
|
124
|
+
scrollIntoView: true,
|
|
125
|
+
userEvent: 'input'
|
|
126
|
+
});
|
|
103
127
|
}
|
|
104
|
-
submit(SEND_HOW[action]);
|
|
105
128
|
return true;
|
|
129
|
+
}
|
|
130
|
+
if (action === 'leave-list') {
|
|
131
|
+
view.dispatch({
|
|
132
|
+
changes: {
|
|
133
|
+
from: line.from,
|
|
134
|
+
to: line.to
|
|
135
|
+
},
|
|
136
|
+
selection: {
|
|
137
|
+
anchor: line.from
|
|
138
|
+
},
|
|
139
|
+
userEvent: 'delete'
|
|
140
|
+
});
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
submit(SEND_HOW[action]);
|
|
144
|
+
return true;
|
|
106
145
|
}
|
|
107
146
|
/* Runs before the editor's own keymap; true means the key is handled and its default prevented. */
|
|
108
147
|
export function composerKeyHandler(input) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
148
|
+
const {
|
|
149
|
+
chatId,
|
|
150
|
+
host,
|
|
151
|
+
text,
|
|
152
|
+
history
|
|
153
|
+
} = input;
|
|
154
|
+
return (e, view) => {
|
|
155
|
+
input.noteKey(e);
|
|
156
|
+
// Escape leaves the node, unless it first has a recalled prompt to put back.
|
|
157
|
+
if (e.key === 'Escape' && !e.isComposing) {
|
|
158
|
+
if (!history.leave()) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
// The app's own shortcuts stay the app's while you type: Mod+Shift+Enter would otherwise send as well.
|
|
165
|
+
if (host.isAppShortcut(e)) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
e.stopPropagation();
|
|
169
|
+
// A key inside an IME composition belongs to the composition, Enter and the arrows included.
|
|
170
|
+
if (e.isComposing) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
// Reading back through a long answer should not mean leaving the box you are typing in.
|
|
174
|
+
if (e.key === 'PageUp' || e.key === 'PageDown') {
|
|
175
|
+
return pageTimeline(chatId, e.key === 'PageUp' ? -1 : 1);
|
|
176
|
+
}
|
|
177
|
+
if (matchesShortcut(STASH_SHORTCUT, e, host.isApplePlatform())) {
|
|
178
|
+
input.toggleStash();
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
if (pickInMenu(e, input)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (e.key === 'Tab' && !e.altKey && !e.metaKey && !e.ctrlKey && indentInFence(e, view)) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
if (e.key === 'Enter') {
|
|
188
|
+
return enter(e, view, input);
|
|
189
|
+
}
|
|
190
|
+
const {
|
|
191
|
+
from,
|
|
192
|
+
to
|
|
193
|
+
} = view.state.selection.main;
|
|
194
|
+
const direction = recallDirection({
|
|
195
|
+
key: e.key,
|
|
196
|
+
text,
|
|
197
|
+
from,
|
|
198
|
+
to,
|
|
199
|
+
recalled: history.recalled(text)
|
|
200
|
+
});
|
|
201
|
+
return direction !== null && history.recall(direction);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
@@ -2,13 +2,17 @@ import { modSends } from '../../send-key.js';
|
|
|
2
2
|
const LIST_ITEM = /^([ \t]*)(?:([-*+])|(\d{1,9})([.)]))([ \t]+)(\[[ xX]\](?:[ \t]+|$))?/;
|
|
3
3
|
/* The list item a line starts, if it starts one. */
|
|
4
4
|
export function listItemAt(line) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const match = LIST_ITEM.exec(line);
|
|
6
|
+
if (match === null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const [prefix, indent, bullet, number, delimiter, space, task] = match;
|
|
10
|
+
const marker = bullet ?? `${Number(number) + 1}${delimiter}`;
|
|
11
|
+
return {
|
|
12
|
+
prefix,
|
|
13
|
+
next: `${indent}${marker}${space}${task ? '[ ] ' : ''}`,
|
|
14
|
+
empty: line.slice(prefix.length).trim() === ''
|
|
15
|
+
};
|
|
12
16
|
}
|
|
13
17
|
/*
|
|
14
18
|
* Enter sends, except where whoever types is still writing: inside a fence nobody has closed yet
|
|
@@ -17,59 +21,66 @@ export function listItemAt(line) {
|
|
|
17
21
|
* is Mod+Enter, Enter adds a line instead of sending. Alt sends the other way (queue or steer), and so
|
|
18
22
|
* does Mod+Shift+Enter where Mod+Enter is the send key; Mod+Alt+Enter is the send that opens a new chat.
|
|
19
23
|
*/
|
|
20
|
-
export function enterAction(keys, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// A caret in front of the marker moves the item down rather than splitting its marker.
|
|
33
|
-
if (column < list.prefix.length) {
|
|
34
|
-
return 'newline';
|
|
35
|
-
}
|
|
36
|
-
return list.empty ? 'leave-list' : 'continue-list';
|
|
24
|
+
export function enterAction(keys, {
|
|
25
|
+
inOpenFence,
|
|
26
|
+
list,
|
|
27
|
+
column,
|
|
28
|
+
sendKey = 'enter',
|
|
29
|
+
multiline = false,
|
|
30
|
+
startsNewChat = false
|
|
31
|
+
}) {
|
|
32
|
+
const modOnly = modSends(sendKey, multiline);
|
|
33
|
+
if (keys.mod) {
|
|
34
|
+
if (keys.alt && startsNewChat) {
|
|
35
|
+
return 'send-and-new';
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
return keys.alt || modOnly && keys.shift ? 'send-alternate' : 'send';
|
|
38
|
+
}
|
|
39
|
+
if (keys.shift || inOpenFence) {
|
|
40
|
+
return 'newline';
|
|
41
|
+
}
|
|
42
|
+
if (list !== null) {
|
|
43
|
+
// A caret in front of the marker moves the item down rather than splitting its marker.
|
|
44
|
+
if (column < list.prefix.length) {
|
|
45
|
+
return 'newline';
|
|
40
46
|
}
|
|
41
|
-
return
|
|
47
|
+
return list.empty ? 'leave-list' : 'continue-list';
|
|
48
|
+
}
|
|
49
|
+
if (keys.alt) {
|
|
50
|
+
return 'send-alternate';
|
|
51
|
+
}
|
|
52
|
+
return modOnly ? 'newline' : 'send';
|
|
42
53
|
}
|
|
43
54
|
/* The innermost fenced code block around `pos`, if any. */
|
|
44
55
|
function enclosingFence(tree, pos) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
56
|
+
for (let node = tree.resolveInner(pos, -1); node !== null; node = node.parent) {
|
|
57
|
+
if (node.name === 'FencedCode') {
|
|
58
|
+
return node;
|
|
49
59
|
}
|
|
50
|
-
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
51
62
|
}
|
|
52
63
|
/* A fence nobody has closed yet has its opening mark only. */
|
|
53
64
|
function isOpenFence(fence) {
|
|
54
|
-
|
|
65
|
+
return fence.getChildren('CodeMark').length < 2;
|
|
55
66
|
}
|
|
56
67
|
/* Whether `pos` sits inside a fenced code block that has an opening fence and no closing one yet. */
|
|
57
68
|
export function inOpenFence(tree, pos) {
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
const fence = enclosingFence(tree, pos);
|
|
70
|
+
return fence !== null && pos > fence.from && isOpenFence(fence);
|
|
60
71
|
}
|
|
61
72
|
/* Whether `pos` sits in the body of a fenced code block, open or closed: below its opening line and before its end. */
|
|
62
73
|
export function inFenceBody(tree, text, pos) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
const fence = enclosingFence(tree, pos);
|
|
75
|
+
if (fence === null) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const openingEnd = text.indexOf('\n', fence.from);
|
|
79
|
+
return openingEnd !== -1 && pos > openingEnd && (pos < fence.to || isOpenFence(fence));
|
|
69
80
|
}
|
|
70
81
|
/* The spaces Tab inserts at `column`, up to the next stop of four, the way a code editor lines up. */
|
|
71
82
|
export function tabSpaces(column) {
|
|
72
|
-
|
|
83
|
+
return ' '.repeat(4 - column % 4);
|
|
73
84
|
}
|
|
74
85
|
const INLINE_BLOCK = /^(Paragraph|ATXHeading\d|SetextHeading\d)$/;
|
|
75
86
|
/*
|
|
@@ -78,41 +89,47 @@ const INLINE_BLOCK = /^(Paragraph|ATXHeading\d|SetextHeading\d)$/;
|
|
|
78
89
|
* counts as well: whoever types after it is writing code.
|
|
79
90
|
*/
|
|
80
91
|
export function inCode(tree, text, pos) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
if (blockFrom === null && INLINE_BLOCK.test(node.name)) {
|
|
90
|
-
blockFrom = node.from;
|
|
91
|
-
}
|
|
92
|
+
let blockFrom = null;
|
|
93
|
+
for (let node = tree.resolveInner(pos, -1); node !== null; node = node.parent) {
|
|
94
|
+
if (node.name === 'FencedCode') {
|
|
95
|
+
return pos > node.from && (pos < node.to || isOpenFence(node));
|
|
96
|
+
}
|
|
97
|
+
if (node.name === 'InlineCode' && pos > node.from && pos < node.to) {
|
|
98
|
+
return true;
|
|
92
99
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
if (blockFrom === null && INLINE_BLOCK.test(node.name)) {
|
|
101
|
+
blockFrom = node.from;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
let from = blockFrom ?? text.lastIndexOf('\n', pos - 1) + 1;
|
|
105
|
+
tree.iterate({
|
|
106
|
+
from,
|
|
107
|
+
to: pos,
|
|
108
|
+
enter: node => {
|
|
109
|
+
if (node.name === 'InlineCode' && node.to <= pos) {
|
|
110
|
+
from = Math.max(from, node.to);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return /(^|[^\\])`/.test(text.slice(from, pos));
|
|
104
115
|
}
|
|
105
116
|
/*
|
|
106
117
|
* Which way the arrow walks through earlier prompts, or null when the arrow just moves the caret.
|
|
107
118
|
* Only an empty box or an unedited recall walks, so an arrow in a prompt being written never
|
|
108
119
|
* throws it away.
|
|
109
120
|
*/
|
|
110
|
-
export function recallDirection({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
export function recallDirection({
|
|
122
|
+
key,
|
|
123
|
+
text,
|
|
124
|
+
from,
|
|
125
|
+
to,
|
|
126
|
+
recalled
|
|
127
|
+
}) {
|
|
128
|
+
if (key === 'ArrowUp' && (text === '' || recalled && from === 0)) {
|
|
129
|
+
return -1;
|
|
130
|
+
}
|
|
131
|
+
if (key === 'ArrowDown' && recalled && to === text.length) {
|
|
132
|
+
return 1;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
/* The index that still points at an option once the list has shrunk under a stale one. */
|
|
2
2
|
export function clampMenuIndex(index, count) {
|
|
3
|
-
|
|
3
|
+
return Math.min(index, Math.max(count - 1, 0));
|
|
4
4
|
}
|
|
5
5
|
export function optionIdOf(listId, index) {
|
|
6
|
-
|
|
6
|
+
return `${listId}-${index}`;
|
|
7
7
|
}
|
|
8
8
|
/*
|
|
9
9
|
* The attributes the editor's content element takes while a suggestion menu stands beside it. The
|
|
10
10
|
* element keeps its `textbox` role; ARIA 1.2 lets it name the option the arrow keys are on.
|
|
11
11
|
*/
|
|
12
|
-
export function composerMenuAria({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
12
|
+
export function composerMenuAria({
|
|
13
|
+
label,
|
|
14
|
+
listId,
|
|
15
|
+
open,
|
|
16
|
+
activeIndex,
|
|
17
|
+
count
|
|
18
|
+
}) {
|
|
19
|
+
return {
|
|
20
|
+
'aria-label': label,
|
|
21
|
+
'aria-autocomplete': 'list',
|
|
22
|
+
...(open && count > 0 ? {
|
|
23
|
+
'aria-controls': listId,
|
|
24
|
+
'aria-activedescendant': optionIdOf(listId, activeIndex)
|
|
25
|
+
} : {})
|
|
26
|
+
};
|
|
27
|
+
}
|