{"version":3,"file":"MonacoQueryField.cjs","sources":["../../../../src/components/monaco-query-field/MonacoQueryField.tsx"],"sourcesContent":["// Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryField.tsx\nimport { css } from '@emotion/css';\nimport { parser } from '@prometheus-io/lezer-promql';\nimport { promLanguageDefinition } from 'monaco-promql';\nimport { useEffect, useRef } from 'react';\nimport { useLatest } from 'react-use';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { type GrafanaTheme2 } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { type Monaco, type monacoTypes, ReactMonacoEditor, useTheme2 } from '@grafana/ui';\n\nimport { type Props } from './MonacoQueryFieldProps';\nimport { getOverrideServices } from './getOverrideServices';\nimport { DataProvider } from './monaco-completion-provider/data_provider';\nimport { getCompletionProvider, getSuggestOptions } from './monaco-completion-provider/monaco-completion-provider';\nimport { placeHolderScopedVars, validateQuery } from './monaco-completion-provider/validation';\nimport { language, languageConfiguration } from './promql';\n\nconst options: monacoTypes.editor.IStandaloneEditorConstructionOptions = {\n  codeLens: false,\n  contextmenu: false,\n  // we need `fixedOverflowWidgets` because otherwise in grafana-dashboards\n  // the popup is clipped by the panel-visualizations.\n  fixedOverflowWidgets: true,\n  folding: false,\n  fontSize: 14,\n  lineDecorationsWidth: 8, // used as \"padding-left\"\n  lineNumbers: 'off',\n  minimap: { enabled: false },\n  overviewRulerBorder: false,\n  overviewRulerLanes: 0,\n  padding: {\n    // these numbers were picked so that visually this matches the previous version\n    // of the query-editor the best\n    top: 4,\n    bottom: 5,\n  },\n  renderLineHighlight: 'none',\n  scrollbar: {\n    vertical: 'hidden',\n    verticalScrollbarSize: 8, // used as \"padding-right\"\n    horizontal: 'hidden',\n    horizontalScrollbarSize: 0,\n    alwaysConsumeMouseWheel: false,\n  },\n  scrollBeyondLastLine: false,\n  suggest: getSuggestOptions(),\n  suggestFontSize: 12,\n  wordWrap: 'on',\n  quickSuggestionsDelay: 250,\n};\n\n// this number was chosen by testing various values. it might be necessary\n// because of the width of the border, not sure.\n//it needs to do 2 things:\n// 1. when the editor is single-line, it should make the editor height be visually correct\n// 2. when the editor is multi-line, the editor should not be \"scrollable\" (meaning,\n//    you do a scroll-movement in the editor, and it will scroll the content by a couple pixels\n//    up & down. this we want to avoid)\nconst EDITOR_HEIGHT_OFFSET = 2;\n\nconst PROMQL_LANG_ID = promLanguageDefinition.id;\n\n// we must only run the promql-setup code once\nlet PROMQL_SETUP_STARTED = false;\n\nfunction ensurePromQL(monaco: Monaco) {\n  if (PROMQL_SETUP_STARTED === false) {\n    PROMQL_SETUP_STARTED = true;\n    const { aliases, extensions, mimetypes } = promLanguageDefinition;\n    monaco.languages.register({ id: PROMQL_LANG_ID, aliases, extensions, mimetypes });\n\n    // @ts-ignore\n    monaco.languages.setMonarchTokensProvider(PROMQL_LANG_ID, language);\n    // @ts-ignore\n    monaco.languages.setLanguageConfiguration(PROMQL_LANG_ID, languageConfiguration);\n  }\n}\n\nconst getStyles = (theme: GrafanaTheme2, placeholder: string) => {\n  return {\n    container: css({\n      borderRadius: theme.shape.radius.default,\n      border: `1px solid ${theme.components.input.borderColor}`,\n      display: 'flex',\n      flexDirection: 'row',\n      justifyContent: 'start',\n      alignItems: 'center',\n      height: '100%',\n      overflow: 'hidden',\n    }),\n    placeholder: css({\n      '::after': {\n        content: `'${placeholder}'`,\n        fontFamily: theme.typography.fontFamilyMonospace,\n        opacity: 0.6,\n      },\n    }),\n  };\n};\n\nconst MonacoQueryField = (props: Props) => {\n  const id = uuidv4();\n\n  // we need only one instance of `overrideServices` during the lifetime of the react component\n  const overrideServicesRef = useRef(getOverrideServices());\n  const containerRef = useRef<HTMLDivElement>(null);\n  const { languageProvider, history, onBlur, onRunQuery, initialValue, placeholder, datasource, timeRange } = props;\n\n  const lpRef = useLatest(languageProvider);\n  const historyRef = useLatest(history);\n  const onRunQueryRef = useLatest(onRunQuery);\n  const onBlurRef = useLatest(onBlur);\n\n  const autocompleteDisposeFun = useRef<(() => void) | null>(null);\n\n  const theme = useTheme2();\n  const styles = getStyles(theme, placeholder);\n\n  useEffect(() => {\n    // when we unmount, we unregister the autocomplete-function, if it was registered\n    return () => {\n      autocompleteDisposeFun.current?.();\n    };\n  }, []);\n\n  return (\n    <div\n      data-testid={selectors.components.QueryField.container}\n      className={styles.container}\n      // NOTE: we will be setting inline-style-width/height on this element\n      ref={containerRef}\n    >\n      <ReactMonacoEditor\n        // see https://github.com/suren-atoyan/monaco-react/issues/365\n        saveViewState\n        overrideServices={overrideServicesRef.current}\n        options={options}\n        language=\"promql\"\n        value={initialValue}\n        beforeMount={(monaco) => {\n          ensurePromQL(monaco);\n        }}\n        onMount={(editor, monaco) => {\n          const isEditorFocused = editor.createContextKey<boolean>('isEditorFocused' + id, false);\n          // we setup on-blur\n          editor.onDidBlurEditorWidget(() => {\n            isEditorFocused.set(false);\n            onBlurRef.current(editor.getValue());\n          });\n          editor.onDidFocusEditorText(() => {\n            isEditorFocused.set(true);\n          });\n          const dataProvider = new DataProvider({\n            historyProvider: historyRef.current,\n            languageProvider: lpRef.current,\n          });\n\n          // Create completion provider with state for Ctrl+Space detection\n          const { provider: completionProvider, state: completionState } = getCompletionProvider(\n            monaco,\n            dataProvider,\n            timeRange\n          );\n\n          // completion-providers in monaco are not registered directly to editor-instances,\n          // they are registered to languages. this makes it hard for us to have\n          // separate completion-providers for every query-field-instance\n          // (but we need that, because they might connect to different datasources).\n          // the trick we do is, we wrap the callback in a \"proxy\",\n          // and in the proxy, the first thing is, we check if we are called from\n          // \"our editor instance\", and if not, we just return nothing. if yes,\n          // we call the completion-provider.\n          const filteringCompletionProvider: monacoTypes.languages.CompletionItemProvider = {\n            ...completionProvider,\n            provideCompletionItems: (model, position, context, token) => {\n              // if the model-id does not match, then this call is from a different editor-instance,\n              // not \"our instance\", so return nothing\n              if (editor.getModel()?.id !== model.id) {\n                return { suggestions: [] };\n              }\n              return completionProvider.provideCompletionItems(model, position, context, token);\n            },\n          };\n\n          const { dispose } = monaco.languages.registerCompletionItemProvider(\n            PROMQL_LANG_ID,\n            filteringCompletionProvider\n          );\n\n          const handleKeyDown = (event: KeyboardEvent) => {\n            if ((event.ctrlKey || event.metaKey) && event.code === 'Space') {\n              // Only handle if this editor is focused\n              if (editor.hasTextFocus()) {\n                event.preventDefault();\n                event.stopPropagation();\n\n                completionState.isManualTriggerRequested = true;\n                editor.trigger('keyboard', 'editor.action.triggerSuggest', {});\n                setTimeout(() => {\n                  completionState.isManualTriggerRequested = false;\n                }, 300);\n              }\n            }\n          };\n\n          // Add global listener\n          document.addEventListener('keydown', handleKeyDown, true);\n\n          // Combine cleanup functions\n          autocompleteDisposeFun.current = () => {\n            document.removeEventListener('keydown', handleKeyDown, true);\n            dispose();\n          };\n\n          // this code makes the editor resize itself so that the content fits\n          // (it will grow taller when necessary)\n          // FIXME: maybe move this functionality into CodeEditor, like:\n          // <CodeEditor resizingMode=\"single-line\"/>\n          const updateElementHeight = () => {\n            const containerDiv = containerRef.current;\n            if (containerDiv !== null) {\n              const pixelHeight = editor.getContentHeight();\n              containerDiv.style.height = `${pixelHeight + EDITOR_HEIGHT_OFFSET}px`;\n              containerDiv.style.width = '100%';\n              const pixelWidth = containerDiv.clientWidth;\n              editor.layout({ width: pixelWidth, height: pixelHeight });\n            }\n          };\n\n          editor.onDidContentSizeChange(updateElementHeight);\n          updateElementHeight();\n\n          // handle: shift + enter\n          // FIXME: maybe move this functionality into CodeEditor?\n          editor.addCommand(\n            monaco.KeyMod.Shift | monaco.KeyCode.Enter,\n            () => {\n              onRunQueryRef.current(editor.getValue());\n            },\n            'isEditorFocused' + id\n          );\n\n          // Fixes Monaco capturing the search key binding and displaying a useless search box within the Editor.\n          // See https://github.com/grafana/grafana/issues/85850\n          monaco.editor.addKeybindingRule({\n            keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyF,\n            command: null,\n          });\n\n          // Something in this configuration of monaco doesn't bubble up [mod]+K,\n          // which the command palette uses. Pass the event out of monaco manually\n          editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, function () {\n            global.dispatchEvent(new KeyboardEvent('keydown', { key: 'k', metaKey: true }));\n          });\n\n          if (placeholder) {\n            const placeholderDecorators = [\n              {\n                range: new monaco.Range(1, 1, 1, 1),\n                options: {\n                  className: styles.placeholder,\n                  isWholeLine: true,\n                },\n              },\n            ];\n\n            let decorators: string[] = [];\n\n            const checkDecorators: () => void = () => {\n              const model = editor.getModel();\n\n              if (!model) {\n                return;\n              }\n\n              const newDecorators = model.getValueLength() === 0 ? placeholderDecorators : [];\n              decorators = model.deltaDecorations(decorators, newDecorators);\n            };\n\n            checkDecorators();\n            editor.onDidChangeModelContent(checkDecorators);\n\n            editor.onDidChangeModelContent((e) => {\n              const model = editor.getModel();\n              if (!model) {\n                return;\n              }\n              const query = model.getValue();\n              const { errors, warnings } = validateQuery(\n                query,\n                datasource.interpolateString(query, placeHolderScopedVars),\n                model.getLinesContent(),\n                parser\n              );\n\n              const errorMarkers = errors.map(({ issue, ...boundary }) => {\n                return {\n                  message: `${issue ? `Error parsing \"${issue}\"` : 'Parse error'}. The query appears to be incorrect and could fail to be executed.`,\n                  severity: monaco.MarkerSeverity.Error,\n                  ...boundary,\n                };\n              });\n\n              const warningMarkers = warnings.map(({ issue, ...boundary }) => {\n                return {\n                  message: `Warning: ${issue}`,\n                  severity: monaco.MarkerSeverity.Warning,\n                  ...boundary,\n                };\n              });\n\n              monaco.editor.setModelMarkers(model, 'owner', [...errorMarkers, ...warningMarkers]);\n            });\n          }\n        }}\n      />\n    </div>\n  );\n};\n\n// we will lazy-load this module using React.lazy,\n// and that only supports default-exports,\n// so we have to default-export this, even if\n// it is against the style-guidelines.\n\nexport default MonacoQueryField;\n"],"names":["getSuggestOptions","promLanguageDefinition","language","languageConfiguration","css","uuidv4","useRef","getOverrideServices","useLatest","useTheme2","useEffect","jsx","selectors","ReactMonacoEditor","DataProvider","getCompletionProv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