@codingame/monaco-vscode-katex-common 25.1.2 → 26.0.1
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/package.json +2 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.d.ts +23 -2
- package/vscode/src/vs/platform/actionWidget/browser/actionWidgetDropdown.js +64 -27
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.d.ts +3 -1
- package/vscode/src/vs/platform/actions/browser/actionWidgetDropdownActionViewItem.js +31 -28
- package/vscode/src/vs/platform/actions/browser/buttonbar.d.ts +2 -0
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +71 -50
- package/vscode/src/vs/platform/editor/browser/editor.js +17 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +112 -129
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +110 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.d.ts +21 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +308 -216
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +153 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +247 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +347 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +287 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +89 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +677 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentSessionHoverWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +263 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel.js +34 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.d.ts +19 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +762 -359
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.d.ts +22 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatImplicitContext.js +188 -99
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.d.ts +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +166 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.d.ts +12 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +279 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +382 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.d.ts +24 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +128 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +153 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +1218 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/media/chatSessionPickerActionItem.css +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.js +93 -89
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +42 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +58 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +18 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +132 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +68 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +14 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleContentPart.js +36 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollapsibleMarkdownContentPart.js +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCollections.js +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +22 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +34 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +198 -135
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +38 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDiffBlockPart.js +29 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.js +41 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.js +23 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorContentPart.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +20 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +291 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +227 -162
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.js +68 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +76 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.d.ts +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +96 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +74 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatPullRequestContentPart.js +11 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +107 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +814 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +34 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.d.ts +8 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +236 -197
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.d.ts +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +492 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +75 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTaskContentPart.js +31 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +42 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +55 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +714 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +143 -153
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.d.ts +14 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +79 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.d.ts +10 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolOutputContentSubPart.js +209 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.d.ts +9 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +71 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +248 -190
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatConfirmationWidget.css +1 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatPullRequestContent.css +5 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatQuestionCarousel.css +493 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentContent.css +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTerminalToolProgressPart.css +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +121 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatTipContent.css +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +51 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +46 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatInputOutputMarkdownProgressPart.js +99 -67
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.d.ts +112 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +634 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +132 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatResultListSubPart.js +15 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +196 -149
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +577 -193
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +119 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +165 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationSubPart.js +5 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +75 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +30 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.d.ts +1 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +102 -106
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolProgressPart.js +44 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolStreamingSubPart.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/terminalToolAutoExpand.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +122 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +39 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +1110 -597
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.d.ts +291 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +485 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatOptions.js +38 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +9 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +650 -689
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +21 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +102 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +1253 -790
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPartWidgets.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPickerActionItem.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatSelectedTools.js +51 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.d.ts +16 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +192 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.d.ts +11 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem.js +99 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +188 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +129 -167
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chatViewWelcome.css +16 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +143 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +206 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageDetails.css +152 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatContextUsageWidget.css +67 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/annotations.js +170 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +80 -19
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatWidgetHistoryService.js +20 -28
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +22 -19
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.js +122 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.d.ts +19 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +316 -1040
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditorAffordance.js +162 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatGutterAffordance.js +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +416 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.d.ts +1 -6
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +194 -215
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +74 -104
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +45 -91
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatEditorAffordance.css +22 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatOverlayWidget.css +98 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +96 -68
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveCommon.js +11 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +150 -0
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +141 -147
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpToolCallUI.js +200 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.d.ts +548 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocolApps.js +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +338 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +364 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/interactiveEditor.css +21 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/media/interactive.css +36 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.d.ts +110 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +692 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +158 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.d.ts +80 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.js +440 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.d.ts +0 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatInputRelatedFilesContrib.js +0 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +0 -1081
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.d.ts +0 -199
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +0 -482
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +0 -37
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +0 -94
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -495
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +0 -454
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +0 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +0 -372
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -594
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1746
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -269
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -806
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -62
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -295
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -241
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -146
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -90
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -823
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -29
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -567
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -189
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -439
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +0 -263
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +0 -48
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -89
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +0 -33
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -108
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
|
|
2
|
+
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
+
import { $, addDisposableListener, EventType, clearNode, runAtThisOrScheduleAtNextAnimationFrame, getWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
5
|
+
import { getBaseLayerHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegate2';
|
|
6
|
+
import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
7
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
9
|
+
import { Disposable, DisposableStore, MutableDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
11
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
12
|
+
import { defaultButtonStyles, defaultInputBoxStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
13
|
+
import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
14
|
+
import { InputBox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
15
|
+
import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
|
|
16
|
+
import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
|
|
17
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
18
|
+
import * as chatQuestionCarousel from './media/chatQuestionCarousel.css';
|
|
19
|
+
|
|
20
|
+
registerCss(chatQuestionCarousel);
|
|
21
|
+
class ChatQuestionCarouselPart extends Disposable {
|
|
22
|
+
constructor(carousel, context, _options) {
|
|
23
|
+
super();
|
|
24
|
+
this.carousel = carousel;
|
|
25
|
+
this._options = _options;
|
|
26
|
+
this._onDidChangeHeight = this._register(( new Emitter()));
|
|
27
|
+
this.onDidChangeHeight = this._onDidChangeHeight.event;
|
|
28
|
+
this._currentIndex = 0;
|
|
29
|
+
this._answers = ( new Map());
|
|
30
|
+
this._isSkipped = false;
|
|
31
|
+
this._textInputBoxes = ( new Map());
|
|
32
|
+
this._singleSelectItems = ( new Map());
|
|
33
|
+
this._multiSelectCheckboxes = ( new Map());
|
|
34
|
+
this._freeformTextareas = ( new Map());
|
|
35
|
+
this._inputBoxes = this._register(( new DisposableStore()));
|
|
36
|
+
this._interactiveUIStore = this._register(( new MutableDisposable()));
|
|
37
|
+
this.domNode = $(".chat-question-carousel-container");
|
|
38
|
+
if (carousel.data) {
|
|
39
|
+
for (const [key, value] of Object.entries(carousel.data)) {
|
|
40
|
+
this._answers.set(key, value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const responseIsComplete = isResponseVM(context.element) && context.element.isComplete;
|
|
44
|
+
if (carousel.isUsed || responseIsComplete) {
|
|
45
|
+
this._isSkipped = true;
|
|
46
|
+
this.domNode.classList.add("chat-question-carousel-used");
|
|
47
|
+
this.renderSummary();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const interactiveStore = ( new DisposableStore());
|
|
51
|
+
this._interactiveUIStore.value = interactiveStore;
|
|
52
|
+
this._questionContainer = $(".chat-question-carousel-content");
|
|
53
|
+
this.domNode.append(this._questionContainer);
|
|
54
|
+
if (carousel.allowSkip) {
|
|
55
|
+
this._closeButtonContainer = $(".chat-question-close-container");
|
|
56
|
+
const skipAllTitle = ( localize(5873, "Skip all questions"));
|
|
57
|
+
const skipAllButton = interactiveStore.add(( new Button(this._closeButtonContainer, {
|
|
58
|
+
...defaultButtonStyles,
|
|
59
|
+
secondary: true,
|
|
60
|
+
supportIcons: true,
|
|
61
|
+
title: skipAllTitle
|
|
62
|
+
})));
|
|
63
|
+
skipAllButton.label = `$(${Codicon.close.id})`;
|
|
64
|
+
skipAllButton.element.classList.add("chat-question-nav-arrow", "chat-question-close");
|
|
65
|
+
skipAllButton.element.setAttribute("aria-label", skipAllTitle);
|
|
66
|
+
this._skipAllButton = skipAllButton;
|
|
67
|
+
}
|
|
68
|
+
this._footerRow = $(".chat-question-footer-row");
|
|
69
|
+
this._stepIndicator = $(".chat-question-step-indicator");
|
|
70
|
+
this._footerRow.appendChild(this._stepIndicator);
|
|
71
|
+
this._navigationButtons = $(".chat-question-carousel-nav");
|
|
72
|
+
this._navigationButtons.setAttribute("role", "navigation");
|
|
73
|
+
this._navigationButtons.setAttribute("aria-label", ( localize(5874, "Question navigation")));
|
|
74
|
+
const arrowsContainer = $(".chat-question-nav-arrows");
|
|
75
|
+
const previousLabel = ( localize(5875, "Previous"));
|
|
76
|
+
const prevButton = interactiveStore.add(( new Button(arrowsContainer, {
|
|
77
|
+
...defaultButtonStyles,
|
|
78
|
+
secondary: true,
|
|
79
|
+
supportIcons: true,
|
|
80
|
+
title: previousLabel
|
|
81
|
+
})));
|
|
82
|
+
prevButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-prev");
|
|
83
|
+
prevButton.label = `$(${Codicon.chevronLeft.id})`;
|
|
84
|
+
prevButton.element.setAttribute("aria-label", previousLabel);
|
|
85
|
+
this._prevButton = prevButton;
|
|
86
|
+
const nextLabel = ( localize(5876, "Next"));
|
|
87
|
+
const nextButton = interactiveStore.add(( new Button(arrowsContainer, {
|
|
88
|
+
...defaultButtonStyles,
|
|
89
|
+
secondary: true,
|
|
90
|
+
supportIcons: true,
|
|
91
|
+
title: nextLabel
|
|
92
|
+
})));
|
|
93
|
+
nextButton.element.classList.add("chat-question-nav-arrow", "chat-question-nav-next");
|
|
94
|
+
nextButton.label = `$(${Codicon.chevronRight.id})`;
|
|
95
|
+
this._nextButton = nextButton;
|
|
96
|
+
this._navigationButtons.appendChild(arrowsContainer);
|
|
97
|
+
this._footerRow.appendChild(this._navigationButtons);
|
|
98
|
+
this.domNode.append(this._footerRow);
|
|
99
|
+
interactiveStore.add(prevButton.onDidClick(() => this.navigate(-1)));
|
|
100
|
+
interactiveStore.add(nextButton.onDidClick(() => this.handleNext()));
|
|
101
|
+
if (this._skipAllButton) {
|
|
102
|
+
interactiveStore.add(this._skipAllButton.onDidClick(() => this.ignore()));
|
|
103
|
+
}
|
|
104
|
+
interactiveStore.add(addDisposableListener(this.domNode, EventType.KEY_DOWN, e => {
|
|
105
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
106
|
+
if (event.keyCode === KeyCode.Escape && this.carousel.allowSkip) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
this.ignore();
|
|
110
|
+
} else if (event.keyCode === KeyCode.Enter && !event.shiftKey) {
|
|
111
|
+
const target = e.target;
|
|
112
|
+
const isTextInput = target.tagName === "INPUT" && target.type === "text";
|
|
113
|
+
const isFreeformTextarea = target.tagName === "TEXTAREA" && target.classList.contains("chat-question-freeform-textarea");
|
|
114
|
+
if (isTextInput || isFreeformTextarea) {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
this.handleNext();
|
|
118
|
+
}
|
|
119
|
+
} else if ((event.ctrlKey || event.metaKey) && (event.keyCode === KeyCode.Backspace || event.keyCode === KeyCode.Delete)) {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
this.renderCurrentQuestion();
|
|
124
|
+
}
|
|
125
|
+
saveCurrentAnswer() {
|
|
126
|
+
const currentQuestion = this.carousel.questions[this._currentIndex];
|
|
127
|
+
const answer = this.getCurrentAnswer();
|
|
128
|
+
if (answer !== undefined) {
|
|
129
|
+
this._answers.set(currentQuestion.id, answer);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
navigate(delta) {
|
|
133
|
+
const newIndex = this._currentIndex + delta;
|
|
134
|
+
if (newIndex >= 0 && newIndex < this.carousel.questions.length) {
|
|
135
|
+
this.saveCurrentAnswer();
|
|
136
|
+
this._currentIndex = newIndex;
|
|
137
|
+
this.renderCurrentQuestion();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
handleNext() {
|
|
141
|
+
this.saveCurrentAnswer();
|
|
142
|
+
if (this._currentIndex < this.carousel.questions.length - 1) {
|
|
143
|
+
this._currentIndex++;
|
|
144
|
+
this.renderCurrentQuestion();
|
|
145
|
+
} else {
|
|
146
|
+
this._options.onSubmit(this._answers);
|
|
147
|
+
this.hideAndShowSummary();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
hideAndShowSummary() {
|
|
151
|
+
this._isSkipped = true;
|
|
152
|
+
this.domNode.classList.add("chat-question-carousel-used");
|
|
153
|
+
this.clearInteractiveResources();
|
|
154
|
+
clearNode(this.domNode);
|
|
155
|
+
this.renderSummary();
|
|
156
|
+
this._onDidChangeHeight.fire();
|
|
157
|
+
}
|
|
158
|
+
clearInteractiveResources() {
|
|
159
|
+
this._interactiveUIStore.clear();
|
|
160
|
+
this._inputBoxes.clear();
|
|
161
|
+
this._textInputBoxes.clear();
|
|
162
|
+
this._singleSelectItems.clear();
|
|
163
|
+
this._multiSelectCheckboxes.clear();
|
|
164
|
+
this._freeformTextareas.clear();
|
|
165
|
+
this._prevButton = undefined;
|
|
166
|
+
this._nextButton = undefined;
|
|
167
|
+
this._skipAllButton = undefined;
|
|
168
|
+
this._questionContainer = undefined;
|
|
169
|
+
this._navigationButtons = undefined;
|
|
170
|
+
this._closeButtonContainer = undefined;
|
|
171
|
+
this._footerRow = undefined;
|
|
172
|
+
this._stepIndicator = undefined;
|
|
173
|
+
}
|
|
174
|
+
skip() {
|
|
175
|
+
if (this._isSkipped || !this.carousel.allowSkip) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
const defaults = this.getDefaultAnswers();
|
|
179
|
+
this._options.onSubmit(defaults);
|
|
180
|
+
this._answers.clear();
|
|
181
|
+
for (const [key, value] of defaults) {
|
|
182
|
+
this._answers.set(key, value);
|
|
183
|
+
}
|
|
184
|
+
this.hideAndShowSummary();
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
ignore() {
|
|
188
|
+
if (this._isSkipped || !this.carousel.allowSkip) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
this._isSkipped = true;
|
|
192
|
+
this._options.onSubmit(undefined);
|
|
193
|
+
this.clearInteractiveResources();
|
|
194
|
+
this.domNode.classList.add("chat-question-carousel-used");
|
|
195
|
+
clearNode(this.domNode);
|
|
196
|
+
this.renderSkippedMessage();
|
|
197
|
+
this._onDidChangeHeight.fire();
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
getDefaultAnswers() {
|
|
201
|
+
const answers = ( new Map());
|
|
202
|
+
for (const question of this.carousel.questions) {
|
|
203
|
+
const defaultAnswer = this.getDefaultAnswerForQuestion(question);
|
|
204
|
+
if (defaultAnswer !== undefined) {
|
|
205
|
+
answers.set(question.id, defaultAnswer);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return answers;
|
|
209
|
+
}
|
|
210
|
+
getDefaultAnswerForQuestion(question) {
|
|
211
|
+
switch (question.type) {
|
|
212
|
+
case "text":
|
|
213
|
+
return question.defaultValue;
|
|
214
|
+
case "singleSelect":
|
|
215
|
+
{
|
|
216
|
+
const defaultOptionId = typeof question.defaultValue === "string" ? question.defaultValue : undefined;
|
|
217
|
+
const defaultOption = defaultOptionId !== undefined ? question.options?.find(opt => opt.id === defaultOptionId) : undefined;
|
|
218
|
+
const selectedValue = defaultOption?.value;
|
|
219
|
+
return selectedValue !== undefined ? {
|
|
220
|
+
selectedValue,
|
|
221
|
+
freeformValue: undefined
|
|
222
|
+
} : undefined;
|
|
223
|
+
}
|
|
224
|
+
case "multiSelect":
|
|
225
|
+
{
|
|
226
|
+
const defaultIds = Array.isArray(question.defaultValue) ? question.defaultValue : (typeof question.defaultValue === "string" ? [question.defaultValue] : []);
|
|
227
|
+
const selectedValues = question.options?.filter(opt => defaultIds.includes(opt.id)).map(opt => opt.value).filter(v => v !== undefined) ?? [];
|
|
228
|
+
return selectedValues.length > 0 ? {
|
|
229
|
+
selectedValues,
|
|
230
|
+
freeformValue: undefined
|
|
231
|
+
} : undefined;
|
|
232
|
+
}
|
|
233
|
+
default:
|
|
234
|
+
return question.defaultValue;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
renderCurrentQuestion() {
|
|
238
|
+
if (!this._questionContainer || !this._prevButton || !this._nextButton) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
this._inputBoxes.clear();
|
|
242
|
+
this._textInputBoxes.clear();
|
|
243
|
+
this._singleSelectItems.clear();
|
|
244
|
+
this._multiSelectCheckboxes.clear();
|
|
245
|
+
this._freeformTextareas.clear();
|
|
246
|
+
clearNode(this._questionContainer);
|
|
247
|
+
const question = this.carousel.questions[this._currentIndex];
|
|
248
|
+
if (!question) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const headerRow = $(".chat-question-header-row");
|
|
252
|
+
const questionText = question.message ?? question.title;
|
|
253
|
+
if (questionText) {
|
|
254
|
+
const title = $(".chat-question-title");
|
|
255
|
+
const messageContent = typeof questionText === "string" ? questionText : questionText.value;
|
|
256
|
+
title.setAttribute("aria-label", messageContent);
|
|
257
|
+
const parenMatch = messageContent.match(/^(.+?)\s*(\([^)]+\))\s*$/);
|
|
258
|
+
if (parenMatch) {
|
|
259
|
+
const mainTitle = $("span.chat-question-title-main");
|
|
260
|
+
mainTitle.textContent = parenMatch[1];
|
|
261
|
+
title.appendChild(mainTitle);
|
|
262
|
+
const subtitle = $("span.chat-question-title-subtitle");
|
|
263
|
+
subtitle.textContent = " " + parenMatch[2];
|
|
264
|
+
title.appendChild(subtitle);
|
|
265
|
+
} else {
|
|
266
|
+
title.textContent = messageContent;
|
|
267
|
+
}
|
|
268
|
+
headerRow.appendChild(title);
|
|
269
|
+
}
|
|
270
|
+
if (this._closeButtonContainer) {
|
|
271
|
+
headerRow.appendChild(this._closeButtonContainer);
|
|
272
|
+
}
|
|
273
|
+
this._questionContainer.appendChild(headerRow);
|
|
274
|
+
const isSingleQuestion = this.carousel.questions.length === 1;
|
|
275
|
+
if (this._stepIndicator) {
|
|
276
|
+
this._stepIndicator.textContent = `${this._currentIndex + 1}/${this.carousel.questions.length}`;
|
|
277
|
+
this._stepIndicator.style.display = isSingleQuestion ? "none" : "";
|
|
278
|
+
}
|
|
279
|
+
const inputContainer = $(".chat-question-input-container");
|
|
280
|
+
this.renderInput(inputContainer, question);
|
|
281
|
+
this._questionContainer.appendChild(inputContainer);
|
|
282
|
+
this._prevButton.enabled = this._currentIndex > 0;
|
|
283
|
+
this._prevButton.element.style.display = isSingleQuestion ? "none" : "";
|
|
284
|
+
const isLastQuestion = this._currentIndex === this.carousel.questions.length - 1;
|
|
285
|
+
const submitLabel = ( localize(5877, "Submit"));
|
|
286
|
+
const nextLabel = ( localize(5876, "Next"));
|
|
287
|
+
if (isLastQuestion) {
|
|
288
|
+
this._nextButton.label = submitLabel;
|
|
289
|
+
this._nextButton.element.title = submitLabel;
|
|
290
|
+
this._nextButton.element.setAttribute("aria-label", submitLabel);
|
|
291
|
+
this._nextButton.element.classList.add("chat-question-nav-submit");
|
|
292
|
+
} else {
|
|
293
|
+
this._nextButton.label = `$(${Codicon.chevronRight.id})`;
|
|
294
|
+
this._nextButton.element.title = nextLabel;
|
|
295
|
+
this._nextButton.element.setAttribute("aria-label", nextLabel);
|
|
296
|
+
this._nextButton.element.classList.remove("chat-question-nav-submit");
|
|
297
|
+
}
|
|
298
|
+
this._onDidChangeHeight.fire();
|
|
299
|
+
}
|
|
300
|
+
renderInput(container, question) {
|
|
301
|
+
switch (question.type) {
|
|
302
|
+
case "text":
|
|
303
|
+
this.renderTextInput(container, question);
|
|
304
|
+
break;
|
|
305
|
+
case "singleSelect":
|
|
306
|
+
this.renderSingleSelect(container, question);
|
|
307
|
+
break;
|
|
308
|
+
case "multiSelect":
|
|
309
|
+
this.renderMultiSelect(container, question);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
setupTextareaAutoResize(textarea) {
|
|
314
|
+
const autoResize = () => {
|
|
315
|
+
textarea.style.height = "auto";
|
|
316
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
|
|
317
|
+
this._onDidChangeHeight.fire();
|
|
318
|
+
};
|
|
319
|
+
this._inputBoxes.add(addDisposableListener(textarea, EventType.INPUT, autoResize));
|
|
320
|
+
return autoResize;
|
|
321
|
+
}
|
|
322
|
+
renderTextInput(container, question) {
|
|
323
|
+
const inputBox = this._inputBoxes.add(( new InputBox(container, undefined, {
|
|
324
|
+
placeholder: ( localize(5878, "Enter your answer")),
|
|
325
|
+
inputBoxStyles: defaultInputBoxStyles
|
|
326
|
+
})));
|
|
327
|
+
const previousAnswer = this._answers.get(question.id);
|
|
328
|
+
if (previousAnswer !== undefined) {
|
|
329
|
+
inputBox.value = String(previousAnswer);
|
|
330
|
+
} else if (question.defaultValue !== undefined) {
|
|
331
|
+
inputBox.value = String(question.defaultValue);
|
|
332
|
+
}
|
|
333
|
+
this._textInputBoxes.set(question.id, inputBox);
|
|
334
|
+
if (this._options.shouldAutoFocus !== false) {
|
|
335
|
+
this._inputBoxes.add(
|
|
336
|
+
runAtThisOrScheduleAtNextAnimationFrame(getWindow(inputBox.element), () => inputBox.focus())
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
renderSingleSelect(container, question) {
|
|
341
|
+
const options = question.options || [];
|
|
342
|
+
const selectContainer = $(".chat-question-list");
|
|
343
|
+
selectContainer.setAttribute("role", "listbox");
|
|
344
|
+
selectContainer.setAttribute("aria-label", question.title);
|
|
345
|
+
selectContainer.tabIndex = 0;
|
|
346
|
+
container.appendChild(selectContainer);
|
|
347
|
+
const previousAnswer = this._answers.get(question.id);
|
|
348
|
+
const previousFreeform = typeof previousAnswer === "object" && previousAnswer !== null && hasKey(previousAnswer, {
|
|
349
|
+
freeformValue: true
|
|
350
|
+
}) ? previousAnswer.freeformValue : undefined;
|
|
351
|
+
const previousSelectedValue = typeof previousAnswer === "object" && previousAnswer !== null && hasKey(previousAnswer, {
|
|
352
|
+
selectedValue: true
|
|
353
|
+
}) ? previousAnswer.selectedValue : previousAnswer;
|
|
354
|
+
const defaultOptionId = typeof question.defaultValue === "string" ? question.defaultValue : undefined;
|
|
355
|
+
let selectedIndex = -1;
|
|
356
|
+
options.forEach((option, index) => {
|
|
357
|
+
if (previousSelectedValue !== undefined && option.value === previousSelectedValue) {
|
|
358
|
+
selectedIndex = index;
|
|
359
|
+
} else if (selectedIndex === -1 && defaultOptionId !== undefined && option.id === defaultOptionId) {
|
|
360
|
+
selectedIndex = index;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
const listItems = [];
|
|
364
|
+
const indicators = [];
|
|
365
|
+
const updateSelection = newIndex => {
|
|
366
|
+
listItems.forEach((item, i) => {
|
|
367
|
+
const isSelected = i === newIndex;
|
|
368
|
+
item.classList.toggle("selected", isSelected);
|
|
369
|
+
item.setAttribute("aria-selected", String(isSelected));
|
|
370
|
+
const indicator = indicators[i];
|
|
371
|
+
indicator.classList.toggle("codicon", isSelected);
|
|
372
|
+
indicator.classList.toggle("codicon-check", isSelected);
|
|
373
|
+
});
|
|
374
|
+
if (newIndex >= 0 && newIndex < listItems.length) {
|
|
375
|
+
selectContainer.setAttribute("aria-activedescendant", listItems[newIndex].id);
|
|
376
|
+
}
|
|
377
|
+
const data = this._singleSelectItems.get(question.id);
|
|
378
|
+
if (data) {
|
|
379
|
+
data.selectedIndex = newIndex;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
options.forEach((option, index) => {
|
|
383
|
+
const isSelected = index === selectedIndex;
|
|
384
|
+
const listItem = $(".chat-question-list-item");
|
|
385
|
+
listItem.setAttribute("role", "option");
|
|
386
|
+
listItem.setAttribute("aria-selected", String(isSelected));
|
|
387
|
+
listItem.setAttribute("aria-label", ( localize(5879, "Option {0}: {1}", index + 1, option.label)));
|
|
388
|
+
listItem.id = `option-${question.id}-${index}`;
|
|
389
|
+
listItem.tabIndex = -1;
|
|
390
|
+
const number = $(".chat-question-list-number");
|
|
391
|
+
number.textContent = `${index + 1}`;
|
|
392
|
+
listItem.appendChild(number);
|
|
393
|
+
const indicator = $(".chat-question-list-indicator");
|
|
394
|
+
if (isSelected) {
|
|
395
|
+
indicator.classList.add("codicon", "codicon-check");
|
|
396
|
+
}
|
|
397
|
+
indicators.push(indicator);
|
|
398
|
+
const label = $(".chat-question-list-label");
|
|
399
|
+
const separatorIndex = option.label.indexOf(" - ");
|
|
400
|
+
if (separatorIndex !== -1) {
|
|
401
|
+
const titleSpan = $("span.chat-question-list-label-title");
|
|
402
|
+
titleSpan.textContent = option.label.substring(0, separatorIndex);
|
|
403
|
+
label.appendChild(titleSpan);
|
|
404
|
+
const descSpan = $("span.chat-question-list-label-desc");
|
|
405
|
+
descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
|
|
406
|
+
label.appendChild(descSpan);
|
|
407
|
+
} else {
|
|
408
|
+
label.textContent = option.label;
|
|
409
|
+
}
|
|
410
|
+
listItem.appendChild(label);
|
|
411
|
+
listItem.appendChild(indicator);
|
|
412
|
+
if (isSelected) {
|
|
413
|
+
listItem.classList.add("selected");
|
|
414
|
+
}
|
|
415
|
+
this._inputBoxes.add(
|
|
416
|
+
getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate("mouse"), listItem, option.label)
|
|
417
|
+
);
|
|
418
|
+
this._inputBoxes.add(addDisposableListener(listItem, EventType.CLICK, e => {
|
|
419
|
+
e.preventDefault();
|
|
420
|
+
e.stopPropagation();
|
|
421
|
+
updateSelection(index);
|
|
422
|
+
}));
|
|
423
|
+
selectContainer.appendChild(listItem);
|
|
424
|
+
listItems.push(listItem);
|
|
425
|
+
});
|
|
426
|
+
this._singleSelectItems.set(question.id, {
|
|
427
|
+
items: listItems,
|
|
428
|
+
selectedIndex
|
|
429
|
+
});
|
|
430
|
+
if (selectedIndex >= 0 && selectedIndex < listItems.length) {
|
|
431
|
+
selectContainer.setAttribute("aria-activedescendant", listItems[selectedIndex].id);
|
|
432
|
+
}
|
|
433
|
+
const freeformContainer = $(".chat-question-freeform");
|
|
434
|
+
const freeformNumber = $(".chat-question-freeform-number");
|
|
435
|
+
freeformNumber.textContent = `${options.length + 1}`;
|
|
436
|
+
freeformContainer.appendChild(freeformNumber);
|
|
437
|
+
const freeformTextarea = $("textarea.chat-question-freeform-textarea");
|
|
438
|
+
freeformTextarea.placeholder = ( localize(5880, "Enter custom answer"));
|
|
439
|
+
freeformTextarea.rows = 1;
|
|
440
|
+
if (previousFreeform !== undefined) {
|
|
441
|
+
freeformTextarea.value = previousFreeform;
|
|
442
|
+
}
|
|
443
|
+
const autoResize = this.setupTextareaAutoResize(freeformTextarea);
|
|
444
|
+
this._inputBoxes.add(addDisposableListener(freeformTextarea, EventType.INPUT, () => {
|
|
445
|
+
if (freeformTextarea.value.length > 0) {
|
|
446
|
+
updateSelection(-1);
|
|
447
|
+
}
|
|
448
|
+
}));
|
|
449
|
+
freeformContainer.appendChild(freeformTextarea);
|
|
450
|
+
container.appendChild(freeformContainer);
|
|
451
|
+
this._freeformTextareas.set(question.id, freeformTextarea);
|
|
452
|
+
this._inputBoxes.add(addDisposableListener(selectContainer, EventType.KEY_DOWN, e => {
|
|
453
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
454
|
+
const data = this._singleSelectItems.get(question.id);
|
|
455
|
+
if (!data || !listItems.length) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
let newIndex = data.selectedIndex;
|
|
459
|
+
if (event.keyCode === KeyCode.DownArrow) {
|
|
460
|
+
e.preventDefault();
|
|
461
|
+
newIndex = Math.min(data.selectedIndex + 1, listItems.length - 1);
|
|
462
|
+
} else if (event.keyCode === KeyCode.UpArrow) {
|
|
463
|
+
e.preventDefault();
|
|
464
|
+
newIndex = Math.max(data.selectedIndex - 1, 0);
|
|
465
|
+
} else if (event.keyCode === KeyCode.Enter || event.keyCode === KeyCode.Space) {
|
|
466
|
+
e.preventDefault();
|
|
467
|
+
e.stopPropagation();
|
|
468
|
+
this.handleNext();
|
|
469
|
+
return;
|
|
470
|
+
} else if (event.keyCode >= KeyCode.Digit1 && event.keyCode <= KeyCode.Digit9) {
|
|
471
|
+
const numberIndex = event.keyCode - KeyCode.Digit1;
|
|
472
|
+
if (numberIndex < listItems.length) {
|
|
473
|
+
e.preventDefault();
|
|
474
|
+
updateSelection(numberIndex);
|
|
475
|
+
} else if (numberIndex === listItems.length) {
|
|
476
|
+
e.preventDefault();
|
|
477
|
+
updateSelection(-1);
|
|
478
|
+
freeformTextarea.focus();
|
|
479
|
+
}
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (newIndex !== data.selectedIndex && newIndex >= 0) {
|
|
483
|
+
updateSelection(newIndex);
|
|
484
|
+
}
|
|
485
|
+
}));
|
|
486
|
+
if (previousFreeform !== undefined) {
|
|
487
|
+
this._inputBoxes.add(
|
|
488
|
+
runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => autoResize())
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
if (this._options.shouldAutoFocus !== false && listItems.length > 0) {
|
|
492
|
+
const focusIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
|
493
|
+
if (selectedIndex < 0) {
|
|
494
|
+
updateSelection(0);
|
|
495
|
+
}
|
|
496
|
+
this._inputBoxes.add(
|
|
497
|
+
runAtThisOrScheduleAtNextAnimationFrame(getWindow(selectContainer), () => {
|
|
498
|
+
listItems[focusIndex]?.focus();
|
|
499
|
+
})
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
renderMultiSelect(container, question) {
|
|
504
|
+
const options = question.options || [];
|
|
505
|
+
const selectContainer = $(".chat-question-list");
|
|
506
|
+
selectContainer.setAttribute("role", "listbox");
|
|
507
|
+
selectContainer.setAttribute("aria-multiselectable", "true");
|
|
508
|
+
selectContainer.setAttribute("aria-label", question.title);
|
|
509
|
+
selectContainer.tabIndex = 0;
|
|
510
|
+
container.appendChild(selectContainer);
|
|
511
|
+
const previousAnswer = this._answers.get(question.id);
|
|
512
|
+
const previousFreeform = typeof previousAnswer === "object" && previousAnswer !== null && hasKey(previousAnswer, {
|
|
513
|
+
freeformValue: true
|
|
514
|
+
}) ? previousAnswer.freeformValue : undefined;
|
|
515
|
+
const previousSelectedValues = typeof previousAnswer === "object" && previousAnswer !== null && hasKey(previousAnswer, {
|
|
516
|
+
selectedValues: true
|
|
517
|
+
}) ? previousAnswer.selectedValues : (Array.isArray(previousAnswer) ? previousAnswer : []);
|
|
518
|
+
const defaultOptionIds = Array.isArray(question.defaultValue) ? question.defaultValue : (typeof question.defaultValue === "string" ? [question.defaultValue] : []);
|
|
519
|
+
const checkboxes = [];
|
|
520
|
+
const listItems = [];
|
|
521
|
+
let focusedIndex = 0;
|
|
522
|
+
let firstCheckedIndex = -1;
|
|
523
|
+
options.forEach((option, index) => {
|
|
524
|
+
let isChecked = false;
|
|
525
|
+
if (previousSelectedValues && previousSelectedValues.length > 0) {
|
|
526
|
+
isChecked = previousSelectedValues.includes(option.value);
|
|
527
|
+
} else if (defaultOptionIds.includes(option.id)) {
|
|
528
|
+
isChecked = true;
|
|
529
|
+
}
|
|
530
|
+
const listItem = $(".chat-question-list-item.multi-select");
|
|
531
|
+
listItem.setAttribute("role", "option");
|
|
532
|
+
listItem.setAttribute("aria-selected", String(isChecked));
|
|
533
|
+
listItem.setAttribute("aria-label", ( localize(5879, "Option {0}: {1}", index + 1, option.label)));
|
|
534
|
+
listItem.id = `option-${question.id}-${index}`;
|
|
535
|
+
listItem.tabIndex = -1;
|
|
536
|
+
const number = $(".chat-question-list-number");
|
|
537
|
+
number.textContent = `${index + 1}`;
|
|
538
|
+
listItem.appendChild(number);
|
|
539
|
+
const checkbox = this._inputBoxes.add(( new Checkbox(option.label, isChecked, defaultCheckboxStyles)));
|
|
540
|
+
checkbox.domNode.classList.add("chat-question-list-checkbox");
|
|
541
|
+
checkbox.domNode.tabIndex = -1;
|
|
542
|
+
listItem.appendChild(checkbox.domNode);
|
|
543
|
+
const label = $(".chat-question-list-label");
|
|
544
|
+
const separatorIndex = option.label.indexOf(" - ");
|
|
545
|
+
if (separatorIndex !== -1) {
|
|
546
|
+
const titleSpan = $("span.chat-question-list-label-title");
|
|
547
|
+
titleSpan.textContent = option.label.substring(0, separatorIndex);
|
|
548
|
+
label.appendChild(titleSpan);
|
|
549
|
+
const descSpan = $("span.chat-question-list-label-desc");
|
|
550
|
+
descSpan.textContent = ": " + option.label.substring(separatorIndex + 3);
|
|
551
|
+
label.appendChild(descSpan);
|
|
552
|
+
} else {
|
|
553
|
+
label.textContent = option.label;
|
|
554
|
+
}
|
|
555
|
+
listItem.appendChild(label);
|
|
556
|
+
if (isChecked) {
|
|
557
|
+
listItem.classList.add("checked");
|
|
558
|
+
if (firstCheckedIndex === -1) {
|
|
559
|
+
firstCheckedIndex = index;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
this._inputBoxes.add(checkbox.onChange(() => {
|
|
563
|
+
listItem.classList.toggle("checked", checkbox.checked);
|
|
564
|
+
listItem.setAttribute("aria-selected", String(checkbox.checked));
|
|
565
|
+
}));
|
|
566
|
+
this._inputBoxes.add(addDisposableListener(listItem, EventType.CLICK, e => {
|
|
567
|
+
focusedIndex = index;
|
|
568
|
+
if (e.target !== checkbox.domNode && !checkbox.domNode.contains(e.target)) {
|
|
569
|
+
checkbox.domNode.click();
|
|
570
|
+
}
|
|
571
|
+
}));
|
|
572
|
+
this._inputBoxes.add(
|
|
573
|
+
getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate("mouse"), listItem, option.label)
|
|
574
|
+
);
|
|
575
|
+
selectContainer.appendChild(listItem);
|
|
576
|
+
checkboxes.push(checkbox);
|
|
577
|
+
listItems.push(listItem);
|
|
578
|
+
});
|
|
579
|
+
this._multiSelectCheckboxes.set(question.id, checkboxes);
|
|
580
|
+
const freeformContainer = $(".chat-question-freeform");
|
|
581
|
+
const freeformNumber = $(".chat-question-freeform-number");
|
|
582
|
+
freeformNumber.textContent = `${options.length + 1}`;
|
|
583
|
+
freeformContainer.appendChild(freeformNumber);
|
|
584
|
+
const freeformTextarea = $("textarea.chat-question-freeform-textarea");
|
|
585
|
+
freeformTextarea.placeholder = ( localize(5880, "Enter custom answer"));
|
|
586
|
+
freeformTextarea.rows = 1;
|
|
587
|
+
if (previousFreeform !== undefined) {
|
|
588
|
+
freeformTextarea.value = previousFreeform;
|
|
589
|
+
}
|
|
590
|
+
const autoResize = this.setupTextareaAutoResize(freeformTextarea);
|
|
591
|
+
freeformContainer.appendChild(freeformTextarea);
|
|
592
|
+
container.appendChild(freeformContainer);
|
|
593
|
+
this._freeformTextareas.set(question.id, freeformTextarea);
|
|
594
|
+
this._inputBoxes.add(addDisposableListener(selectContainer, EventType.KEY_DOWN, e => {
|
|
595
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
596
|
+
if (!listItems.length) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
if (event.keyCode === KeyCode.DownArrow) {
|
|
600
|
+
e.preventDefault();
|
|
601
|
+
focusedIndex = Math.min(focusedIndex + 1, listItems.length - 1);
|
|
602
|
+
listItems[focusedIndex].focus();
|
|
603
|
+
} else if (event.keyCode === KeyCode.UpArrow) {
|
|
604
|
+
e.preventDefault();
|
|
605
|
+
focusedIndex = Math.max(focusedIndex - 1, 0);
|
|
606
|
+
listItems[focusedIndex].focus();
|
|
607
|
+
} else if (event.keyCode === KeyCode.Enter) {
|
|
608
|
+
e.preventDefault();
|
|
609
|
+
e.stopPropagation();
|
|
610
|
+
this.handleNext();
|
|
611
|
+
} else if (event.keyCode === KeyCode.Space) {
|
|
612
|
+
e.preventDefault();
|
|
613
|
+
if (focusedIndex >= 0 && focusedIndex < checkboxes.length) {
|
|
614
|
+
checkboxes[focusedIndex].domNode.click();
|
|
615
|
+
}
|
|
616
|
+
} else if (event.keyCode >= KeyCode.Digit1 && event.keyCode <= KeyCode.Digit9) {
|
|
617
|
+
const numberIndex = event.keyCode - KeyCode.Digit1;
|
|
618
|
+
if (numberIndex < checkboxes.length) {
|
|
619
|
+
e.preventDefault();
|
|
620
|
+
checkboxes[numberIndex].domNode.click();
|
|
621
|
+
} else if (numberIndex === checkboxes.length) {
|
|
622
|
+
e.preventDefault();
|
|
623
|
+
freeformTextarea.focus();
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}));
|
|
627
|
+
if (previousFreeform !== undefined) {
|
|
628
|
+
this._inputBoxes.add(
|
|
629
|
+
runAtThisOrScheduleAtNextAnimationFrame(getWindow(freeformTextarea), () => autoResize())
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
if (this._options.shouldAutoFocus !== false && listItems.length > 0) {
|
|
633
|
+
const initialFocusIndex = firstCheckedIndex >= 0 ? firstCheckedIndex : 0;
|
|
634
|
+
focusedIndex = initialFocusIndex;
|
|
635
|
+
this._inputBoxes.add(
|
|
636
|
+
runAtThisOrScheduleAtNextAnimationFrame(getWindow(selectContainer), () => {
|
|
637
|
+
listItems[initialFocusIndex]?.focus();
|
|
638
|
+
})
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
getCurrentAnswer() {
|
|
643
|
+
const question = this.carousel.questions[this._currentIndex];
|
|
644
|
+
if (!question) {
|
|
645
|
+
return undefined;
|
|
646
|
+
}
|
|
647
|
+
switch (question.type) {
|
|
648
|
+
case "text":
|
|
649
|
+
{
|
|
650
|
+
const inputBox = this._textInputBoxes.get(question.id);
|
|
651
|
+
return inputBox?.value ?? question.defaultValue;
|
|
652
|
+
}
|
|
653
|
+
case "singleSelect":
|
|
654
|
+
{
|
|
655
|
+
const data = this._singleSelectItems.get(question.id);
|
|
656
|
+
let selectedValue = undefined;
|
|
657
|
+
if (data && data.selectedIndex >= 0) {
|
|
658
|
+
selectedValue = question.options?.[data.selectedIndex]?.value;
|
|
659
|
+
}
|
|
660
|
+
if (selectedValue === undefined && typeof question.defaultValue === "string") {
|
|
661
|
+
const defaultOption = question.options?.find(opt => opt.id === question.defaultValue);
|
|
662
|
+
selectedValue = defaultOption?.value;
|
|
663
|
+
}
|
|
664
|
+
const freeformTextarea = this._freeformTextareas.get(question.id);
|
|
665
|
+
const freeformValue = freeformTextarea?.value !== "" ? freeformTextarea?.value : undefined;
|
|
666
|
+
if (freeformValue) {
|
|
667
|
+
return {
|
|
668
|
+
selectedValue: undefined,
|
|
669
|
+
freeformValue
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
if (selectedValue !== undefined) {
|
|
673
|
+
return {
|
|
674
|
+
selectedValue,
|
|
675
|
+
freeformValue: undefined
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
return undefined;
|
|
679
|
+
}
|
|
680
|
+
case "multiSelect":
|
|
681
|
+
{
|
|
682
|
+
const checkboxes = this._multiSelectCheckboxes.get(question.id);
|
|
683
|
+
const selectedValues = [];
|
|
684
|
+
if (checkboxes) {
|
|
685
|
+
checkboxes.forEach((checkbox, index) => {
|
|
686
|
+
if (checkbox.checked) {
|
|
687
|
+
const value = question.options?.[index]?.value;
|
|
688
|
+
if (value !== undefined) {
|
|
689
|
+
selectedValues.push(value);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
const freeformTextarea = this._freeformTextareas.get(question.id);
|
|
695
|
+
const freeformValue = freeformTextarea?.value !== "" ? freeformTextarea?.value : undefined;
|
|
696
|
+
let finalSelectedValues = selectedValues;
|
|
697
|
+
if (selectedValues.length === 0 && !freeformValue && question.defaultValue !== undefined) {
|
|
698
|
+
const defaultIds = Array.isArray(question.defaultValue) ? question.defaultValue : [question.defaultValue];
|
|
699
|
+
const defaultValues = question.options?.filter(opt => defaultIds.includes(opt.id)).map(opt => opt.value);
|
|
700
|
+
finalSelectedValues = defaultValues?.filter(v => v !== undefined) || [];
|
|
701
|
+
}
|
|
702
|
+
if (freeformValue || finalSelectedValues.length > 0) {
|
|
703
|
+
return {
|
|
704
|
+
selectedValues: finalSelectedValues,
|
|
705
|
+
freeformValue
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
return undefined;
|
|
709
|
+
}
|
|
710
|
+
default:
|
|
711
|
+
return question.defaultValue;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
renderSkippedMessage() {
|
|
715
|
+
const skippedContainer = $(".chat-question-carousel-summary");
|
|
716
|
+
const skippedMessage = $(".chat-question-summary-skipped");
|
|
717
|
+
skippedMessage.textContent = ( localize(5881, "Skipped"));
|
|
718
|
+
skippedContainer.appendChild(skippedMessage);
|
|
719
|
+
this.domNode.appendChild(skippedContainer);
|
|
720
|
+
}
|
|
721
|
+
renderSummary() {
|
|
722
|
+
if (this._answers.size === 0) {
|
|
723
|
+
this.renderSkippedMessage();
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
const summaryContainer = $(".chat-question-carousel-summary");
|
|
727
|
+
for (const question of this.carousel.questions) {
|
|
728
|
+
const answer = this._answers.get(question.id);
|
|
729
|
+
if (answer === undefined) {
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
const summaryItem = $(".chat-question-summary-item");
|
|
733
|
+
const questionLabel = $("span.chat-question-summary-label");
|
|
734
|
+
const questionText = question.message ?? question.title;
|
|
735
|
+
let labelText = typeof questionText === "string" ? questionText : questionText.value;
|
|
736
|
+
labelText = labelText.replace(/[:\s]+$/, "");
|
|
737
|
+
questionLabel.textContent = labelText;
|
|
738
|
+
summaryItem.appendChild(questionLabel);
|
|
739
|
+
const formattedAnswer = this.formatAnswerForSummary(question, answer);
|
|
740
|
+
const separatorIndex = formattedAnswer.indexOf(" - ");
|
|
741
|
+
if (separatorIndex !== -1) {
|
|
742
|
+
const answerTitle = $("span.chat-question-summary-answer-title");
|
|
743
|
+
answerTitle.textContent = formattedAnswer.substring(0, separatorIndex);
|
|
744
|
+
summaryItem.appendChild(answerTitle);
|
|
745
|
+
const answerDesc = $("span.chat-question-summary-answer-desc");
|
|
746
|
+
answerDesc.textContent = " - " + formattedAnswer.substring(separatorIndex + 3);
|
|
747
|
+
summaryItem.appendChild(answerDesc);
|
|
748
|
+
} else {
|
|
749
|
+
const answerValue = $("span.chat-question-summary-answer-title");
|
|
750
|
+
answerValue.textContent = formattedAnswer;
|
|
751
|
+
summaryItem.appendChild(answerValue);
|
|
752
|
+
}
|
|
753
|
+
summaryContainer.appendChild(summaryItem);
|
|
754
|
+
}
|
|
755
|
+
this.domNode.appendChild(summaryContainer);
|
|
756
|
+
}
|
|
757
|
+
formatAnswerForSummary(question, answer) {
|
|
758
|
+
switch (question.type) {
|
|
759
|
+
case "text":
|
|
760
|
+
return String(answer);
|
|
761
|
+
case "singleSelect":
|
|
762
|
+
{
|
|
763
|
+
if (typeof answer === "object" && answer !== null && hasKey(answer, {
|
|
764
|
+
selectedValue: true
|
|
765
|
+
})) {
|
|
766
|
+
const {
|
|
767
|
+
selectedValue,
|
|
768
|
+
freeformValue
|
|
769
|
+
} = answer;
|
|
770
|
+
const selectedLabel = question.options?.find(opt => opt.value === selectedValue)?.label;
|
|
771
|
+
if (freeformValue) {
|
|
772
|
+
return freeformValue;
|
|
773
|
+
}
|
|
774
|
+
return selectedLabel ?? String(selectedValue ?? "");
|
|
775
|
+
}
|
|
776
|
+
const label = question.options?.find(opt => opt.value === answer)?.label;
|
|
777
|
+
return label ?? String(answer);
|
|
778
|
+
}
|
|
779
|
+
case "multiSelect":
|
|
780
|
+
{
|
|
781
|
+
if (typeof answer === "object" && answer !== null && hasKey(answer, {
|
|
782
|
+
selectedValues: true
|
|
783
|
+
})) {
|
|
784
|
+
const {
|
|
785
|
+
selectedValues,
|
|
786
|
+
freeformValue
|
|
787
|
+
} = answer;
|
|
788
|
+
const labels = ( (selectedValues ?? []).map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v)));
|
|
789
|
+
if (freeformValue) {
|
|
790
|
+
labels.push(freeformValue);
|
|
791
|
+
}
|
|
792
|
+
return labels.join(( localize(5882, ", ")));
|
|
793
|
+
}
|
|
794
|
+
if (Array.isArray(answer)) {
|
|
795
|
+
return ( answer.map(v => question.options?.find(opt => opt.value === v)?.label ?? String(v))).join(( localize(5882, ", ")));
|
|
796
|
+
}
|
|
797
|
+
return String(answer);
|
|
798
|
+
}
|
|
799
|
+
default:
|
|
800
|
+
return String(answer);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
hasSameContent(other, _followingContent, element) {
|
|
804
|
+
if (!this._isSkipped && !this.carousel.isUsed && isResponseVM(element) && element.isComplete) {
|
|
805
|
+
return false;
|
|
806
|
+
}
|
|
807
|
+
return other.kind === "questionCarousel" && other === this.carousel;
|
|
808
|
+
}
|
|
809
|
+
addDisposable(disposable) {
|
|
810
|
+
this._register(disposable);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
export { ChatQuestionCarouselPart };
|