monaco-editor-core 0.56.0-dev-20251124 → 0.56.0-dev-20251217
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/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +34 -2
- package/esm/vs/base/browser/dom.js +1 -4
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +25 -11
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +15 -8
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/list/list.css +1 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/async.js +11 -0
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +11 -2
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/defaultAccount.js +6 -0
- package/esm/vs/base/common/defaultAccount.js.map +1 -0
- package/esm/vs/base/common/equals.js +73 -24
- package/esm/vs/base/common/equals.js.map +1 -1
- package/esm/vs/base/common/event.js +14 -4
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/iterator.js.map +1 -1
- package/esm/vs/base/common/keybindings.js +0 -8
- package/esm/vs/base/common/keybindings.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +2 -2
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/marshallingIds.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +1 -1
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
- package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/strings.js +3 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
- package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
- package/esm/vs/editor/browser/view.js +11 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
- package/esm/vs/editor/common/config/fontInfo.js +1 -1
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/core/edits/edit.js +19 -0
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
- package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
- package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
- package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
- package/esm/vs/editor/common/languages.js +2 -1
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/decorationProvider.js +21 -1
- package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +49 -30
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
- package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +2 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/textModelEvents.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +54 -36
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +14 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +2 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +33 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -65
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +69 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +159 -94
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +124 -50
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +393 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +11 -11
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +19 -11
- package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
- package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +37 -2
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +11 -4
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
- package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/log/common/log.js +1 -1
- package/esm/vs/platform/log/common/log.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +6 -6
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +7 -3
- package/esm/vs/platform/quickinput/browser/quickInput.js +19 -11
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
- package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
- package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
- package/esm/vs/platform/window/common/window.js +1 -1
- package/esm/vs/platform/window/common/window.js.map +1 -1
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +37 -2
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
- package/esm/vs/platform/product/common/productService.js.map +0 -1
|
@@ -93,19 +93,19 @@ export class Button extends Disposable {
|
|
|
93
93
|
}));
|
|
94
94
|
this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {
|
|
95
95
|
if (!this._element.classList.contains('disabled')) {
|
|
96
|
-
this.
|
|
96
|
+
this.updateStyles(true);
|
|
97
97
|
}
|
|
98
98
|
}));
|
|
99
99
|
this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
|
|
100
|
-
this.
|
|
100
|
+
this.updateStyles(false); // restore standard styles
|
|
101
101
|
}));
|
|
102
102
|
// Also set hover background when button is focused for feedback
|
|
103
103
|
this.focusTracker = this._register(trackFocus(this._element));
|
|
104
104
|
this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) {
|
|
105
|
-
this.
|
|
105
|
+
this.updateStyles(true);
|
|
106
106
|
} }));
|
|
107
107
|
this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
|
|
108
|
-
this.
|
|
108
|
+
this.updateStyles(false);
|
|
109
109
|
} }));
|
|
110
110
|
}
|
|
111
111
|
dispose() {
|
|
@@ -132,17 +132,19 @@ export class Button extends Disposable {
|
|
|
132
132
|
}
|
|
133
133
|
return elements;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
updateStyles(hover) {
|
|
136
136
|
let background;
|
|
137
|
+
let foreground;
|
|
137
138
|
if (this.options.secondary) {
|
|
138
139
|
background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
|
|
140
|
+
foreground = this.options.buttonSecondaryForeground;
|
|
139
141
|
}
|
|
140
142
|
else {
|
|
141
143
|
background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
|
|
144
|
+
foreground = this.options.buttonForeground;
|
|
142
145
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
+
this._element.style.backgroundColor = background || '';
|
|
147
|
+
this._element.style.color = foreground || '';
|
|
146
148
|
}
|
|
147
149
|
get element() {
|
|
148
150
|
return this._element;
|
|
@@ -219,6 +221,11 @@ export class Button extends Disposable {
|
|
|
219
221
|
get enabled() {
|
|
220
222
|
return !this._element.classList.contains('disabled');
|
|
221
223
|
}
|
|
224
|
+
set secondary(value) {
|
|
225
|
+
this._element.classList.toggle('secondary', value);
|
|
226
|
+
this.options.secondary = value;
|
|
227
|
+
this.updateStyles(false);
|
|
228
|
+
}
|
|
222
229
|
setTitle(title) {
|
|
223
230
|
if (!this._hover && title !== '') {
|
|
224
231
|
this._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('element'), this._element, title));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/ui/button/button.ts","vs/base/browser/ui/button/button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAiB,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/G,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAsB,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAmB,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAExG,OAAO,EAAE,UAAU,EAAe,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;AA0B5E,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IAClD,gBAAgB,EAAE,SAAS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,SAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QACrK,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;CACD","file":"button.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { addDisposableListener, EventHelper, EventType, IFocusTracker, reset, trackFocus } from '../../dom.js';\nimport { StandardKeyboardEvent } from '../../keyboardEvent.js';\nimport { renderMarkdown, renderAsPlaintext } from '../../markdownRenderer.js';\nimport { Gesture, EventType as TouchEventType } from '../../touch.js';\nimport { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { renderLabelWithIcons } from '../iconLabel/iconLabels.js';\nimport { Color } from '../../../common/color.js';\nimport { Event as BaseEvent, Emitter } from '../../../common/event.js';\nimport { IMarkdownString, isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js';\nimport { KeyCode } from '../../../common/keyCodes.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport './button.css';\nimport { IManagedHover } from '../hover/hover.js';\nimport { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';\nimport { safeSetInnerHtml, DomSanitizerConfig } from '../../domSanitize.js';\n\nexport interface IButtonOptions extends Partial<IButtonStyles> {\n\treadonly title?: boolean | string;\n\t/**\n\t * Will fallback to `title` if not set.\n\t */\n\treadonly ariaLabel?: string;\n\treadonly supportIcons?: boolean;\n\treadonly supportShortLabel?: boolean;\n\treadonly secondary?: boolean;\n\treadonly hoverDelegate?: IHoverDelegate;\n\treadonly disabled?: boolean;\n}\n\nexport interface IButtonStyles {\n\treadonly buttonBackground: string | undefined;\n\treadonly buttonHoverBackground: string | undefined;\n\treadonly buttonForeground: string | undefined;\n\treadonly buttonSeparator: string | undefined;\n\treadonly buttonSecondaryBackground: string | undefined;\n\treadonly buttonSecondaryHoverBackground: string | undefined;\n\treadonly buttonSecondaryForeground: string | undefined;\n\treadonly buttonBorder: string | undefined;\n}\n\nexport const unthemedButtonStyles: IButtonStyles = {\n\tbuttonBackground: '#0E639C',\n\tbuttonHoverBackground: '#006BB3',\n\tbuttonSeparator: Color.white.toString(),\n\tbuttonForeground: Color.white.toString(),\n\tbuttonBorder: undefined,\n\tbuttonSecondaryBackground: undefined,\n\tbuttonSecondaryForeground: undefined,\n\tbuttonSecondaryHoverBackground: undefined\n};\n\nexport interface IButton extends IDisposable {\n\n\tset label(value: string | IMarkdownString);\n\tset icon(value: ThemeIcon);\n\tset enabled(value: boolean);\n}\n\n// Only allow a very limited set of inline html tags\nconst buttonSanitizerConfig = Object.freeze<DomSanitizerConfig>({\n\tallowedTags: {\n\t\toverride: ['b', 'i', 'u', 'code', 'span'],\n\t},\n\tallowedAttributes: {\n\t\toverride: ['class'],\n\t},\n});\n\nexport class Button extends Disposable implements IButton {\n\n\tprotected options: IButtonOptions;\n\tprotected _element: HTMLElement;\n\tprotected _label: string | IMarkdownString = '';\n\tprotected _labelElement: HTMLElement | undefined;\n\tprotected _labelShortElement: HTMLElement | undefined;\n\tprivate _hover: IManagedHover | undefined;\n\n\tprivate _onDidClick = this._register(new Emitter<Event>());\n\tget onDidClick(): BaseEvent<Event> { return this._onDidClick.event; }\n\n\tprivate _onDidEscape = this._register(new Emitter<Event>());\n\n\tprivate focusTracker: IFocusTracker;\n\n\tconstructor(container: HTMLElement, options: IButtonOptions) {\n\t\tsuper();\n\n\t\tthis.options = options;\n\n\t\tthis._element = document.createElement('a');\n\t\tthis._element.classList.add('monaco-button');\n\t\tthis._element.tabIndex = 0;\n\t\tthis._element.setAttribute('role', 'button');\n\n\t\tthis._element.classList.toggle('secondary', !!options.secondary);\n\t\tconst background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;\n\t\tconst foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;\n\n\t\tthis._element.style.color = foreground || '';\n\t\tthis._element.style.backgroundColor = background || '';\n\n\t\tif (options.supportShortLabel) {\n\t\t\tthis._labelShortElement = document.createElement('div');\n\t\t\tthis._labelShortElement.classList.add('monaco-button-label-short');\n\t\t\tthis._element.appendChild(this._labelShortElement);\n\n\t\t\tthis._labelElement = document.createElement('div');\n\t\t\tthis._labelElement.classList.add('monaco-button-label');\n\t\t\tthis._element.appendChild(this._labelElement);\n\n\t\t\tthis._element.classList.add('monaco-text-button-with-short-label');\n\t\t}\n\n\t\tif (typeof options.title === 'string') {\n\t\t\tthis.setTitle(options.title);\n\t\t}\n\n\t\tif (typeof options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', options.ariaLabel);\n\t\t}\n\t\tcontainer.appendChild(this._element);\n\t\tthis.enabled = !options.disabled;\n\n\t\tthis._register(Gesture.addTarget(this._element));\n\n\t\t[EventType.CLICK, TouchEventType.Tap].forEach(eventType => {\n\t\t\tthis._register(addDisposableListener(this._element, eventType, e => {\n\t\t\t\tif (!this.enabled) {\n\t\t\t\t\tEventHelper.stop(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\tlet eventHandled = false;\n\t\t\tif (this.enabled && (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t\teventHandled = true;\n\t\t\t} else if (event.equals(KeyCode.Escape)) {\n\t\t\t\tthis._onDidEscape.fire(e);\n\t\t\t\tthis._element.blur();\n\t\t\t\teventHandled = true;\n\t\t\t}\n\n\t\t\tif (eventHandled) {\n\t\t\t\tEventHelper.stop(event, true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {\n\t\t\tif (!this._element.classList.contains('disabled')) {\n\t\t\t\tthis.updateBackground(true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {\n\t\t\tthis.updateBackground(false); // restore standard styles\n\t\t}));\n\n\t\t// Also set hover background when button is focused for feedback\n\t\tthis.focusTracker = this._register(trackFocus(this._element));\n\t\tthis._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.updateBackground(true); } }));\n\t\tthis._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.updateBackground(false); } }));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._element.remove();\n\t}\n\n\tprotected getContentElements(content: string): HTMLElement[] {\n\t\tconst elements: HTMLSpanElement[] = [];\n\t\tfor (let segment of renderLabelWithIcons(content)) {\n\t\t\tif (typeof (segment) === 'string') {\n\t\t\t\tsegment = segment.trim();\n\n\t\t\t\t// Ignore empty segment\n\t\t\t\tif (segment === '') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Convert string segments to <span> nodes\n\t\t\t\tconst node = document.createElement('span');\n\t\t\t\tnode.textContent = segment;\n\t\t\t\telements.push(node);\n\t\t\t} else {\n\t\t\t\telements.push(segment);\n\t\t\t}\n\t\t}\n\n\t\treturn elements;\n\t}\n\n\tprivate updateBackground(hover: boolean): void {\n\t\tlet background;\n\t\tif (this.options.secondary) {\n\t\t\tbackground = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;\n\t\t} else {\n\t\t\tbackground = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;\n\t\t}\n\t\tif (background) {\n\t\t\tthis._element.style.backgroundColor = background;\n\t\t}\n\t}\n\n\tget element(): HTMLElement {\n\t\treturn this._element;\n\t}\n\n\tset label(value: string | IMarkdownString) {\n\t\tif (this._label === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._element.classList.add('monaco-text-button');\n\t\tconst labelElement = this.options.supportShortLabel ? this._labelElement! : this._element;\n\n\t\tif (isMarkdownString(value)) {\n\t\t\tconst rendered = renderMarkdown(value, undefined, document.createElement('span'));\n\t\t\trendered.dispose();\n\n\t\t\t// Don't include outer `<p>`\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tconst root = rendered.element.querySelector('p')?.innerHTML;\n\t\t\tif (root) {\n\t\t\t\tsafeSetInnerHtml(labelElement, root, buttonSanitizerConfig);\n\t\t\t} else {\n\t\t\t\treset(labelElement);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.options.supportIcons) {\n\t\t\t\treset(labelElement, ...this.getContentElements(value));\n\t\t\t} else {\n\t\t\t\tlabelElement.textContent = value;\n\t\t\t}\n\t\t}\n\n\t\tlet title: string = '';\n\t\tif (typeof this.options.title === 'string') {\n\t\t\ttitle = this.options.title;\n\t\t} else if (this.options.title) {\n\t\t\ttitle = renderAsPlaintext(value);\n\t\t}\n\n\t\tthis.setTitle(title);\n\n\t\tthis._setAriaLabel();\n\n\t\tthis._label = value;\n\t}\n\n\tget label(): string | IMarkdownString {\n\t\treturn this._label;\n\t}\n\n\tprotected _setAriaLabel(): void {\n\t\tif (typeof this.options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.ariaLabel);\n\t\t} else if (typeof this.options.title === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.title);\n\t\t}\n\t}\n\n\tset icon(icon: ThemeIcon) {\n\t\tthis._setAriaLabel();\n\n\t\tconst oldIcons = Array.from(this._element.classList).filter(item => item.startsWith('codicon-'));\n\t\tthis._element.classList.remove(...oldIcons);\n\t\tthis._element.classList.add(...ThemeIcon.asClassNameArray(icon));\n\t}\n\n\tset enabled(value: boolean) {\n\t\tif (value) {\n\t\t\tthis._element.classList.remove('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(false));\n\t\t\tthis._element.tabIndex = 0;\n\t\t} else {\n\t\t\tthis._element.classList.add('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(true));\n\t\t}\n\t}\n\n\tget enabled() {\n\t\treturn !this._element.classList.contains('disabled');\n\t}\n\n\tsetTitle(title: string) {\n\t\tif (!this._hover && title !== '') {\n\t\t\tthis._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('element'), this._element, title));\n\t\t} else if (this._hover) {\n\t\t\tthis._hover.update(title);\n\t\t}\n\t}\n}\n","\nimport { addDisposableListener, EventHelper, EventType, IFocusTracker, reset, trackFocus } from '../../dom.js';\nimport { StandardKeyboardEvent } from '../../keyboardEvent.js';\nimport { renderMarkdown, renderAsPlaintext } from '../../markdownRenderer.js';\nimport { Gesture, EventType as TouchEventType } from '../../touch.js';\nimport { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { renderLabelWithIcons } from '../iconLabel/iconLabels.js';\nimport { Color } from '../../../common/color.js';\nimport { Event as BaseEvent, Emitter } from '../../../common/event.js';\nimport { IMarkdownString, isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js';\nimport { KeyCode } from '../../../common/keyCodes.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport './button.css';\nimport { IManagedHover } from '../hover/hover.js';\nimport { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';\nimport { safeSetInnerHtml, DomSanitizerConfig } from '../../domSanitize.js';\n\nexport interface IButtonOptions extends Partial<IButtonStyles> {\n\treadonly title?: boolean | string;\n\t/**\n\t * Will fallback to `title` if not set.\n\t */\n\treadonly ariaLabel?: string;\n\treadonly supportIcons?: boolean;\n\treadonly supportShortLabel?: boolean;\n\treadonly secondary?: boolean;\n\treadonly hoverDelegate?: IHoverDelegate;\n\treadonly disabled?: boolean;\n}\n\nexport interface IButtonStyles {\n\treadonly buttonBackground: string | undefined;\n\treadonly buttonHoverBackground: string | undefined;\n\treadonly buttonForeground: string | undefined;\n\treadonly buttonSeparator: string | undefined;\n\treadonly buttonSecondaryBackground: string | undefined;\n\treadonly buttonSecondaryHoverBackground: string | undefined;\n\treadonly buttonSecondaryForeground: string | undefined;\n\treadonly buttonBorder: string | undefined;\n}\n\nexport const unthemedButtonStyles: IButtonStyles = {\n\tbuttonBackground: '#0E639C',\n\tbuttonHoverBackground: '#006BB3',\n\tbuttonSeparator: Color.white.toString(),\n\tbuttonForeground: Color.white.toString(),\n\tbuttonBorder: undefined,\n\tbuttonSecondaryBackground: undefined,\n\tbuttonSecondaryForeground: undefined,\n\tbuttonSecondaryHoverBackground: undefined\n};\n\nexport interface IButton extends IDisposable {\n\n\tset label(value: string | IMarkdownString);\n\tset icon(value: ThemeIcon);\n\tset enabled(value: boolean);\n}\n\n// Only allow a very limited set of inline html tags\nconst buttonSanitizerConfig = Object.freeze<DomSanitizerConfig>({\n\tallowedTags: {\n\t\toverride: ['b', 'i', 'u', 'code', 'span'],\n\t},\n\tallowedAttributes: {\n\t\toverride: ['class'],\n\t},\n});\n\nexport class Button extends Disposable implements IButton {\n\n\tprotected options: IButtonOptions;\n\tprotected _element: HTMLElement;\n\tprotected _label: string | IMarkdownString = '';\n\tprotected _labelElement: HTMLElement | undefined;\n\tprotected _labelShortElement: HTMLElement | undefined;\n\tprivate _hover: IManagedHover | undefined;\n\n\tprivate _onDidClick = this._register(new Emitter<Event>());\n\tget onDidClick(): BaseEvent<Event> { return this._onDidClick.event; }\n\n\tprivate _onDidEscape = this._register(new Emitter<Event>());\n\n\tprivate focusTracker: IFocusTracker;\n\n\tconstructor(container: HTMLElement, options: IButtonOptions) {\n\t\tsuper();\n\n\t\tthis.options = options;\n\n\t\tthis._element = document.createElement('a');\n\t\tthis._element.classList.add('monaco-button');\n\t\tthis._element.tabIndex = 0;\n\t\tthis._element.setAttribute('role', 'button');\n\n\t\tthis._element.classList.toggle('secondary', !!options.secondary);\n\t\tconst background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;\n\t\tconst foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;\n\n\t\tthis._element.style.color = foreground || '';\n\t\tthis._element.style.backgroundColor = background || '';\n\n\t\tif (options.supportShortLabel) {\n\t\t\tthis._labelShortElement = document.createElement('div');\n\t\t\tthis._labelShortElement.classList.add('monaco-button-label-short');\n\t\t\tthis._element.appendChild(this._labelShortElement);\n\n\t\t\tthis._labelElement = document.createElement('div');\n\t\t\tthis._labelElement.classList.add('monaco-button-label');\n\t\t\tthis._element.appendChild(this._labelElement);\n\n\t\t\tthis._element.classList.add('monaco-text-button-with-short-label');\n\t\t}\n\n\t\tif (typeof options.title === 'string') {\n\t\t\tthis.setTitle(options.title);\n\t\t}\n\n\t\tif (typeof options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', options.ariaLabel);\n\t\t}\n\t\tcontainer.appendChild(this._element);\n\t\tthis.enabled = !options.disabled;\n\n\t\tthis._register(Gesture.addTarget(this._element));\n\n\t\t[EventType.CLICK, TouchEventType.Tap].forEach(eventType => {\n\t\t\tthis._register(addDisposableListener(this._element, eventType, e => {\n\t\t\t\tif (!this.enabled) {\n\t\t\t\t\tEventHelper.stop(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\tlet eventHandled = false;\n\t\t\tif (this.enabled && (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t\teventHandled = true;\n\t\t\t} else if (event.equals(KeyCode.Escape)) {\n\t\t\t\tthis._onDidEscape.fire(e);\n\t\t\t\tthis._element.blur();\n\t\t\t\teventHandled = true;\n\t\t\t}\n\n\t\t\tif (eventHandled) {\n\t\t\t\tEventHelper.stop(event, true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {\n\t\t\tif (!this._element.classList.contains('disabled')) {\n\t\t\t\tthis.updateBackground(true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {\n\t\t\tthis.updateBackground(false); // restore standard styles\n\t\t}));\n\n\t\t// Also set hover background when button is focused for feedback\n\t\tthis.focusTracker = this._register(trackFocus(this._element));\n\t\tthis._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.updateBackground(true); } }));\n\t\tthis._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.updateBackground(false); } }));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._element.remove();\n\t}\n\n\tprotected getContentElements(content: string): HTMLElement[] {\n\t\tconst elements: HTMLSpanElement[] = [];\n\t\tfor (let segment of renderLabelWithIcons(content)) {\n\t\t\tif (typeof (segment) === 'string') {\n\t\t\t\tsegment = segment.trim();\n\n\t\t\t\t// Ignore empty segment\n\t\t\t\tif (segment === '') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Convert string segments to <span> nodes\n\t\t\t\tconst node = document.createElement('span');\n\t\t\t\tnode.textContent = segment;\n\t\t\t\telements.push(node);\n\t\t\t} else {\n\t\t\t\telements.push(segment);\n\t\t\t}\n\t\t}\n\n\t\treturn elements;\n\t}\n\n\tprivate updateBackground(hover: boolean): void {\n\t\tlet background;\n\t\tif (this.options.secondary) {\n\t\t\tbackground = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;\n\t\t} else {\n\t\t\tbackground = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;\n\t\t}\n\t\tif (background) {\n\t\t\tthis._element.style.backgroundColor = background;\n\t\t}\n\t}\n\n\tget element(): HTMLElement {\n\t\treturn this._element;\n\t}\n\n\tset label(value: string | IMarkdownString) {\n\t\tif (this._label === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._element.classList.add('monaco-text-button');\n\t\tconst labelElement = this.options.supportShortLabel ? this._labelElement! : this._element;\n\n\t\tif (isMarkdownString(value)) {\n\t\t\tconst rendered = renderMarkdown(value, undefined, document.createElement('span'));\n\t\t\trendered.dispose();\n\n\t\t\t// Don't include outer `<p>`\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tconst root = rendered.element.querySelector('p')?.innerHTML;\n\t\t\tif (root) {\n\t\t\t\tsafeSetInnerHtml(labelElement, root, buttonSanitizerConfig);\n\t\t\t} else {\n\t\t\t\treset(labelElement);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.options.supportIcons) {\n\t\t\t\treset(labelElement, ...this.getContentElements(value));\n\t\t\t} else {\n\t\t\t\tlabelElement.textContent = value;\n\t\t\t}\n\t\t}\n\n\t\tlet title: string = '';\n\t\tif (typeof this.options.title === 'string') {\n\t\t\ttitle = this.options.title;\n\t\t} else if (this.options.title) {\n\t\t\ttitle = renderAsPlaintext(value);\n\t\t}\n\n\t\tthis.setTitle(title);\n\n\t\tthis._setAriaLabel();\n\n\t\tthis._label = value;\n\t}\n\n\tget label(): string | IMarkdownString {\n\t\treturn this._label;\n\t}\n\n\tprotected _setAriaLabel(): void {\n\t\tif (typeof this.options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.ariaLabel);\n\t\t} else if (typeof this.options.title === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.title);\n\t\t}\n\t}\n\n\tset icon(icon: ThemeIcon) {\n\t\tthis._setAriaLabel();\n\n\t\tconst oldIcons = Array.from(this._element.classList).filter(item => item.startsWith('codicon-'));\n\t\tthis._element.classList.remove(...oldIcons);\n\t\tthis._element.classList.add(...ThemeIcon.asClassNameArray(icon));\n\t}\n\n\tset enabled(value: boolean) {\n\t\tif (value) {\n\t\t\tthis._element.classList.remove('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(false));\n\t\t\tthis._element.tabIndex = 0;\n\t\t} else {\n\t\t\tthis._element.classList.add('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(true));\n\t\t}\n\t}\n\n\tget enabled() {\n\t\treturn !this._element.classList.contains('disabled');\n\t}\n\n\tsetTitle(title: string) {\n\t\tif (!this._hover && title !== '') {\n\t\t\tthis._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('element'), this._element, title));\n\t\t} else if (this._hover) {\n\t\t\tthis._hover.update(title);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/browser/ui/button/button.ts","vs/base/browser/ui/button/button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,SAAS,EAAiB,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/G,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAsB,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAmB,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAExG,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AC;YACxC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACF,CAAC;IAED,IAAI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,SAAS,CAAC,KAAc;QAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,OAAmC,CAAC,SAAS,GAAG,KAAK,CAAC;QAC5D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,KAAa;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,uBAAuB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QACrK,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC;CACD","file":"button.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { addDisposableListener, EventHelper, EventType, IFocusTracker, reset, trackFocus } from '../../dom.js';\nimport { StandardKeyboardEvent } from '../../keyboardEvent.js';\nimport { renderMarkdown, renderAsPlaintext } from '../../markdownRenderer.js';\nimport { Gesture, EventType as TouchEventType } from '../../touch.js';\nimport { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { renderLabelWithIcons } from '../iconLabel/iconLabels.js';\nimport { Color } from '../../../common/color.js';\nimport { Event as BaseEvent, Emitter } from '../../../common/event.js';\nimport { IMarkdownString, isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js';\nimport { KeyCode } from '../../../common/keyCodes.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport './button.css';\nimport { IManagedHover } from '../hover/hover.js';\nimport { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';\nimport { safeSetInnerHtml, DomSanitizerConfig } from '../../domSanitize.js';\n\nexport interface IButtonOptions extends Partial<IButtonStyles> {\n\treadonly title?: boolean | string;\n\t/**\n\t * Will fallback to `title` if not set.\n\t */\n\treadonly ariaLabel?: string;\n\treadonly supportIcons?: boolean;\n\treadonly supportShortLabel?: boolean;\n\treadonly secondary?: boolean;\n\treadonly hoverDelegate?: IHoverDelegate;\n\treadonly disabled?: boolean;\n}\n\nexport interface IButtonStyles {\n\treadonly buttonBackground: string | undefined;\n\treadonly buttonHoverBackground: string | undefined;\n\treadonly buttonForeground: string | undefined;\n\treadonly buttonSeparator: string | undefined;\n\treadonly buttonSecondaryBackground: string | undefined;\n\treadonly buttonSecondaryHoverBackground: string | undefined;\n\treadonly buttonSecondaryForeground: string | undefined;\n\treadonly buttonBorder: string | undefined;\n}\n\nexport const unthemedButtonStyles: IButtonStyles = {\n\tbuttonBackground: '#0E639C',\n\tbuttonHoverBackground: '#006BB3',\n\tbuttonSeparator: Color.white.toString(),\n\tbuttonForeground: Color.white.toString(),\n\tbuttonBorder: undefined,\n\tbuttonSecondaryBackground: undefined,\n\tbuttonSecondaryForeground: undefined,\n\tbuttonSecondaryHoverBackground: undefined\n};\n\nexport interface IButton extends IDisposable {\n\n\tset label(value: string | IMarkdownString);\n\tset icon(value: ThemeIcon);\n\tset enabled(value: boolean);\n}\n\n// Only allow a very limited set of inline html tags\nconst buttonSanitizerConfig = Object.freeze<DomSanitizerConfig>({\n\tallowedTags: {\n\t\toverride: ['b', 'i', 'u', 'code', 'span'],\n\t},\n\tallowedAttributes: {\n\t\toverride: ['class'],\n\t},\n});\n\nexport class Button extends Disposable implements IButton {\n\n\tprotected options: IButtonOptions;\n\tprotected _element: HTMLElement;\n\tprotected _label: string | IMarkdownString = '';\n\tprotected _labelElement: HTMLElement | undefined;\n\tprotected _labelShortElement: HTMLElement | undefined;\n\tprivate _hover: IManagedHover | undefined;\n\n\tprivate _onDidClick = this._register(new Emitter<Event>());\n\tget onDidClick(): BaseEvent<Event> { return this._onDidClick.event; }\n\n\tprivate _onDidEscape = this._register(new Emitter<Event>());\n\n\tprivate focusTracker: IFocusTracker;\n\n\tconstructor(container: HTMLElement, options: IButtonOptions) {\n\t\tsuper();\n\n\t\tthis.options = options;\n\n\t\tthis._element = document.createElement('a');\n\t\tthis._element.classList.add('monaco-button');\n\t\tthis._element.tabIndex = 0;\n\t\tthis._element.setAttribute('role', 'button');\n\n\t\tthis._element.classList.toggle('secondary', !!options.secondary);\n\t\tconst background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;\n\t\tconst foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;\n\n\t\tthis._element.style.color = foreground || '';\n\t\tthis._element.style.backgroundColor = background || '';\n\n\t\tif (options.supportShortLabel) {\n\t\t\tthis._labelShortElement = document.createElement('div');\n\t\t\tthis._labelShortElement.classList.add('monaco-button-label-short');\n\t\t\tthis._element.appendChild(this._labelShortElement);\n\n\t\t\tthis._labelElement = document.createElement('div');\n\t\t\tthis._labelElement.classList.add('monaco-button-label');\n\t\t\tthis._element.appendChild(this._labelElement);\n\n\t\t\tthis._element.classList.add('monaco-text-button-with-short-label');\n\t\t}\n\n\t\tif (typeof options.title === 'string') {\n\t\t\tthis.setTitle(options.title);\n\t\t}\n\n\t\tif (typeof options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', options.ariaLabel);\n\t\t}\n\t\tcontainer.appendChild(this._element);\n\t\tthis.enabled = !options.disabled;\n\n\t\tthis._register(Gesture.addTarget(this._element));\n\n\t\t[EventType.CLICK, TouchEventType.Tap].forEach(eventType => {\n\t\t\tthis._register(addDisposableListener(this._element, eventType, e => {\n\t\t\t\tif (!this.enabled) {\n\t\t\t\t\tEventHelper.stop(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\tlet eventHandled = false;\n\t\t\tif (this.enabled && (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t\teventHandled = true;\n\t\t\t} else if (event.equals(KeyCode.Escape)) {\n\t\t\t\tthis._onDidEscape.fire(e);\n\t\t\t\tthis._element.blur();\n\t\t\t\teventHandled = true;\n\t\t\t}\n\n\t\t\tif (eventHandled) {\n\t\t\t\tEventHelper.stop(event, true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {\n\t\t\tif (!this._element.classList.contains('disabled')) {\n\t\t\t\tthis.updateStyles(true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {\n\t\t\tthis.updateStyles(false); // restore standard styles\n\t\t}));\n\n\t\t// Also set hover background when button is focused for feedback\n\t\tthis.focusTracker = this._register(trackFocus(this._element));\n\t\tthis._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.updateStyles(true); } }));\n\t\tthis._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.updateStyles(false); } }));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._element.remove();\n\t}\n\n\tprotected getContentElements(content: string): HTMLElement[] {\n\t\tconst elements: HTMLSpanElement[] = [];\n\t\tfor (let segment of renderLabelWithIcons(content)) {\n\t\t\tif (typeof (segment) === 'string') {\n\t\t\t\tsegment = segment.trim();\n\n\t\t\t\t// Ignore empty segment\n\t\t\t\tif (segment === '') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Convert string segments to <span> nodes\n\t\t\t\tconst node = document.createElement('span');\n\t\t\t\tnode.textContent = segment;\n\t\t\t\telements.push(node);\n\t\t\t} else {\n\t\t\t\telements.push(segment);\n\t\t\t}\n\t\t}\n\n\t\treturn elements;\n\t}\n\n\tprivate updateStyles(hover: boolean): void {\n\t\tlet background;\n\t\tlet foreground;\n\t\tif (this.options.secondary) {\n\t\t\tbackground = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;\n\t\t\tforeground = this.options.buttonSecondaryForeground;\n\t\t} else {\n\t\t\tbackground = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;\n\t\t\tforeground = this.options.buttonForeground;\n\t\t}\n\n\t\tthis._element.style.backgroundColor = background || '';\n\t\tthis._element.style.color = foreground || '';\n\t}\n\n\tget element(): HTMLElement {\n\t\treturn this._element;\n\t}\n\n\tset label(value: string | IMarkdownString) {\n\t\tif (this._label === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._element.classList.add('monaco-text-button');\n\t\tconst labelElement = this.options.supportShortLabel ? this._labelElement! : this._element;\n\n\t\tif (isMarkdownString(value)) {\n\t\t\tconst rendered = renderMarkdown(value, undefined, document.createElement('span'));\n\t\t\trendered.dispose();\n\n\t\t\t// Don't include outer `<p>`\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tconst root = rendered.element.querySelector('p')?.innerHTML;\n\t\t\tif (root) {\n\t\t\t\tsafeSetInnerHtml(labelElement, root, buttonSanitizerConfig);\n\t\t\t} else {\n\t\t\t\treset(labelElement);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.options.supportIcons) {\n\t\t\t\treset(labelElement, ...this.getContentElements(value));\n\t\t\t} else {\n\t\t\t\tlabelElement.textContent = value;\n\t\t\t}\n\t\t}\n\n\t\tlet title: string = '';\n\t\tif (typeof this.options.title === 'string') {\n\t\t\ttitle = this.options.title;\n\t\t} else if (this.options.title) {\n\t\t\ttitle = renderAsPlaintext(value);\n\t\t}\n\n\t\tthis.setTitle(title);\n\n\t\tthis._setAriaLabel();\n\n\t\tthis._label = value;\n\t}\n\n\tget label(): string | IMarkdownString {\n\t\treturn this._label;\n\t}\n\n\tprotected _setAriaLabel(): void {\n\t\tif (typeof this.options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.ariaLabel);\n\t\t} else if (typeof this.options.title === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.title);\n\t\t}\n\t}\n\n\tset icon(icon: ThemeIcon) {\n\t\tthis._setAriaLabel();\n\n\t\tconst oldIcons = Array.from(this._element.classList).filter(item => item.startsWith('codicon-'));\n\t\tthis._element.classList.remove(...oldIcons);\n\t\tthis._element.classList.add(...ThemeIcon.asClassNameArray(icon));\n\t}\n\n\tset enabled(value: boolean) {\n\t\tif (value) {\n\t\t\tthis._element.classList.remove('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(false));\n\t\t\tthis._element.tabIndex = 0;\n\t\t} else {\n\t\t\tthis._element.classList.add('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(true));\n\t\t}\n\t}\n\n\tget enabled() {\n\t\treturn !this._element.classList.contains('disabled');\n\t}\n\n\tset secondary(value: boolean) {\n\t\tthis._element.classList.toggle('secondary', value);\n\t\t(this.options as { secondary?: boolean }).secondary = value;\n\t\tthis.updateStyles(false);\n\t}\n\n\tsetTitle(title: string) {\n\t\tif (!this._hover && title !== '') {\n\t\t\tthis._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('element'), this._element, title));\n\t\t} else if (this._hover) {\n\t\t\tthis._hover.update(title);\n\t\t}\n\t}\n}\n","\nimport { addDisposableListener, EventHelper, EventType, IFocusTracker, reset, trackFocus } from '../../dom.js';\nimport { StandardKeyboardEvent } from '../../keyboardEvent.js';\nimport { renderMarkdown, renderAsPlaintext } from '../../markdownRenderer.js';\nimport { Gesture, EventType as TouchEventType } from '../../touch.js';\nimport { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { renderLabelWithIcons } from '../iconLabel/iconLabels.js';\nimport { Color } from '../../../common/color.js';\nimport { Event as BaseEvent, Emitter } from '../../../common/event.js';\nimport { IMarkdownString, isMarkdownString, markdownStringEqual } from '../../../common/htmlContent.js';\nimport { KeyCode } from '../../../common/keyCodes.js';\nimport { Disposable, IDisposable } from '../../../common/lifecycle.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport './button.css';\nimport { IManagedHover } from '../hover/hover.js';\nimport { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';\nimport { safeSetInnerHtml, DomSanitizerConfig } from '../../domSanitize.js';\n\nexport interface IButtonOptions extends Partial<IButtonStyles> {\n\treadonly title?: boolean | string;\n\t/**\n\t * Will fallback to `title` if not set.\n\t */\n\treadonly ariaLabel?: string;\n\treadonly supportIcons?: boolean;\n\treadonly supportShortLabel?: boolean;\n\treadonly secondary?: boolean;\n\treadonly hoverDelegate?: IHoverDelegate;\n\treadonly disabled?: boolean;\n}\n\nexport interface IButtonStyles {\n\treadonly buttonBackground: string | undefined;\n\treadonly buttonHoverBackground: string | undefined;\n\treadonly buttonForeground: string | undefined;\n\treadonly buttonSeparator: string | undefined;\n\treadonly buttonSecondaryBackground: string | undefined;\n\treadonly buttonSecondaryHoverBackground: string | undefined;\n\treadonly buttonSecondaryForeground: string | undefined;\n\treadonly buttonBorder: string | undefined;\n}\n\nexport const unthemedButtonStyles: IButtonStyles = {\n\tbuttonBackground: '#0E639C',\n\tbuttonHoverBackground: '#006BB3',\n\tbuttonSeparator: Color.white.toString(),\n\tbuttonForeground: Color.white.toString(),\n\tbuttonBorder: undefined,\n\tbuttonSecondaryBackground: undefined,\n\tbuttonSecondaryForeground: undefined,\n\tbuttonSecondaryHoverBackground: undefined\n};\n\nexport interface IButton extends IDisposable {\n\n\tset label(value: string | IMarkdownString);\n\tset icon(value: ThemeIcon);\n\tset enabled(value: boolean);\n}\n\n// Only allow a very limited set of inline html tags\nconst buttonSanitizerConfig = Object.freeze<DomSanitizerConfig>({\n\tallowedTags: {\n\t\toverride: ['b', 'i', 'u', 'code', 'span'],\n\t},\n\tallowedAttributes: {\n\t\toverride: ['class'],\n\t},\n});\n\nexport class Button extends Disposable implements IButton {\n\n\tprotected options: IButtonOptions;\n\tprotected _element: HTMLElement;\n\tprotected _label: string | IMarkdownString = '';\n\tprotected _labelElement: HTMLElement | undefined;\n\tprotected _labelShortElement: HTMLElement | undefined;\n\tprivate _hover: IManagedHover | undefined;\n\n\tprivate _onDidClick = this._register(new Emitter<Event>());\n\tget onDidClick(): BaseEvent<Event> { return this._onDidClick.event; }\n\n\tprivate _onDidEscape = this._register(new Emitter<Event>());\n\n\tprivate focusTracker: IFocusTracker;\n\n\tconstructor(container: HTMLElement, options: IButtonOptions) {\n\t\tsuper();\n\n\t\tthis.options = options;\n\n\t\tthis._element = document.createElement('a');\n\t\tthis._element.classList.add('monaco-button');\n\t\tthis._element.tabIndex = 0;\n\t\tthis._element.setAttribute('role', 'button');\n\n\t\tthis._element.classList.toggle('secondary', !!options.secondary);\n\t\tconst background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;\n\t\tconst foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;\n\n\t\tthis._element.style.color = foreground || '';\n\t\tthis._element.style.backgroundColor = background || '';\n\n\t\tif (options.supportShortLabel) {\n\t\t\tthis._labelShortElement = document.createElement('div');\n\t\t\tthis._labelShortElement.classList.add('monaco-button-label-short');\n\t\t\tthis._element.appendChild(this._labelShortElement);\n\n\t\t\tthis._labelElement = document.createElement('div');\n\t\t\tthis._labelElement.classList.add('monaco-button-label');\n\t\t\tthis._element.appendChild(this._labelElement);\n\n\t\t\tthis._element.classList.add('monaco-text-button-with-short-label');\n\t\t}\n\n\t\tif (typeof options.title === 'string') {\n\t\t\tthis.setTitle(options.title);\n\t\t}\n\n\t\tif (typeof options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', options.ariaLabel);\n\t\t}\n\t\tcontainer.appendChild(this._element);\n\t\tthis.enabled = !options.disabled;\n\n\t\tthis._register(Gesture.addTarget(this._element));\n\n\t\t[EventType.CLICK, TouchEventType.Tap].forEach(eventType => {\n\t\t\tthis._register(addDisposableListener(this._element, eventType, e => {\n\t\t\t\tif (!this.enabled) {\n\t\t\t\t\tEventHelper.stop(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(addDisposableListener(this._element, EventType.KEY_DOWN, e => {\n\t\t\tconst event = new StandardKeyboardEvent(e);\n\t\t\tlet eventHandled = false;\n\t\t\tif (this.enabled && (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {\n\t\t\t\tthis._onDidClick.fire(e);\n\t\t\t\teventHandled = true;\n\t\t\t} else if (event.equals(KeyCode.Escape)) {\n\t\t\t\tthis._onDidEscape.fire(e);\n\t\t\t\tthis._element.blur();\n\t\t\t\teventHandled = true;\n\t\t\t}\n\n\t\t\tif (eventHandled) {\n\t\t\t\tEventHelper.stop(event, true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {\n\t\t\tif (!this._element.classList.contains('disabled')) {\n\t\t\t\tthis.updateStyles(true);\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {\n\t\t\tthis.updateStyles(false); // restore standard styles\n\t\t}));\n\n\t\t// Also set hover background when button is focused for feedback\n\t\tthis.focusTracker = this._register(trackFocus(this._element));\n\t\tthis._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.updateStyles(true); } }));\n\t\tthis._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.updateStyles(false); } }));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._element.remove();\n\t}\n\n\tprotected getContentElements(content: string): HTMLElement[] {\n\t\tconst elements: HTMLSpanElement[] = [];\n\t\tfor (let segment of renderLabelWithIcons(content)) {\n\t\t\tif (typeof (segment) === 'string') {\n\t\t\t\tsegment = segment.trim();\n\n\t\t\t\t// Ignore empty segment\n\t\t\t\tif (segment === '') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Convert string segments to <span> nodes\n\t\t\t\tconst node = document.createElement('span');\n\t\t\t\tnode.textContent = segment;\n\t\t\t\telements.push(node);\n\t\t\t} else {\n\t\t\t\telements.push(segment);\n\t\t\t}\n\t\t}\n\n\t\treturn elements;\n\t}\n\n\tprivate updateStyles(hover: boolean): void {\n\t\tlet background;\n\t\tlet foreground;\n\t\tif (this.options.secondary) {\n\t\t\tbackground = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;\n\t\t\tforeground = this.options.buttonSecondaryForeground;\n\t\t} else {\n\t\t\tbackground = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;\n\t\t\tforeground = this.options.buttonForeground;\n\t\t}\n\n\t\tthis._element.style.backgroundColor = background || '';\n\t\tthis._element.style.color = foreground || '';\n\t}\n\n\tget element(): HTMLElement {\n\t\treturn this._element;\n\t}\n\n\tset label(value: string | IMarkdownString) {\n\t\tif (this._label === value) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._element.classList.add('monaco-text-button');\n\t\tconst labelElement = this.options.supportShortLabel ? this._labelElement! : this._element;\n\n\t\tif (isMarkdownString(value)) {\n\t\t\tconst rendered = renderMarkdown(value, undefined, document.createElement('span'));\n\t\t\trendered.dispose();\n\n\t\t\t// Don't include outer `<p>`\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tconst root = rendered.element.querySelector('p')?.innerHTML;\n\t\t\tif (root) {\n\t\t\t\tsafeSetInnerHtml(labelElement, root, buttonSanitizerConfig);\n\t\t\t} else {\n\t\t\t\treset(labelElement);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.options.supportIcons) {\n\t\t\t\treset(labelElement, ...this.getContentElements(value));\n\t\t\t} else {\n\t\t\t\tlabelElement.textContent = value;\n\t\t\t}\n\t\t}\n\n\t\tlet title: string = '';\n\t\tif (typeof this.options.title === 'string') {\n\t\t\ttitle = this.options.title;\n\t\t} else if (this.options.title) {\n\t\t\ttitle = renderAsPlaintext(value);\n\t\t}\n\n\t\tthis.setTitle(title);\n\n\t\tthis._setAriaLabel();\n\n\t\tthis._label = value;\n\t}\n\n\tget label(): string | IMarkdownString {\n\t\treturn this._label;\n\t}\n\n\tprotected _setAriaLabel(): void {\n\t\tif (typeof this.options.ariaLabel === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.ariaLabel);\n\t\t} else if (typeof this.options.title === 'string') {\n\t\t\tthis._element.setAttribute('aria-label', this.options.title);\n\t\t}\n\t}\n\n\tset icon(icon: ThemeIcon) {\n\t\tthis._setAriaLabel();\n\n\t\tconst oldIcons = Array.from(this._element.classList).filter(item => item.startsWith('codicon-'));\n\t\tthis._element.classList.remove(...oldIcons);\n\t\tthis._element.classList.add(...ThemeIcon.asClassNameArray(icon));\n\t}\n\n\tset enabled(value: boolean) {\n\t\tif (value) {\n\t\t\tthis._element.classList.remove('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(false));\n\t\t\tthis._element.tabIndex = 0;\n\t\t} else {\n\t\t\tthis._element.classList.add('disabled');\n\t\t\tthis._element.setAttribute('aria-disabled', String(true));\n\t\t}\n\t}\n\n\tget enabled() {\n\t\treturn !this._element.classList.contains('disabled');\n\t}\n\n\tset secondary(value: boolean) {\n\t\tthis._element.classList.toggle('secondary', value);\n\t\t(this.options as { secondary?: boolean }).secondary = value;\n\t\tthis.updateStyles(false);\n\t}\n\n\tsetTitle(title: string) {\n\t\tif (!this._hover && title !== '') {\n\t\t\tthis._hover = this._register(getBaseLayerHoverDelegate().setupManagedHover(this.options.hoverDelegate ?? getDefaultHoverDelegate('element'), this._element, title));\n\t\t} else if (this._hover) {\n\t\t\tthis._hover.update(title);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
.codicon-sync.codicon-modifier-spin,
|
|
17
17
|
.codicon-loading.codicon-modifier-spin,
|
|
18
18
|
.codicon-gear.codicon-modifier-spin,
|
|
19
|
-
.codicon-notebook-state-executing.codicon-modifier-spin
|
|
19
|
+
.codicon-notebook-state-executing.codicon-modifier-spin,
|
|
20
|
+
.codicon-loading,
|
|
21
|
+
.codicon-tree-item-loading::before {
|
|
20
22
|
/* Use steps to throttle FPS to reduce CPU usage */
|
|
21
23
|
animation: codicon-spin 1.5s steps(30) infinite;
|
|
22
24
|
}
|
|
@@ -24,10 +26,3 @@
|
|
|
24
26
|
.codicon-modifier-disabled {
|
|
25
27
|
opacity: 0.4;
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
/* custom speed & easing for loading icon */
|
|
29
|
-
.codicon-loading,
|
|
30
|
-
.codicon-tree-item-loading::before {
|
|
31
|
-
animation-duration: 1s !important;
|
|
32
|
-
animation-timing-function: cubic-bezier(0.53, 0.21, 0.29, 0.67) !important;
|
|
33
|
-
}
|
|
Binary file
|
|
@@ -164,6 +164,9 @@ export class ToolBar extends Disposable {
|
|
|
164
164
|
if (this.actionBar.isEmpty()) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
+
// Ensure that the container width respects the minimum width of the
|
|
168
|
+
// element which is set based on the `responsiveBehavior.minItems` option
|
|
169
|
+
containerWidth = Math.max(containerWidth, parseInt(this.element.style.minWidth));
|
|
167
170
|
// Each action is assumed to have a minimum width so that actions with a label
|
|
168
171
|
// can shrink to the action's minimum width. We do this so that action visibility
|
|
169
172
|
// takes precedence over the action label.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vs/base/browser/ui/toolbar/toolbar.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,SAAS,EAA+C,MAAM,2BAA2B,CAAC;AAEnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,MAAM,EAA0B,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,eAAe,CAAC;AACvB,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E,MAAM,gBAAgB,GAAG,EAAE,CAAC,CAAC,oCAAoC;AAwCjE;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,UAAU;IAUtC,IAAI,6BAA6B,KAAK,OAAO,IAAI,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAC;IAMzF,YAA6B,SAAsB,EAAE,mBAAyC,EAAE,UAA2B,EAAE,WAAW,uCAA+B,EAAE;QACxK,KAAK,EAAE,CAAC;QADoB,cAAS,GAAT,SAAS,CAAa;QAX3C,2BAAsB,GAAiC,EAAE,CAAC;QAC1D,wBAAmB,GAAY,KAAK,CAAC;QAGrC,mCAA8B,GAAG,IAAI,C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ChE,KAAK,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAEnD,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,CAAC;IAEQ,KAAK,CAAC,GAAG;QACjB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED,IAAI,WAAW,CAAC,OAA+B;QAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAC7B,CAAC","file":"toolbar.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IContextMenuProvider } from '../../contextmenu.js';\nimport { ActionBar, ActionsOrientation, IActionViewItemProvider } from '../actionbar/actionbar.js';\nimport { AnchorAlignment } from '../contextview/contextview.js';\nimport { DropdownMenuActionViewItem } from '../dropdown/dropdownActionViewItem.js';\nimport { Action, IAction, IActionRunner, Separator, SubmenuAction } from '../../../common/actions.js';\nimport { Codicon } from '../../../common/codicons.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport { EventMultiplexer } from '../../../common/event.js';\nimport { ResolvedKeybinding } from '../../../common/keybindings.js';\nimport { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js';\nimport './toolbar.css';\nimport * as nls from '../../../../nls.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js';\n\nconst ACTION_MIN_WIDTH = 24; /* 20px codicon + 4px left padding*/\n\nexport interface IToolBarOptions {\n\torientation?: ActionsOrientation;\n\tactionViewItemProvider?: IActionViewItemProvider;\n\tariaLabel?: string;\n\tgetKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;\n\tactionRunner?: IActionRunner;\n\ttoggleMenuTitle?: string;\n\tanchorAlignmentProvider?: () => AnchorAlignment;\n\trenderDropdownAsChildElement?: boolean;\n\tmoreIcon?: ThemeIcon;\n\tallowContextMenu?: boolean;\n\tskipTelemetry?: boolean;\n\thoverDelegate?: IHoverDelegate;\n\ttrailingSeparator?: boolean;\n\n\t/**\n\t * If true, toggled primary items are highlighted with a background color.\n\t */\n\thighlightToggledItems?: boolean;\n\n\t/**\n\t * Render action with icons (default: `true`)\n\t */\n\ticon?: boolean;\n\n\t/**\n\t * Render action with label (default: `false`)\n\t */\n\tlabel?: boolean;\n\n\t/**\n\t * Controls the responsive behavior of the primary group of the toolbar.\n\t * - `enabled`: Whether the responsive behavior is enabled.\n\t * - `minItems`: The minimum number of items that should always be visible.\n\t */\n\tresponsiveBehavior?: { enabled: boolean; minItems?: number };\n}\n\n/**\n * A widget that combines an action bar for primary actions and a dropdown for secondary actions.\n */\nexport class ToolBar extends Disposable {\n\tprivate options: IToolBarOptions;\n\tprotected readonly actionBar: ActionBar;\n\tprivate toggleMenuAction: ToggleMenuAction;\n\tprivate toggleMenuActionViewItem: DropdownMenuActionViewItem | undefined;\n\tprivate submenuActionViewItems: DropdownMenuActionViewItem[] = [];\n\tprivate hasSecondaryActions: boolean = false;\n\tprivate readonly element: HTMLElement;\n\n\tprivate _onDidChangeDropdownVisibility = this._register(new EventMultiplexer<boolean>());\n\tget onDidChangeDropdownVisibility() { return this._onDidChangeDropdownVisibility.event; }\n\tprivate originalPrimaryActions: ReadonlyArray<IAction> = [];\n\tprivate originalSecondaryActions: ReadonlyArray<IAction> = [];\n\tprivate hiddenActions: { action: IAction; size: number }[] = [];\n\tprivate readonly disposables = this._register(new DisposableStore());\n\n\tconstructor(private readonly container: HTMLElement, contextMenuProvider: IContextMenuProvider, options: IToolBarOptions = { orientation: ActionsOrientation.HORIZONTAL }) {\n\t\tsuper();\n\n\t\toptions.hoverDelegate = options.hoverDelegate ?? this._register(createInstantHoverDelegate());\n\t\tthis.options = options;\n\n\t\tthis.toggleMenuAction = this._register(new ToggleMenuAction(() => this.toggleMenuActionViewItem?.show(), options.toggleMenuTitle));\n\n\t\tthis.element = document.createElement('div');\n\t\tthis.element.className = 'monaco-toolbar';\n\t\tcontainer.appendChild(this.element);\n\n\t\tthis.actionBar = this._register(new ActionBar(this.element, {\n\t\t\torientation: options.orientation,\n\t\t\tariaLabel: options.ariaLabel,\n\t\t\tactionRunner: options.actionRunner,\n\t\t\tallowContextMenu: options.allowContextMenu,\n\t\t\thighlightToggledItems: options.highlightToggledItems,\n\t\t\thoverDelegate: options.hoverDelegate,\n\t\t\tactionViewItemProvider: (action, viewItemOptions) => {\n\t\t\t\tif (action.id === ToggleMenuAction.ID) {\n\t\t\t\t\tthis.toggleMenuActionViewItem = new DropdownMenuActionViewItem(\n\t\t\t\t\t\taction,\n\t\t\t\t\t\t{ getActions: () => this.toggleMenuAction.menuActions },\n\t\t\t\t\t\tcontextMenuProvider,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tactionViewItemProvider: this.options.actionViewItemProvider,\n\t\t\t\t\t\t\tactionRunner: this.actionRunner,\n\t\t\t\t\t\t\tkeybindingProvider: this.options.getKeyBinding,\n\t\t\t\t\t\t\tclassNames: ThemeIcon.asClassNameArray(options.moreIcon ?? Codicon.toolBarMore),\n\t\t\t\t\t\t\tanchorAlignmentProvider: this.options.anchorAlignmentProvider,\n\t\t\t\t\t\t\tmenuAsChild: !!this.options.renderDropdownAsChildElement,\n\t\t\t\t\t\t\tskipTelemetry: this.options.skipTelemetry,\n\t\t\t\t\t\t\tisMenu: true,\n\t\t\t\t\t\t\thoverDelegate: this.options.hoverDelegate\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tthis.toggleMenuActionViewItem.setActionContext(this.actionBar.context);\n\t\t\t\t\tthis.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility));\n\n\t\t\t\t\treturn this.toggleMenuActionViewItem;\n\t\t\t\t}\n\n\t\t\t\tif (options.actionViewItemProvider) {\n\t\t\t\t\tconst result = options.actionViewItemProvider(action, viewItemOptions);\n\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (action instanceof SubmenuAction) {\n\t\t\t\t\tconst result = new DropdownMenuActionViewItem(\n\t\t\t\t\t\taction,\n\t\t\t\t\t\taction.actions,\n\t\t\t\t\t\tcontextMenuProvider,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tactionViewItemProvider: this.options.actionViewItemProvider,\n\t\t\t\t\t\t\tactionRunner: this.actionRunner,\n\t\t\t\t\t\t\tkeybindingProvider: this.options.getKeyBinding,\n\t\t\t\t\t\t\tclassNames: action.class,\n\t\t\t\t\t\t\tanchorAlignmentProvider: this.options.anchorAlignmentProvider,\n\t\t\t\t\t\t\tmenuAsChild: !!this.options.renderDropdownAsChildElement,\n\t\t\t\t\t\t\tskipTelemetry: this.options.skipTelemetry,\n\t\t\t\t\t\t\thoverDelegate: this.options.hoverDelegate\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tresult.setActionContext(this.actionBar.context);\n\t\t\t\t\tthis.submenuActionViewItems.push(result);\n\t\t\t\t\tthis.disposables.add(this._onDidChangeDropdownVisibility.add(result.onDidChangeVisibility));\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}));\n\n\t\t// Responsive support\n\t\tif (this.options.responsiveBehavior?.enabled) {\n\t\t\tthis.element.classList.add('responsive');\n\n\t\t\tconst observer = new ResizeObserver(() => {\n\t\t\t\tthis.updateActions(this.element.getBoundingClientRect().width);\n\t\t\t});\n\t\t\tobserver.observe(this.element);\n\t\t\tthis._store.add(toDisposable(() => observer.disconnect()));\n\t\t}\n\t}\n\n\tset actionRunner(actionRunner: IActionRunner) {\n\t\tthis.actionBar.actionRunner = actionRunner;\n\t}\n\n\tget actionRunner(): IActionRunner {\n\t\treturn this.actionBar.actionRunner;\n\t}\n\n\tset context(context: unknown) {\n\t\tthis.actionBar.context = context;\n\t\tthis.toggleMenuActionViewItem?.setActionContext(context);\n\t\tfor (const actionViewItem of this.submenuActionViewItems) {\n\t\t\tactionViewItem.setActionContext(context);\n\t\t}\n\t}\n\n\tgetElement(): HTMLElement {\n\t\treturn this.element;\n\t}\n\n\tgetItemAction(indexOrElement: number | HTMLElement) {\n\t\treturn this.actionBar.getAction(indexOrElement);\n\t}\n\n\tgetItemWidth(index: number): number {\n\t\treturn this.actionBar.getWidth(index);\n\t}\n\n\tsetActions(primaryActions: ReadonlyArray<IAction>, secondaryActions?: ReadonlyArray<IAction>): void {\n\t\tthis.clear();\n\n\t\t// Store primary and secondary actions as rendered initially\n\t\tthis.originalPrimaryActions = primaryActions ? primaryActions.slice(0) : [];\n\t\tthis.originalSecondaryActions = secondaryActions ? secondaryActions.slice(0) : [];\n\n\t\tconst primaryActionsToSet = primaryActions ? primaryActions.slice(0) : [];\n\n\t\t// Inject additional action to open secondary actions if present\n\t\tthis.hasSecondaryActions = !!(secondaryActions && secondaryActions.length > 0);\n\t\tif (this.hasSecondaryActions && secondaryActions) {\n\t\t\tthis.toggleMenuAction.menuActions = secondaryActions.slice(0);\n\t\t\tprimaryActionsToSet.push(this.toggleMenuAction);\n\t\t}\n\n\t\tif (primaryActionsToSet.length > 0 && this.options.trailingSeparator) {\n\t\t\tprimaryActionsToSet.push(new Separator());\n\t\t}\n\n\t\tprimaryActionsToSet.forEach(action => {\n\t\t\tthis.actionBar.push(action, { icon: this.options.icon ?? true, label: this.options.label ?? false, keybinding: this.getKeybindingLabel(action) });\n\t\t});\n\n\t\tif (this.options.responsiveBehavior?.enabled) {\n\t\t\t// Reset hidden actions\n\t\t\tthis.hiddenActions.length = 0;\n\n\t\t\t// Set the minimum width\n\t\t\tif (this.options.responsiveBehavior?.minItems !== undefined) {\n\t\t\t\tlet itemCount = this.options.responsiveBehavior.minItems;\n\n\t\t\t\t// Account for overflow menu\n\t\t\t\tif (\n\t\t\t\t\tthis.originalSecondaryActions.length > 0 ||\n\t\t\t\t\titemCount < this.originalPrimaryActions.length\n\t\t\t\t) {\n\t\t\t\t\titemCount += 1;\n\t\t\t\t}\n\n\t\t\t\tthis.container.style.minWidth = `${itemCount * ACTION_MIN_WIDTH}px`;\n\t\t\t\tthis.element.style.minWidth = `${itemCount * ACTION_MIN_WIDTH}px`;\n\t\t\t} else {\n\t\t\t\tthis.container.style.minWidth = `${ACTION_MIN_WIDTH}px`;\n\t\t\t\tthis.element.style.minWidth = `${ACTION_MIN_WIDTH}px`;\n\t\t\t}\n\n\t\t\t// Update toolbar actions to fit with container width\n\t\t\tthis.updateActions(this.element.getBoundingClientRect().width);\n\t\t}\n\t}\n\n\tprivate getKeybindingLabel(action: IAction): string | undefined {\n\t\tconst key = this.options.getKeyBinding?.(action);\n\n\t\treturn key?.getLabel() ?? undefined;\n\t}\n\n\tprivate updateActions(containerWidth: number) {\n\t\t// Actions bar is empty\n\t\tif (this.actionBar.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Each action is assumed to have a minimum width so that actions with a label\n\t\t// can shrink to the action's minimum width. We do this so that action visibility\n\t\t// takes precedence over the action label.\n\t\tconst actionBarWidth = () => this.actionBar.length() * ACTION_MIN_WIDTH;\n\n\t\t// Action bar fits and there are no hidden actions to show\n\t\tif (actionBarWidth() <= containerWidth && this.hiddenActions.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (actionBarWidth() > containerWidth) {\n\t\t\t// Check for max items limit\n\t\t\tif (this.options.responsiveBehavior?.minItems !== undefined) {\n\t\t\t\tconst primaryActionsCount = this.actionBar.hasAction(this.toggleMenuAction)\n\t\t\t\t\t? this.actionBar.length() - 1\n\t\t\t\t\t: this.actionBar.length();\n\n\t\t\t\tif (primaryActionsCount <= this.options.responsiveBehavior.minItems) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Hide actions from the right\n\t\t\twhile (actionBarWidth() > containerWidth && this.actionBar.length() > 0) {\n\t\t\t\tconst index = this.originalPrimaryActions.length - this.hiddenActions.length - 1;\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Store the action and its size\n\t\t\t\tconst size = Math.min(ACTION_MIN_WIDTH, this.getItemWidth(index));\n\t\t\t\tconst action = this.originalPrimaryActions[index];\n\t\t\t\tthis.hiddenActions.unshift({ action, size });\n\n\t\t\t\t// Remove the action\n\t\t\t\tthis.actionBar.pull(index);\n\n\t\t\t\t// There are no secondary actions, but we have actions that we need to hide so we\n\t\t\t\t// create the overflow menu. This will ensure that another primary action will be\n\t\t\t\t// removed making space for the overflow menu.\n\t\t\t\tif (this.originalSecondaryActions.length === 0 && this.hiddenActions.length === 1) {\n\t\t\t\t\tthis.actionBar.push(this.toggleMenuAction, {\n\t\t\t\t\t\ticon: this.options.icon ?? true,\n\t\t\t\t\t\tlabel: this.options.label ?? false,\n\t\t\t\t\t\tkeybinding: this.getKeybindingLabel(this.toggleMenuAction),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Show actions from the top of the toggle menu\n\t\t\twhile (this.hiddenActions.length > 0) {\n\t\t\t\tconst entry = this.hiddenActions.shift()!;\n\t\t\t\tif (actionBarWidth() + entry.size > containerWidth) {\n\t\t\t\t\t// Not enough space to show the action\n\t\t\t\t\tthis.hiddenActions.unshift(entry);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Add the action\n\t\t\t\tthis.actionBar.push(entry.action, {\n\t\t\t\t\ticon: this.options.icon ?? true,\n\t\t\t\t\tlabel: this.options.label ?? false,\n\t\t\t\t\tkeybinding: this.getKeybindingLabel(entry.action),\n\t\t\t\t\tindex: this.originalPrimaryActions.length - this.hiddenActions.length - 1\n\t\t\t\t});\n\n\t\t\t\t// There are no secondary actions, and there is only one hidden item left so we\n\t\t\t\t// remove the overflow menu making space for the last hidden action to be shown.\n\t\t\t\tif (this.originalSecondaryActions.length === 0 && this.hiddenActions.length === 1) {\n\t\t\t\t\tthis.toggleMenuAction.menuActions = [];\n\t\t\t\t\tthis.actionBar.pull(this.actionBar.length() - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update overflow menu\n\t\tconst hiddenActions = this.hiddenActions.map(entry => entry.action);\n\t\tif (this.originalSecondaryActions.length > 0 || hiddenActions.length > 0) {\n\t\t\tconst secondaryActions = this.originalSecondaryActions.slice(0);\n\t\t\tthis.toggleMenuAction.menuActions = Separator.join(hiddenActions, secondaryActions);\n\t\t}\n\t}\n\n\tprivate clear(): void {\n\t\tthis.submenuActionViewItems = [];\n\t\tthis.disposables.clear();\n\t\tthis.actionBar.clear();\n\t}\n\n\toverride dispose(): void {\n\t\tthis.clear();\n\t\tthis.disposables.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport class ToggleMenuAction extends Action {\n\n\tstatic readonly ID = 'toolbar.toggle.more';\n\n\tprivate _menuActions: ReadonlyArray<IAction>;\n\tprivate toggleDropdownMenu: () => void;\n\n\tconstructor(toggleDropdownMenu: () => void, title?: string) {\n\t\ttitle = title || nls.localize('moreActions', \"More Actions...\");\n\t\tsuper(ToggleMenuAction.ID, title, undefined, true);\n\n\t\tthis._menuActions = [];\n\t\tthis.toggleDropdownMenu = toggleDropdownMenu;\n\t}\n\n\toverride async run(): Promise<void> {\n\t\tthis.toggleDropdownMenu();\n\t}\n\n\tget menuActions(): ReadonlyArray<IAction> {\n\t\treturn this._menuActions;\n\t}\n\n\tset menuActions(actions: ReadonlyArray<IAction>) {\n\t\tthis._menuActions = actions;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["vs/base/browser/ui/toolbar/toolbar.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OA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ACvB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,CAAC;IAEQ,KAAK,CAAC,GAAG;QACjB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED,IAAI,WAAW,CAAC,OAA+B;QAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;IAC7B,CAAC","file":"toolbar.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IContextMenuProvider } from '../../contextmenu.js';\nimport { ActionBar, ActionsOrientation, IActionViewItemProvider } from '../actionbar/actionbar.js';\nimport { AnchorAlignment } from '../contextview/contextview.js';\nimport { DropdownMenuActionViewItem } from '../dropdown/dropdownActionViewItem.js';\nimport { Action, IAction, IActionRunner, Separator, SubmenuAction } from '../../../common/actions.js';\nimport { Codicon } from '../../../common/codicons.js';\nimport { ThemeIcon } from '../../../common/themables.js';\nimport { EventMultiplexer } from '../../../common/event.js';\nimport { ResolvedKeybinding } from '../../../common/keybindings.js';\nimport { Disposable, DisposableStore, toDisposable } from '../../../common/lifecycle.js';\nimport './toolbar.css';\nimport * as nls from '../../../../nls.js';\nimport { IHoverDelegate } from '../hover/hoverDelegate.js';\nimport { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js';\n\nconst ACTION_MIN_WIDTH = 24; /* 20px codicon + 4px left padding*/\n\nexport interface IToolBarOptions {\n\torientation?: ActionsOrientation;\n\tactionViewItemProvider?: IActionViewItemProvider;\n\tariaLabel?: string;\n\tgetKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;\n\tactionRunner?: IActionRunner;\n\ttoggleMenuTitle?: string;\n\tanchorAlignmentProvider?: () => AnchorAlignment;\n\trenderDropdownAsChildElement?: boolean;\n\tmoreIcon?: ThemeIcon;\n\tallowContextMenu?: boolean;\n\tskipTelemetry?: boolean;\n\thoverDelegate?: IHoverDelegate;\n\ttrailingSeparator?: boolean;\n\n\t/**\n\t * If true, toggled primary items are highlighted with a background color.\n\t */\n\thighlightToggledItems?: boolean;\n\n\t/**\n\t * Render action with icons (default: `true`)\n\t */\n\ticon?: boolean;\n\n\t/**\n\t * Render action with label (default: `false`)\n\t */\n\tlabel?: boolean;\n\n\t/**\n\t * Controls the responsive behavior of the primary group of the toolbar.\n\t * - `enabled`: Whether the responsive behavior is enabled.\n\t * - `minItems`: The minimum number of items that should always be visible.\n\t */\n\tresponsiveBehavior?: { enabled: boolean; minItems?: number };\n}\n\n/**\n * A widget that combines an action bar for primary actions and a dropdown for secondary actions.\n */\nexport class ToolBar extends Disposable {\n\tprivate options: IToolBarOptions;\n\tprotected readonly actionBar: ActionBar;\n\tprivate toggleMenuAction: ToggleMenuAction;\n\tprivate toggleMenuActionViewItem: DropdownMenuActionViewItem | undefined;\n\tprivate submenuActionViewItems: DropdownMenuActionViewItem[] = [];\n\tprivate hasSecondaryActions: boolean = false;\n\tprivate readonly element: HTMLElement;\n\n\tprivate _onDidChangeDropdownVisibility = this._register(new EventMultiplexer<boolean>());\n\tget onDidChangeDropdownVisibility() { return this._onDidChangeDropdownVisibility.event; }\n\tprivate originalPrimaryActions: ReadonlyArray<IAction> = [];\n\tprivate originalSecondaryActions: ReadonlyArray<IAction> = [];\n\tprivate hiddenActions: { action: IAction; size: number }[] = [];\n\tprivate readonly disposables = this._register(new DisposableStore());\n\n\tconstructor(private readonly container: HTMLElement, contextMenuProvider: IContextMenuProvider, options: IToolBarOptions = { orientation: ActionsOrientation.HORIZONTAL }) {\n\t\tsuper();\n\n\t\toptions.hoverDelegate = options.hoverDelegate ?? this._register(createInstantHoverDelegate());\n\t\tthis.options = options;\n\n\t\tthis.toggleMenuAction = this._register(new ToggleMenuAction(() => this.toggleMenuActionViewItem?.show(), options.toggleMenuTitle));\n\n\t\tthis.element = document.createElement('div');\n\t\tthis.element.className = 'monaco-toolbar';\n\t\tcontainer.appendChild(this.element);\n\n\t\tthis.actionBar = this._register(new ActionBar(this.element, {\n\t\t\torientation: options.orientation,\n\t\t\tariaLabel: options.ariaLabel,\n\t\t\tactionRunner: options.actionRunner,\n\t\t\tallowContextMenu: options.allowContextMenu,\n\t\t\thighlightToggledItems: options.highlightToggledItems,\n\t\t\thoverDelegate: options.hoverDelegate,\n\t\t\tactionViewItemProvider: (action, viewItemOptions) => {\n\t\t\t\tif (action.id === ToggleMenuAction.ID) {\n\t\t\t\t\tthis.toggleMenuActionViewItem = new DropdownMenuActionViewItem(\n\t\t\t\t\t\taction,\n\t\t\t\t\t\t{ getActions: () => this.toggleMenuAction.menuActions },\n\t\t\t\t\t\tcontextMenuProvider,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tactionViewItemProvider: this.options.actionViewItemProvider,\n\t\t\t\t\t\t\tactionRunner: this.actionRunner,\n\t\t\t\t\t\t\tkeybindingProvider: this.options.getKeyBinding,\n\t\t\t\t\t\t\tclassNames: ThemeIcon.asClassNameArray(options.moreIcon ?? Codicon.toolBarMore),\n\t\t\t\t\t\t\tanchorAlignmentProvider: this.options.anchorAlignmentProvider,\n\t\t\t\t\t\t\tmenuAsChild: !!this.options.renderDropdownAsChildElement,\n\t\t\t\t\t\t\tskipTelemetry: this.options.skipTelemetry,\n\t\t\t\t\t\t\tisMenu: true,\n\t\t\t\t\t\t\thoverDelegate: this.options.hoverDelegate\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tthis.toggleMenuActionViewItem.setActionContext(this.actionBar.context);\n\t\t\t\t\tthis.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility));\n\n\t\t\t\t\treturn this.toggleMenuActionViewItem;\n\t\t\t\t}\n\n\t\t\t\tif (options.actionViewItemProvider) {\n\t\t\t\t\tconst result = options.actionViewItemProvider(action, viewItemOptions);\n\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (action instanceof SubmenuAction) {\n\t\t\t\t\tconst result = new DropdownMenuActionViewItem(\n\t\t\t\t\t\taction,\n\t\t\t\t\t\taction.actions,\n\t\t\t\t\t\tcontextMenuProvider,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tactionViewItemProvider: this.options.actionViewItemProvider,\n\t\t\t\t\t\t\tactionRunner: this.actionRunner,\n\t\t\t\t\t\t\tkeybindingProvider: this.options.getKeyBinding,\n\t\t\t\t\t\t\tclassNames: action.class,\n\t\t\t\t\t\t\tanchorAlignmentProvider: this.options.anchorAlignmentProvider,\n\t\t\t\t\t\t\tmenuAsChild: !!this.options.renderDropdownAsChildElement,\n\t\t\t\t\t\t\tskipTelemetry: this.options.skipTelemetry,\n\t\t\t\t\t\t\thoverDelegate: this.options.hoverDelegate\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tresult.setActionContext(this.actionBar.context);\n\t\t\t\t\tthis.submenuActionViewItems.push(result);\n\t\t\t\t\tthis.disposables.add(this._onDidChangeDropdownVisibility.add(result.onDidChangeVisibility));\n\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}));\n\n\t\t// Responsive support\n\t\tif (this.options.responsiveBehavior?.enabled) {\n\t\t\tthis.element.classList.add('responsive');\n\n\t\t\tconst observer = new ResizeObserver(() => {\n\t\t\t\tthis.updateActions(this.element.getBoundingClientRect().width);\n\t\t\t});\n\t\t\tobserver.observe(this.element);\n\t\t\tthis._store.add(toDisposable(() => observer.disconnect()));\n\t\t}\n\t}\n\n\tset actionRunner(actionRunner: IActionRunner) {\n\t\tthis.actionBar.actionRunner = actionRunner;\n\t}\n\n\tget actionRunner(): IActionRunner {\n\t\treturn this.actionBar.actionRunner;\n\t}\n\n\tset context(context: unknown) {\n\t\tthis.actionBar.context = context;\n\t\tthis.toggleMenuActionViewItem?.setActionContext(context);\n\t\tfor (const actionViewItem of this.submenuActionViewItems) {\n\t\t\tactionViewItem.setActionContext(context);\n\t\t}\n\t}\n\n\tgetElement(): HTMLElement {\n\t\treturn this.element;\n\t}\n\n\tgetItemAction(indexOrElement: number | HTMLElement) {\n\t\treturn this.actionBar.getAction(indexOrElement);\n\t}\n\n\tgetItemWidth(index: number): number {\n\t\treturn this.actionBar.getWidth(index);\n\t}\n\n\tsetActions(primaryActions: ReadonlyArray<IAction>, secondaryActions?: ReadonlyArray<IAction>): void {\n\t\tthis.clear();\n\n\t\t// Store primary and secondary actions as rendered initially\n\t\tthis.originalPrimaryActions = primaryActions ? primaryActions.slice(0) : [];\n\t\tthis.originalSecondaryActions = secondaryActions ? secondaryActions.slice(0) : [];\n\n\t\tconst primaryActionsToSet = primaryActions ? primaryActions.slice(0) : [];\n\n\t\t// Inject additional action to open secondary actions if present\n\t\tthis.hasSecondaryActions = !!(secondaryActions && secondaryActions.length > 0);\n\t\tif (this.hasSecondaryActions && secondaryActions) {\n\t\t\tthis.toggleMenuAction.menuActions = secondaryActions.slice(0);\n\t\t\tprimaryActionsToSet.push(this.toggleMenuAction);\n\t\t}\n\n\t\tif (primaryActionsToSet.length > 0 && this.options.trailingSeparator) {\n\t\t\tprimaryActionsToSet.push(new Separator());\n\t\t}\n\n\t\tprimaryActionsToSet.forEach(action => {\n\t\t\tthis.actionBar.push(action, { icon: this.options.icon ?? true, label: this.options.label ?? false, keybinding: this.getKeybindingLabel(action) });\n\t\t});\n\n\t\tif (this.options.responsiveBehavior?.enabled) {\n\t\t\t// Reset hidden actions\n\t\t\tthis.hiddenActions.length = 0;\n\n\t\t\t// Set the minimum width\n\t\t\tif (this.options.responsiveBehavior?.minItems !== undefined) {\n\t\t\t\tlet itemCount = this.options.responsiveBehavior.minItems;\n\n\t\t\t\t// Account for overflow menu\n\t\t\t\tif (\n\t\t\t\t\tthis.originalSecondaryActions.length > 0 ||\n\t\t\t\t\titemCount < this.originalPrimaryActions.length\n\t\t\t\t) {\n\t\t\t\t\titemCount += 1;\n\t\t\t\t}\n\n\t\t\t\tthis.container.style.minWidth = `${itemCount * ACTION_MIN_WIDTH}px`;\n\t\t\t\tthis.element.style.minWidth = `${itemCount * ACTION_MIN_WIDTH}px`;\n\t\t\t} else {\n\t\t\t\tthis.container.style.minWidth = `${ACTION_MIN_WIDTH}px`;\n\t\t\t\tthis.element.style.minWidth = `${ACTION_MIN_WIDTH}px`;\n\t\t\t}\n\n\t\t\t// Update toolbar actions to fit with container width\n\t\t\tthis.updateActions(this.element.getBoundingClientRect().width);\n\t\t}\n\t}\n\n\tprivate getKeybindingLabel(action: IAction): string | undefined {\n\t\tconst key = this.options.getKeyBinding?.(action);\n\n\t\treturn key?.getLabel() ?? undefined;\n\t}\n\n\tprivate updateActions(containerWidth: number) {\n\t\t// Actions bar is empty\n\t\tif (this.actionBar.isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure that the container width respects the minimum width of the\n\t\t// element which is set based on the `responsiveBehavior.minItems` option\n\t\tcontainerWidth = Math.max(containerWidth, parseInt(this.element.style.minWidth));\n\n\t\t// Each action is assumed to have a minimum width so that actions with a label\n\t\t// can shrink to the action's minimum width. We do this so that action visibility\n\t\t// takes precedence over the action label.\n\t\tconst actionBarWidth = () => this.actionBar.length() * ACTION_MIN_WIDTH;\n\n\t\t// Action bar fits and there are no hidden actions to show\n\t\tif (actionBarWidth() <= containerWidth && this.hiddenActions.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (actionBarWidth() > containerWidth) {\n\t\t\t// Check for max items limit\n\t\t\tif (this.options.responsiveBehavior?.minItems !== undefined) {\n\t\t\t\tconst primaryActionsCount = this.actionBar.hasAction(this.toggleMenuAction)\n\t\t\t\t\t? this.actionBar.length() - 1\n\t\t\t\t\t: this.actionBar.length();\n\n\t\t\t\tif (primaryActionsCount <= this.options.responsiveBehavior.minItems) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Hide actions from the right\n\t\t\twhile (actionBarWidth() > containerWidth && this.actionBar.length() > 0) {\n\t\t\t\tconst index = this.originalPrimaryActions.length - this.hiddenActions.length - 1;\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Store the action and its size\n\t\t\t\tconst size = Math.min(ACTION_MIN_WIDTH, this.getItemWidth(index));\n\t\t\t\tconst action = this.originalPrimaryActions[index];\n\t\t\t\tthis.hiddenActions.unshift({ action, size });\n\n\t\t\t\t// Remove the action\n\t\t\t\tthis.actionBar.pull(index);\n\n\t\t\t\t// There are no secondary actions, but we have actions that we need to hide so we\n\t\t\t\t// create the overflow menu. This will ensure that another primary action will be\n\t\t\t\t// removed making space for the overflow menu.\n\t\t\t\tif (this.originalSecondaryActions.length === 0 && this.hiddenActions.length === 1) {\n\t\t\t\t\tthis.actionBar.push(this.toggleMenuAction, {\n\t\t\t\t\t\ticon: this.options.icon ?? true,\n\t\t\t\t\t\tlabel: this.options.label ?? false,\n\t\t\t\t\t\tkeybinding: this.getKeybindingLabel(this.toggleMenuAction),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Show actions from the top of the toggle menu\n\t\t\twhile (this.hiddenActions.length > 0) {\n\t\t\t\tconst entry = this.hiddenActions.shift()!;\n\t\t\t\tif (actionBarWidth() + entry.size > containerWidth) {\n\t\t\t\t\t// Not enough space to show the action\n\t\t\t\t\tthis.hiddenActions.unshift(entry);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Add the action\n\t\t\t\tthis.actionBar.push(entry.action, {\n\t\t\t\t\ticon: this.options.icon ?? true,\n\t\t\t\t\tlabel: this.options.label ?? false,\n\t\t\t\t\tkeybinding: this.getKeybindingLabel(entry.action),\n\t\t\t\t\tindex: this.originalPrimaryActions.length - this.hiddenActions.length - 1\n\t\t\t\t});\n\n\t\t\t\t// There are no secondary actions, and there is only one hidden item left so we\n\t\t\t\t// remove the overflow menu making space for the last hidden action to be shown.\n\t\t\t\tif (this.originalSecondaryActions.length === 0 && this.hiddenActions.length === 1) {\n\t\t\t\t\tthis.toggleMenuAction.menuActions = [];\n\t\t\t\t\tthis.actionBar.pull(this.actionBar.length() - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Update overflow menu\n\t\tconst hiddenActions = this.hiddenActions.map(entry => entry.action);\n\t\tif (this.originalSecondaryActions.length > 0 || hiddenActions.length > 0) {\n\t\t\tconst secondaryActions = this.originalSecondaryActions.slice(0);\n\t\t\tthis.toggleMenuAction.menuActions = Separator.join(hiddenActions, secondaryActions);\n\t\t}\n\t}\n\n\tprivate clear(): void {\n\t\tthis.submenuActionViewItems = [];\n\t\tthis.disposables.clear();\n\t\tthis.actionBar.clear();\n\t}\n\n\toverride dispose(): void {\n\t\tthis.clear();\n\t\tthis.disposables.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport class ToggleMenuAction extends Action {\n\n\tstatic readonly ID = 'toolbar.toggle.more';\n\n\tprivate _menuActions: ReadonlyArray<IAction>;\n\tprivate toggleDropdownMenu: () => void;\n\n\tconstructor(toggleDropdownMenu: () => void, title?: string) {\n\t\ttitle = title || nls.localize('moreActions', \"More Actions...\");\n\t\tsuper(ToggleMenuAction.ID, title, undefined, true);\n\n\t\tthis._menuActions = [];\n\t\tthis.toggleDropdownMenu = toggleDropdownMenu;\n\t}\n\n\toverride async run(): Promise<void> {\n\t\tthis.toggleDropdownMenu();\n\t}\n\n\tget menuActions(): ReadonlyArray<IAction> {\n\t\treturn this._menuActions;\n\t}\n\n\tset menuActions(actions: ReadonlyArray<IAction>) {\n\t\tthis._menuActions = actions;\n\t}\n}\n"]}
|
|
@@ -85,6 +85,17 @@ export function raceCancellationError(promise, token) {
|
|
|
85
85
|
promise.then(resolve, reject).finally(() => ref.dispose());
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
+
export function raceTimeout(promise, timeout, onTimeout) {
|
|
89
|
+
let promiseResolve = undefined;
|
|
90
|
+
const timer = setTimeout(() => {
|
|
91
|
+
promiseResolve?.(undefined);
|
|
92
|
+
onTimeout?.();
|
|
93
|
+
}, timeout);
|
|
94
|
+
return Promise.race([
|
|
95
|
+
promise.finally(() => clearTimeout(timer)),
|
|
96
|
+
new Promise(resolve => promiseResolve = resolve)
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
88
99
|
/**
|
|
89
100
|
* A helper to prevent accumulation of sequential async tasks.
|
|
90
101
|
*
|