@gooddata/sdk-ui-metric-component 11.67.0-alpha.2 → 11.67.0-alpha.3
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/NOTICE +943 -2401
- package/esm/MaqlEditor/codemirror/CodeEditor.d.ts +52 -0
- package/esm/MaqlEditor/codemirror/CodeEditor.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/CodeEditor.js +170 -0
- package/esm/MaqlEditor/codemirror/CodeEditor.styles.d.ts +95 -0
- package/esm/MaqlEditor/codemirror/CodeEditor.styles.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/CodeEditor.styles.js +536 -0
- package/esm/MaqlEditor/codemirror/ContextMenu.d.ts +52 -0
- package/esm/MaqlEditor/codemirror/ContextMenu.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/ContextMenu.js +204 -0
- package/esm/MaqlEditor/codemirror/baseExtensions.d.ts +22 -0
- package/esm/MaqlEditor/codemirror/baseExtensions.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/baseExtensions.js +95 -0
- package/esm/MaqlEditor/codemirror/commands.d.ts +21 -0
- package/esm/MaqlEditor/codemirror/commands.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/commands.js +98 -0
- package/esm/MaqlEditor/codemirror/hooks/useAutofocus.d.ts +7 -0
- package/esm/MaqlEditor/codemirror/hooks/useAutofocus.d.ts.map +1 -0
- package/esm/MaqlEditor/{monaco → codemirror}/hooks/useAutofocus.js +4 -0
- package/esm/MaqlEditor/codemirror/lsp.d.ts +28 -0
- package/esm/MaqlEditor/codemirror/lsp.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/lsp.js +70 -0
- package/esm/MaqlEditor/codemirror/markdown.d.ts +11 -0
- package/esm/MaqlEditor/codemirror/markdown.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/markdown.js +28 -0
- package/esm/MaqlEditor/codemirror/types.d.ts +8 -0
- package/esm/MaqlEditor/codemirror/types.d.ts.map +1 -0
- package/esm/MaqlEditor/codemirror/types.js +2 -0
- package/esm/MaqlEditor/hooks/useCodeTheme.d.ts +15 -2
- package/esm/MaqlEditor/hooks/useCodeTheme.d.ts.map +1 -1
- package/esm/MaqlEditor/hooks/useCodeTheme.js +36 -43
- package/esm/MaqlEditor/hooks/useCopyToClipboard.d.ts +7 -2
- package/esm/MaqlEditor/hooks/useCopyToClipboard.d.ts.map +1 -1
- package/esm/MaqlEditor/hooks/useCopyToClipboard.js +53 -10
- package/esm/MaqlEditor/maql/MaqlEditor.d.ts +25 -9
- package/esm/MaqlEditor/maql/MaqlEditor.d.ts.map +1 -1
- package/esm/MaqlEditor/maql/MaqlEditor.js +179 -30
- package/esm/MaqlEditor/maql/MaqlEditor.styles.d.ts.map +1 -1
- package/esm/MaqlEditor/maql/MaqlEditor.styles.js +13 -17
- package/esm/MaqlEditor/maql/MaqlEditor.tooltip.d.ts.map +1 -1
- package/esm/MaqlEditor/maql/MaqlEditor.tooltip.js +15 -20
- package/esm/MaqlEditor/maql/extensions/completion.d.ts +101 -0
- package/esm/MaqlEditor/maql/extensions/completion.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/completion.js +420 -0
- package/esm/MaqlEditor/maql/extensions/decorations.d.ts +19 -0
- package/esm/MaqlEditor/maql/extensions/decorations.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/decorations.js +137 -0
- package/esm/MaqlEditor/maql/extensions/formatting.d.ts +22 -0
- package/esm/MaqlEditor/maql/extensions/formatting.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/formatting.js +78 -0
- package/esm/MaqlEditor/maql/extensions/hover.d.ts +22 -0
- package/esm/MaqlEditor/maql/extensions/hover.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/hover.js +98 -0
- package/esm/MaqlEditor/maql/extensions/semanticTokens.d.ts +15 -0
- package/esm/MaqlEditor/maql/extensions/semanticTokens.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/semanticTokens.js +79 -0
- package/esm/MaqlEditor/maql/extensions/validation.d.ts +41 -0
- package/esm/MaqlEditor/maql/extensions/validation.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/extensions/validation.js +202 -0
- package/esm/MaqlEditor/maql/hooks/hover/doHover.d.ts +19 -4
- package/esm/MaqlEditor/maql/hooks/hover/doHover.d.ts.map +1 -1
- package/esm/MaqlEditor/maql/hooks/hover/doHover.js +71 -61
- package/esm/MaqlEditor/maql/maqlLanguage.d.ts +16 -0
- package/esm/MaqlEditor/maql/maqlLanguage.d.ts.map +1 -0
- package/esm/MaqlEditor/maql/maqlLanguage.js +72 -0
- package/esm/MaqlEditor/mock/editor-shim.d.ts +7 -0
- package/esm/MaqlEditor/mock/editor-shim.d.ts.map +1 -0
- package/esm/MaqlEditor/mock/{monaco-shim.js → editor-shim.js} +27 -1
- package/esm/MaqlEditor/sql/SqlEditor.d.ts +15 -7
- package/esm/MaqlEditor/sql/SqlEditor.d.ts.map +1 -1
- package/esm/MaqlEditor/sql/SqlEditor.js +55 -30
- package/esm/MaqlEditor/sql/formatter.d.ts +6 -5
- package/esm/MaqlEditor/sql/formatter.d.ts.map +1 -1
- package/esm/MaqlEditor/sql/formatter.js +14 -14
- package/esm/MaqlEditor/sql/sqlLanguage.d.ts +3 -0
- package/esm/MaqlEditor/sql/sqlLanguage.d.ts.map +1 -0
- package/esm/MaqlEditor/sql/sqlLanguage.js +19 -0
- package/esm/MaqlEditor/statusBar/SuggestionStatusBar.d.ts +5 -2
- package/esm/MaqlEditor/statusBar/SuggestionStatusBar.d.ts.map +1 -1
- package/esm/MaqlEditor/statusBar/SuggestionStatusBar.js +20 -8
- package/esm/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.js +28 -27
- package/esm/MetricComponent/Form/MaqlEditorField/suggestionDetailsFunctions.d.ts +0 -1
- package/esm/MetricComponent/Form/MaqlEditorField/suggestionDetailsFunctions.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlEditorField/suggestionDetailsFunctions.js +4 -29
- package/esm/MetricComponent/Form/MaqlResult/MaqlSql.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlResult/MaqlSql.js +4 -2
- package/esm/MetricComponent/Form/maqlFieldFunctions.d.ts +2 -5
- package/esm/MetricComponent/Form/maqlFieldFunctions.d.ts.map +1 -1
- package/esm/MetricComponent/Form/maqlFieldFunctions.js +1 -4
- package/esm/index.d.ts +3 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/sdk-ui-metric-component.d.ts +50 -39
- package/esm/shared/permissions.d.ts.map +1 -1
- package/esm/shared/permissions.js +1 -0
- package/esm/translations/en-US.json +36 -0
- package/package.json +33 -30
- package/esm/MaqlEditor/hooks/useAutoformat.d.ts +0 -3
- package/esm/MaqlEditor/hooks/useAutoformat.d.ts.map +0 -1
- package/esm/MaqlEditor/hooks/useAutoformat.js +0 -15
- package/esm/MaqlEditor/hooks/useCleanCallback.d.ts +0 -4
- package/esm/MaqlEditor/hooks/useCleanCallback.d.ts.map +0 -1
- package/esm/MaqlEditor/hooks/useCleanCallback.js +0 -12
- package/esm/MaqlEditor/hooks/useMountCallback.d.ts +0 -13
- package/esm/MaqlEditor/hooks/useMountCallback.d.ts.map +0 -1
- package/esm/MaqlEditor/hooks/useMountCallback.js +0 -26
- package/esm/MaqlEditor/hooks/useUpdateCallback.d.ts +0 -19
- package/esm/MaqlEditor/hooks/useUpdateCallback.d.ts.map +0 -1
- package/esm/MaqlEditor/hooks/useUpdateCallback.js +0 -63
- package/esm/MaqlEditor/hooks/useValueCallbacks.d.ts +0 -6
- package/esm/MaqlEditor/hooks/useValueCallbacks.d.ts.map +0 -1
- package/esm/MaqlEditor/hooks/useValueCallbacks.js +0 -14
- package/esm/MaqlEditor/maql/formatter.d.ts +0 -6
- package/esm/MaqlEditor/maql/formatter.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/formatter.js +0 -14
- package/esm/MaqlEditor/maql/hooks/hover/useHoverEvent.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/hover/useHoverEvent.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/hover/useHoverEvent.js +0 -32
- package/esm/MaqlEditor/maql/hooks/useAutocomplete.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/useAutocomplete.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useAutocomplete.js +0 -60
- package/esm/MaqlEditor/maql/hooks/useDecoration.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/useDecoration.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useDecoration.js +0 -73
- package/esm/MaqlEditor/maql/hooks/useDocumentFormatting.d.ts +0 -3
- package/esm/MaqlEditor/maql/hooks/useDocumentFormatting.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useDocumentFormatting.js +0 -29
- package/esm/MaqlEditor/maql/hooks/useHover.d.ts +0 -6
- package/esm/MaqlEditor/maql/hooks/useHover.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useHover.js +0 -77
- package/esm/MaqlEditor/maql/hooks/useLanguageConfiguration.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/useLanguageConfiguration.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useLanguageConfiguration.js +0 -21
- package/esm/MaqlEditor/maql/hooks/useMonaco.d.ts +0 -21
- package/esm/MaqlEditor/maql/hooks/useMonaco.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useMonaco.js +0 -75
- package/esm/MaqlEditor/maql/hooks/useSemanticHighlight.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/useSemanticHighlight.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useSemanticHighlight.js +0 -33
- package/esm/MaqlEditor/maql/hooks/useSyntaxHighlight.d.ts +0 -2
- package/esm/MaqlEditor/maql/hooks/useSyntaxHighlight.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useSyntaxHighlight.js +0 -28
- package/esm/MaqlEditor/maql/hooks/useValidation.d.ts +0 -4
- package/esm/MaqlEditor/maql/hooks/useValidation.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/hooks/useValidation.js +0 -56
- package/esm/MaqlEditor/maql/monacoConverter.d.ts +0 -80
- package/esm/MaqlEditor/maql/monacoConverter.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/monacoConverter.js +0 -528
- package/esm/MaqlEditor/maql/utils.d.ts +0 -4
- package/esm/MaqlEditor/maql/utils.d.ts.map +0 -1
- package/esm/MaqlEditor/maql/utils.js +0 -6
- package/esm/MaqlEditor/mock/monaco-shim.d.ts +0 -5
- package/esm/MaqlEditor/mock/monaco-shim.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/MonacoEditor.d.ts +0 -64
- package/esm/MaqlEditor/monaco/MonacoEditor.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/MonacoEditor.js +0 -71
- package/esm/MaqlEditor/monaco/MonacoEditor.styles.d.ts +0 -53
- package/esm/MaqlEditor/monaco/MonacoEditor.styles.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/MonacoEditor.styles.js +0 -427
- package/esm/MaqlEditor/monaco/hooks/useAutofocus.d.ts +0 -3
- package/esm/MaqlEditor/monaco/hooks/useAutofocus.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/hooks/useDefaultValue.d.ts +0 -3
- package/esm/MaqlEditor/monaco/hooks/useDefaultValue.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/hooks/useDefaultValue.js +0 -14
- package/esm/MaqlEditor/monaco/hooks/useEditorInit.d.ts +0 -3
- package/esm/MaqlEditor/monaco/hooks/useEditorInit.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/hooks/useEditorInit.js +0 -84
- package/esm/MaqlEditor/monaco/hooks/useEditorOptions.d.ts +0 -3
- package/esm/MaqlEditor/monaco/hooks/useEditorOptions.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/hooks/useEditorOptions.js +0 -51
- package/esm/MaqlEditor/monaco/hooks/useMonaco.d.ts +0 -3
- package/esm/MaqlEditor/monaco/hooks/useMonaco.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/hooks/useMonaco.js +0 -24
- package/esm/MaqlEditor/monaco/monacoContributions.d.ts +0 -74
- package/esm/MaqlEditor/monaco/monacoContributions.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/monacoContributions.js +0 -88
- package/esm/MaqlEditor/monaco/monacoWorkers.d.ts +0 -53
- package/esm/MaqlEditor/monaco/monacoWorkers.d.ts.map +0 -1
- package/esm/MaqlEditor/monaco/monacoWorkers.js +0 -176
- package/esm/MaqlEditor/sql/hooks/useDocumentFormatting.d.ts +0 -2
- package/esm/MaqlEditor/sql/hooks/useDocumentFormatting.d.ts.map +0 -1
- package/esm/MaqlEditor/sql/hooks/useDocumentFormatting.js +0 -26
- package/esm/MaqlEditor/sql/hooks/useLanguageConfiguration.d.ts +0 -4
- package/esm/MaqlEditor/sql/hooks/useLanguageConfiguration.d.ts.map +0 -1
- package/esm/MaqlEditor/sql/hooks/useLanguageConfiguration.js +0 -29
- package/esm/MaqlEditor/sql/hooks/useMonaco.d.ts +0 -14
- package/esm/MaqlEditor/sql/hooks/useMonaco.d.ts.map +0 -1
- package/esm/MaqlEditor/sql/hooks/useMonaco.js +0 -26
- package/esm/MaqlEditor/sql/hooks/useSyntaxHighlight.d.ts +0 -2
- package/esm/MaqlEditor/sql/hooks/useSyntaxHighlight.d.ts.map +0 -1
- package/esm/MaqlEditor/sql/hooks/useSyntaxHighlight.js +0 -796
- package/esm/MaqlEditor/sql/utils.d.ts +0 -4
- package/esm/MaqlEditor/sql/utils.d.ts.map +0 -1
- package/esm/MaqlEditor/sql/utils.js +0 -6
- package/worker/monaco-editor-worker.js +0 -33
- package/worker/monaco-editor-worker.source.js +0 -1
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2021-2026 GoodData Corporation
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { GlobalStyles } from "tss-react";
|
|
5
|
+
import { makeStyles } from "../theme/styles.js";
|
|
6
|
+
import { NBSP_CLASS } from "./baseExtensions.js";
|
|
7
|
+
const useStyles = makeStyles()(() => ({}));
|
|
8
|
+
export const DecoratorHovered = "hovered-decorator";
|
|
9
|
+
export const DecoratorClassName = "decorator";
|
|
10
|
+
export const DecoratorItemClassName = "decorator-item";
|
|
11
|
+
export const DecoratorFact = "fact";
|
|
12
|
+
export const DecoratorAttribute = "attribute";
|
|
13
|
+
export const DecoratorDateAttribute = "dateAttribute";
|
|
14
|
+
export const DecoratorComputedAttribute = "computedAttribute";
|
|
15
|
+
export const DecoratorLabel = "label";
|
|
16
|
+
export const DecoratorDateLabel = "dateLabel";
|
|
17
|
+
export const DecoratorMetric = "metric";
|
|
18
|
+
export const DecoratorDataset = "dataset";
|
|
19
|
+
export const DecoratorParameter = "parameter";
|
|
20
|
+
export const Decorators = {
|
|
21
|
+
[DecoratorFact]: {
|
|
22
|
+
decoratorItem: [DecoratorItemClassName, DecoratorFact],
|
|
23
|
+
decorator: [DecoratorClassName, DecoratorFact],
|
|
24
|
+
},
|
|
25
|
+
[DecoratorAttribute]: {
|
|
26
|
+
decoratorItem: [DecoratorItemClassName, DecoratorAttribute],
|
|
27
|
+
decorator: [DecoratorClassName, DecoratorAttribute],
|
|
28
|
+
},
|
|
29
|
+
[DecoratorDateAttribute]: {
|
|
30
|
+
decoratorItem: [DecoratorItemClassName, DecoratorDateAttribute],
|
|
31
|
+
decorator: [DecoratorClassName, DecoratorDateAttribute],
|
|
32
|
+
},
|
|
33
|
+
[DecoratorComputedAttribute]: {
|
|
34
|
+
decoratorItem: [DecoratorItemClassName, DecoratorComputedAttribute],
|
|
35
|
+
decorator: [DecoratorClassName, DecoratorComputedAttribute],
|
|
36
|
+
},
|
|
37
|
+
[DecoratorLabel]: {
|
|
38
|
+
decoratorItem: [DecoratorItemClassName, DecoratorLabel],
|
|
39
|
+
decorator: [DecoratorClassName, DecoratorLabel],
|
|
40
|
+
},
|
|
41
|
+
[DecoratorDateLabel]: {
|
|
42
|
+
decoratorItem: [DecoratorItemClassName, DecoratorDateLabel],
|
|
43
|
+
decorator: [DecoratorClassName, DecoratorDateLabel],
|
|
44
|
+
},
|
|
45
|
+
[DecoratorMetric]: {
|
|
46
|
+
decoratorItem: [DecoratorItemClassName, DecoratorMetric],
|
|
47
|
+
decorator: [DecoratorClassName, DecoratorMetric],
|
|
48
|
+
},
|
|
49
|
+
[DecoratorDataset]: {
|
|
50
|
+
decoratorItem: [DecoratorItemClassName, DecoratorDataset],
|
|
51
|
+
decorator: [DecoratorClassName, DecoratorDataset],
|
|
52
|
+
},
|
|
53
|
+
[DecoratorParameter]: {
|
|
54
|
+
decoratorItem: [DecoratorItemClassName, DecoratorParameter],
|
|
55
|
+
decorator: [DecoratorClassName, DecoratorParameter],
|
|
56
|
+
},
|
|
57
|
+
default: {
|
|
58
|
+
decoratorItem: [DecoratorItemClassName, "unknown"],
|
|
59
|
+
decorator: [DecoratorClassName, "unknown"],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Class prefix of the syntax tokens, see maqlLanguage.
|
|
64
|
+
*/
|
|
65
|
+
export const TOKEN_CLASS_PREFIX = "maql-token-";
|
|
66
|
+
/**
|
|
67
|
+
* Class prefix of the semantic tokens the language service reports, see semanticTokens.
|
|
68
|
+
*/
|
|
69
|
+
export const SEMANTIC_TOKEN_CLASS_PREFIX = "maql-semantic-";
|
|
70
|
+
/**
|
|
71
|
+
* Class of the completion tooltip, so its styles do not leak into other CodeMirror editors.
|
|
72
|
+
*/
|
|
73
|
+
export const SUGGEST_CLASS = "maql-suggest";
|
|
74
|
+
/**
|
|
75
|
+
* Class of the widget that shows the diagnostic the user navigated to.
|
|
76
|
+
*/
|
|
77
|
+
export const DIAGNOSTIC_WIDGET_CLASS = "maql-diagnostic-widget";
|
|
78
|
+
/**
|
|
79
|
+
* Class of the hover tooltip with the language service's markdown.
|
|
80
|
+
*/
|
|
81
|
+
export const HOVER_CLASS = "maql-hover";
|
|
82
|
+
/**
|
|
83
|
+
* Class of the rendered completion documentation.
|
|
84
|
+
*/
|
|
85
|
+
export const DOCS_CLASS = "docs";
|
|
86
|
+
/**
|
|
87
|
+
* Class of the documentation pane of a suggestion: the item detail, a close button, the docs.
|
|
88
|
+
*/
|
|
89
|
+
export const DOCS_PANE_CLASS = "maql-docs";
|
|
90
|
+
/**
|
|
91
|
+
* Class of the `?` button on the selected suggestion that shows and hides the documentation.
|
|
92
|
+
*/
|
|
93
|
+
export const DOCS_TOGGLE_CLASS = "maql-docs-toggle";
|
|
94
|
+
/**
|
|
95
|
+
* Class on the editor while the documentation of the suggestions is shown.
|
|
96
|
+
*/
|
|
97
|
+
export const DOCS_OPEN_CLASS = "maql-docs-open";
|
|
98
|
+
/**
|
|
99
|
+
* Class of the type of a suggested object, shown after its label.
|
|
100
|
+
*/
|
|
101
|
+
export const TYPE_LABEL_CLASS = "maql-suggest-type";
|
|
102
|
+
const COMPLETION_ICON_TYPES = [
|
|
103
|
+
"fact",
|
|
104
|
+
"metric",
|
|
105
|
+
"dataset",
|
|
106
|
+
"label",
|
|
107
|
+
"attribute",
|
|
108
|
+
"keyword",
|
|
109
|
+
"function",
|
|
110
|
+
"operator",
|
|
111
|
+
"snippet",
|
|
112
|
+
"value",
|
|
113
|
+
];
|
|
114
|
+
const ICON_STROKE = "#464e56";
|
|
115
|
+
function svgIcon(content) {
|
|
116
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" ` +
|
|
117
|
+
`stroke="${ICON_STROKE}" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">${content}</svg>`;
|
|
118
|
+
return { base64: btoa(svg), width: 16, height: 16 };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Icons of the suggestion types the host does not supply: Monaco drew these from its own icon font.
|
|
122
|
+
*/
|
|
123
|
+
const DEFAULT_ICONS = {
|
|
124
|
+
// + − × ÷
|
|
125
|
+
operator: svgIcon('<path d="M4.5 2v5M2 4.5h5M9 4.5h5M2.75 9.75l3.5 3.5M6.25 9.75l-3.5 3.5M9 11.5h5M11.5 9.4v.01M11.5 13.6v.01"/>'),
|
|
126
|
+
// a box with a dashed bottom edge
|
|
127
|
+
snippet: svgIcon('<path d="M3.5 2.5h9a1.5 1.5 0 0 1 1.5 1.5v8a1.5 1.5 0 0 1-1.5 1.5M2 12V4a1.5 1.5 0 0 1 1.5-1.5' +
|
|
128
|
+
'M2 12a1.5 1.5 0 0 0 1.5 1.5M5.5 13.5h1.5M9 13.5h1.5"/>'),
|
|
129
|
+
// a box with an equals sign
|
|
130
|
+
value: svgIcon('<rect x="2" y="3" width="12" height="10" rx="1.5"/><path d="M5 6.5h6M5 9.5h6"/>'),
|
|
131
|
+
};
|
|
132
|
+
export function CodeEditorStyles({ id, icons, codeTheme, inline, }) {
|
|
133
|
+
const styles = useCodeEditorStyles(id, inline, icons, codeTheme);
|
|
134
|
+
return _jsx(GlobalStyles, { styles: styles });
|
|
135
|
+
}
|
|
136
|
+
const linePaddingLeft = 16;
|
|
137
|
+
const SUGGEST_WIDTH = 430;
|
|
138
|
+
function useCodeEditorStyles(id, inline, icons, codeTheme) {
|
|
139
|
+
const { theme } = useStyles();
|
|
140
|
+
return useMemo(() => {
|
|
141
|
+
const fontSize = inline ? 12 : 14;
|
|
142
|
+
const lineHeight = inline ? 18 : 22;
|
|
143
|
+
const paddingVertical = inline ? 10 : 15;
|
|
144
|
+
const editor = {
|
|
145
|
+
height: inline ? "auto" : "100%",
|
|
146
|
+
background: codeTheme?.background ?? "transparent",
|
|
147
|
+
fontFamily: "monospace",
|
|
148
|
+
fontSize: `${fontSize}px`,
|
|
149
|
+
"&.cm-focused": {
|
|
150
|
+
outline: "none",
|
|
151
|
+
},
|
|
152
|
+
".cm-scroller": {
|
|
153
|
+
fontFamily: "monospace",
|
|
154
|
+
lineHeight: `${lineHeight}px`,
|
|
155
|
+
overflow: "auto",
|
|
156
|
+
},
|
|
157
|
+
".cm-content": {
|
|
158
|
+
padding: `${paddingVertical}px 0 ${paddingVertical}px ${linePaddingLeft}px`,
|
|
159
|
+
// The content fills the editor, so a click anywhere in it focuses the editor, the
|
|
160
|
+
// way the Monaco text area did. An inline editor is as tall as its code.
|
|
161
|
+
minHeight: inline ? `${lineHeight}px` : "100%",
|
|
162
|
+
},
|
|
163
|
+
".cm-line": {
|
|
164
|
+
padding: 0,
|
|
165
|
+
},
|
|
166
|
+
".cm-gutters": {
|
|
167
|
+
background: "transparent",
|
|
168
|
+
border: "none",
|
|
169
|
+
color: theme.content.colors.lineNumber,
|
|
170
|
+
},
|
|
171
|
+
".cm-lineNumbers .cm-gutterElement": {
|
|
172
|
+
minWidth: "4ch",
|
|
173
|
+
padding: "0 8px 0 16px",
|
|
174
|
+
},
|
|
175
|
+
".cm-activeLineGutter": {
|
|
176
|
+
background: "transparent",
|
|
177
|
+
color: theme.content.colors.activeLineNumber,
|
|
178
|
+
},
|
|
179
|
+
".cm-matchingBracket, &.cm-focused .cm-matchingBracket": {
|
|
180
|
+
backgroundColor: theme.content.colors.bracketMatch,
|
|
181
|
+
outline: "none",
|
|
182
|
+
},
|
|
183
|
+
// The find and replace panel, where Monaco's find widget was.
|
|
184
|
+
".cm-panels": {
|
|
185
|
+
borderBottom: `1px solid ${theme.content.colors.line}`,
|
|
186
|
+
background: theme.suggestion.colors.background,
|
|
187
|
+
fontFamily: theme.globals.font,
|
|
188
|
+
fontSize: "12px",
|
|
189
|
+
color: theme.globals.colors.font,
|
|
190
|
+
},
|
|
191
|
+
".cm-panel.cm-search": {
|
|
192
|
+
padding: "5px 10px",
|
|
193
|
+
".cm-textfield": {
|
|
194
|
+
border: `1px solid ${theme.globals.colors.border}`,
|
|
195
|
+
borderRadius: "3px",
|
|
196
|
+
background: "#fff",
|
|
197
|
+
fontSize: "12px",
|
|
198
|
+
},
|
|
199
|
+
".cm-button": {
|
|
200
|
+
border: `1px solid ${theme.globals.colors.border}`,
|
|
201
|
+
borderRadius: "3px",
|
|
202
|
+
background: "#fff",
|
|
203
|
+
backgroundImage: "none",
|
|
204
|
+
fontSize: "12px",
|
|
205
|
+
cursor: "pointer",
|
|
206
|
+
},
|
|
207
|
+
".cm-button:hover": {
|
|
208
|
+
background: theme.suggestion.colors.selectedBackground,
|
|
209
|
+
},
|
|
210
|
+
label: {
|
|
211
|
+
marginRight: "8px",
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
".cm-searchMatch": {
|
|
215
|
+
backgroundColor: "rgba(234, 92, 0, 0.33)",
|
|
216
|
+
},
|
|
217
|
+
".cm-searchMatch.cm-searchMatch-selected": {
|
|
218
|
+
backgroundColor: "#a8ac94",
|
|
219
|
+
},
|
|
220
|
+
".cm-selectionMatch": {
|
|
221
|
+
backgroundColor: "rgba(173, 214, 255, 0.5)",
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
const tokens = Object.entries(codeTheme?.tokens ?? {}).reduce((prev, [type, color]) => {
|
|
225
|
+
prev[`.${TOKEN_CLASS_PREFIX}${type}`] = { color };
|
|
226
|
+
return prev;
|
|
227
|
+
}, {});
|
|
228
|
+
// The semantic tokens come from the parser of the language service and win over the
|
|
229
|
+
// regular-expression tokens, so they are declared after them.
|
|
230
|
+
const semanticTokens = Object.entries(codeTheme?.tokens ?? {}).reduce((prev, [type, color]) => {
|
|
231
|
+
prev[`.${SEMANTIC_TOKEN_CLASS_PREFIX}${type}`] = { color };
|
|
232
|
+
return prev;
|
|
233
|
+
}, {});
|
|
234
|
+
const decorators = Object.keys(Decorators).reduce((prev, name) => {
|
|
235
|
+
const item = Decorators[name];
|
|
236
|
+
const colors = codeTheme?.decorators[name];
|
|
237
|
+
prev[`.${item.decorator.join(".")}`] = {
|
|
238
|
+
background: colors?.background ?? "#cecece",
|
|
239
|
+
color: colors?.color ?? "#7e7e7e",
|
|
240
|
+
...theme.decorator,
|
|
241
|
+
};
|
|
242
|
+
prev[`.${item.decoratorItem.join(".")}`] = {
|
|
243
|
+
color: colors?.color ?? "#000000",
|
|
244
|
+
};
|
|
245
|
+
return prev;
|
|
246
|
+
}, {});
|
|
247
|
+
const hoverDecorator = {
|
|
248
|
+
[`.${DecoratorHovered}`]: {
|
|
249
|
+
background: `${theme.hoverMetric.colors.hover} !important`,
|
|
250
|
+
...theme.decorator,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
const allIcons = { ...DEFAULT_ICONS, ...icons };
|
|
254
|
+
const completionIcons = COMPLETION_ICON_TYPES.reduce((prev, type) => {
|
|
255
|
+
const icon = allIcons[type];
|
|
256
|
+
if (icon) {
|
|
257
|
+
prev[`.cm-completionIcon-${type}`] = {
|
|
258
|
+
"&::after": {
|
|
259
|
+
content: '""',
|
|
260
|
+
display: "block",
|
|
261
|
+
...createIconDefinition(icon),
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return prev;
|
|
266
|
+
}, {});
|
|
267
|
+
const suggestionWidget = {
|
|
268
|
+
[`.cm-tooltip.cm-tooltip-autocomplete.${SUGGEST_CLASS}`]: {
|
|
269
|
+
boxShadow: theme.suggestion.shadow,
|
|
270
|
+
border: theme.suggestion.borders.default,
|
|
271
|
+
background: theme.suggestion.colors.background,
|
|
272
|
+
"& > ul": {
|
|
273
|
+
fontFamily: theme.suggestion.font,
|
|
274
|
+
fontSize: `${theme.suggestion.item.fontSize}px`,
|
|
275
|
+
// The width of the Monaco suggest widget; long details are cut, not the list widened.
|
|
276
|
+
width: `${SUGGEST_WIDTH}px`,
|
|
277
|
+
maxWidth: `${SUGGEST_WIDTH}px`,
|
|
278
|
+
maxHeight: "260px",
|
|
279
|
+
"& > li": {
|
|
280
|
+
position: "relative",
|
|
281
|
+
display: "flex",
|
|
282
|
+
alignItems: "center",
|
|
283
|
+
padding: "0 30px 0 10px",
|
|
284
|
+
lineHeight: "22px",
|
|
285
|
+
color: theme.globals.colors.font,
|
|
286
|
+
background: theme.suggestion.colors.background,
|
|
287
|
+
"&[aria-selected], &:hover": {
|
|
288
|
+
background: theme.suggestion.colors.selectedBackground,
|
|
289
|
+
color: theme.globals.colors.font,
|
|
290
|
+
},
|
|
291
|
+
[`.${DOCS_TOGGLE_CLASS}`]: {
|
|
292
|
+
display: "none",
|
|
293
|
+
position: "absolute",
|
|
294
|
+
top: "50%",
|
|
295
|
+
right: "8px",
|
|
296
|
+
transform: "translateY(-50%)",
|
|
297
|
+
width: "16px",
|
|
298
|
+
height: "16px",
|
|
299
|
+
padding: 0,
|
|
300
|
+
border: "none",
|
|
301
|
+
background: "transparent",
|
|
302
|
+
cursor: "pointer",
|
|
303
|
+
fontFamily: theme.globals.font,
|
|
304
|
+
fontSize: "12px",
|
|
305
|
+
lineHeight: "16px",
|
|
306
|
+
color: theme.detail.colors.header,
|
|
307
|
+
...iconButton(icons?.detail),
|
|
308
|
+
},
|
|
309
|
+
[`&[aria-selected] .${DOCS_TOGGLE_CLASS}`]: {
|
|
310
|
+
display: "block",
|
|
311
|
+
},
|
|
312
|
+
// Monaco shows the detail of the selected row only.
|
|
313
|
+
"&[aria-selected] .cm-completionDetail": {
|
|
314
|
+
display: "block",
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
".cm-completionIcon": {
|
|
319
|
+
flex: "0 0 auto",
|
|
320
|
+
width: "18px",
|
|
321
|
+
marginRight: "5px",
|
|
322
|
+
opacity: 1,
|
|
323
|
+
display: "inline-flex",
|
|
324
|
+
alignItems: "center",
|
|
325
|
+
verticalAlign: "middle",
|
|
326
|
+
fontSize: "100%",
|
|
327
|
+
},
|
|
328
|
+
".cm-completionLabel": {
|
|
329
|
+
flex: "0 1 auto",
|
|
330
|
+
minWidth: "40%",
|
|
331
|
+
overflow: "hidden",
|
|
332
|
+
textOverflow: "ellipsis",
|
|
333
|
+
whiteSpace: "nowrap",
|
|
334
|
+
},
|
|
335
|
+
[`.${TYPE_LABEL_CLASS}`]: {
|
|
336
|
+
flex: "0 0 auto",
|
|
337
|
+
marginLeft: "8px",
|
|
338
|
+
whiteSpace: "nowrap",
|
|
339
|
+
fontSize: `${theme.suggestion.label.fontSize}px`,
|
|
340
|
+
color: theme.suggestion.colors.active,
|
|
341
|
+
},
|
|
342
|
+
".cm-completionMatchedText": {
|
|
343
|
+
textDecoration: "none",
|
|
344
|
+
background: theme.suggestion.colors.highlightedBackground,
|
|
345
|
+
color: theme.globals.colors.font,
|
|
346
|
+
},
|
|
347
|
+
".cm-completionDetail": {
|
|
348
|
+
display: "none",
|
|
349
|
+
flex: "1 1 0",
|
|
350
|
+
minWidth: 0,
|
|
351
|
+
marginLeft: "20px",
|
|
352
|
+
overflow: "hidden",
|
|
353
|
+
textOverflow: "ellipsis",
|
|
354
|
+
whiteSpace: "nowrap",
|
|
355
|
+
textAlign: "right",
|
|
356
|
+
fontStyle: "normal",
|
|
357
|
+
fontSize: `${theme.suggestion.label.fontSize}px`,
|
|
358
|
+
fontFamily: theme.globals.font,
|
|
359
|
+
color: theme.suggestion.colors.active,
|
|
360
|
+
},
|
|
361
|
+
...completionIcons,
|
|
362
|
+
},
|
|
363
|
+
// The open documentation pane repeats the detail in its header.
|
|
364
|
+
[`&.${DOCS_OPEN_CLASS} .cm-tooltip.cm-tooltip-autocomplete.${SUGGEST_CLASS} > ul > li[aria-selected] .cm-completionDetail`]: {
|
|
365
|
+
display: "none",
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
const suggestionsDetails = {
|
|
369
|
+
".cm-tooltip.cm-completionInfo": {
|
|
370
|
+
fontFamily: theme.globals.font,
|
|
371
|
+
minHeight: `${2 * theme.detail.padding + theme.detail.header.size}px`,
|
|
372
|
+
border: `1px solid ${theme.detail.colors.border}`,
|
|
373
|
+
boxShadow: `0 1px 20px ${theme.globals.colors.shadow}`,
|
|
374
|
+
color: theme.globals.colors.font,
|
|
375
|
+
background: theme.detail.colors.background,
|
|
376
|
+
padding: `${theme.detail.padding}px`,
|
|
377
|
+
width: "400px",
|
|
378
|
+
maxHeight: "400px",
|
|
379
|
+
overflow: "auto",
|
|
380
|
+
// CodeMirror keeps the line breaks of plain-text info; this one is markup.
|
|
381
|
+
whiteSpace: "normal",
|
|
382
|
+
// Laid out and placed at once, shown when the user asks for it, see maqlCompletion.
|
|
383
|
+
visibility: "hidden",
|
|
384
|
+
},
|
|
385
|
+
[`&.${DOCS_OPEN_CLASS} .cm-tooltip.cm-completionInfo`]: {
|
|
386
|
+
visibility: "visible",
|
|
387
|
+
},
|
|
388
|
+
[`.${DOCS_PANE_CLASS}`]: {
|
|
389
|
+
".header": {
|
|
390
|
+
position: "relative",
|
|
391
|
+
minHeight: `${theme.detail.header.lineHeight}px`,
|
|
392
|
+
paddingRight: `${theme.detail.padding * 2}px`,
|
|
393
|
+
fontFamily: theme.suggestion.font,
|
|
394
|
+
fontSize: `${theme.detail.header.fontSize}px`,
|
|
395
|
+
lineHeight: `${theme.detail.header.lineHeight}px`,
|
|
396
|
+
color: theme.detail.colors.header,
|
|
397
|
+
p: {
|
|
398
|
+
margin: 0,
|
|
399
|
+
padding: 0,
|
|
400
|
+
},
|
|
401
|
+
".close": {
|
|
402
|
+
position: "absolute",
|
|
403
|
+
top: 0,
|
|
404
|
+
right: 0,
|
|
405
|
+
width: "16px",
|
|
406
|
+
height: "16px",
|
|
407
|
+
padding: 0,
|
|
408
|
+
border: "none",
|
|
409
|
+
background: "transparent",
|
|
410
|
+
cursor: "pointer",
|
|
411
|
+
fontFamily: theme.detail.header.close.font,
|
|
412
|
+
fontSize: `${theme.detail.header.close.size}px`,
|
|
413
|
+
lineHeight: "16px",
|
|
414
|
+
color: theme.detail.colors.header,
|
|
415
|
+
...iconButton(icons?.close),
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
[`.header + .${DOCS_CLASS}`]: {
|
|
419
|
+
marginTop: `${theme.detail.padding}px`,
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
const diagnostics = {
|
|
424
|
+
// A diagnostic without extent gets no mark, the way Monaco drew no squiggle for it; it
|
|
425
|
+
// still shows on navigation.
|
|
426
|
+
".cm-lintPoint": {
|
|
427
|
+
display: "none",
|
|
428
|
+
},
|
|
429
|
+
// The diagnostics of the hovered code, a section of the hover tooltip.
|
|
430
|
+
".cm-tooltip-lint": {
|
|
431
|
+
".cm-diagnostic": {
|
|
432
|
+
borderLeft: "none",
|
|
433
|
+
margin: theme.hoverBar.margin,
|
|
434
|
+
padding: theme.hoverBar.padding,
|
|
435
|
+
borderRadius: theme.hoverBar.sizes.borderRadiusInner,
|
|
436
|
+
fontSize: `${theme.hoverBar.sizes.font}px`,
|
|
437
|
+
whiteSpace: "normal",
|
|
438
|
+
},
|
|
439
|
+
".cm-diagnostic-error": {
|
|
440
|
+
background: theme.hoverBar.colors.errorBackground,
|
|
441
|
+
color: theme.hoverBar.colors.errorText,
|
|
442
|
+
},
|
|
443
|
+
".cm-diagnosticText": {
|
|
444
|
+
// A block, so its first letter can be capitalised.
|
|
445
|
+
display: "inline-block",
|
|
446
|
+
"&::first-letter": {
|
|
447
|
+
textTransform: "uppercase",
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
".cm-diagnosticSource": {
|
|
451
|
+
display: "inline",
|
|
452
|
+
marginLeft: "6px",
|
|
453
|
+
fontSize: "inherit",
|
|
454
|
+
opacity: 0.7,
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
[`.cm-tooltip.${DIAGNOSTIC_WIDGET_CLASS}`]: {
|
|
458
|
+
border: "none",
|
|
459
|
+
borderTop: `${theme.errorsBar.border.topWidth}px solid ${theme.errorsBar.colors.error}`,
|
|
460
|
+
background: theme.errorsBar.colors.bodyBackground,
|
|
461
|
+
padding: `${theme.errorsBar.paddingVertical}px ${theme.errorsBar.paddingHorizontal}px`,
|
|
462
|
+
maxWidth: "calc(100% - 32px)",
|
|
463
|
+
".message": {
|
|
464
|
+
fontFamily: theme.errorsBar.font,
|
|
465
|
+
fontSize: `${theme.errorsBar.sizes.bodyFontSize}px`,
|
|
466
|
+
lineHeight: `${theme.errorsBar.sizes.lineHeight}px`,
|
|
467
|
+
color: theme.errorsBar.colors.body,
|
|
468
|
+
"&::first-letter": {
|
|
469
|
+
textTransform: "uppercase",
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
};
|
|
474
|
+
const hover = {
|
|
475
|
+
// The host of the hover tooltips: diagnostics and the language service's markdown.
|
|
476
|
+
".cm-tooltip.cm-tooltip-hover": {
|
|
477
|
+
border: theme.hoverBar.border,
|
|
478
|
+
borderRadius: theme.hoverBar.sizes.borderRadius,
|
|
479
|
+
background: theme.hoverBar.colors.background,
|
|
480
|
+
boxShadow: theme.hoverBar.boxShadow,
|
|
481
|
+
fontFamily: theme.hoverBar.font,
|
|
482
|
+
fontSize: `${theme.hoverBar.sizes.font}px`,
|
|
483
|
+
color: theme.globals.colors.font,
|
|
484
|
+
maxWidth: "500px",
|
|
485
|
+
},
|
|
486
|
+
[`.cm-tooltip.cm-tooltip-hover .${HOVER_CLASS}`]: {
|
|
487
|
+
padding: theme.hoverBar.padding,
|
|
488
|
+
},
|
|
489
|
+
[`.${NBSP_CLASS}`]: {
|
|
490
|
+
boxShadow: `inset 0 0 0 1px ${theme.globals.colors.errorFull}`,
|
|
491
|
+
borderRadius: "2px",
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
return {
|
|
495
|
+
[`#${id} .cm-editor`]: {
|
|
496
|
+
...editor,
|
|
497
|
+
...tokens,
|
|
498
|
+
...semanticTokens,
|
|
499
|
+
...decorators,
|
|
500
|
+
...hoverDecorator,
|
|
501
|
+
...suggestionWidget,
|
|
502
|
+
...suggestionsDetails,
|
|
503
|
+
...diagnostics,
|
|
504
|
+
...hover,
|
|
505
|
+
},
|
|
506
|
+
};
|
|
507
|
+
}, [id, inline, icons, codeTheme, theme]);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* A button that shows the icon in place of its text, when the host supplies one.
|
|
511
|
+
*/
|
|
512
|
+
function iconButton(icon) {
|
|
513
|
+
if (!icon) {
|
|
514
|
+
return {};
|
|
515
|
+
}
|
|
516
|
+
return {
|
|
517
|
+
fontSize: 0,
|
|
518
|
+
color: "transparent",
|
|
519
|
+
...createIconDefinition(icon),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function createIconDefinition(icon) {
|
|
523
|
+
const def = {};
|
|
524
|
+
if (icon) {
|
|
525
|
+
def["backgroundImage"] = `url("data:image/svg+xml;base64,${icon.base64}")`;
|
|
526
|
+
def["backgroundRepeat"] = "no-repeat";
|
|
527
|
+
def["backgroundPosition"] = "center";
|
|
528
|
+
if (icon.width) {
|
|
529
|
+
def["width"] = `${icon.width}px`;
|
|
530
|
+
}
|
|
531
|
+
if (icon.height) {
|
|
532
|
+
def["height"] = `${icon.height}px`;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return def;
|
|
536
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type EditorView } from "@codemirror/view";
|
|
3
|
+
/**
|
|
4
|
+
* An action of the context menu of an editor.
|
|
5
|
+
*/
|
|
6
|
+
export interface IContextMenuItem {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The key of the action, written the way the platform writes it.
|
|
11
|
+
*/
|
|
12
|
+
shortcut?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Actions of the same group sit together; a separator divides the groups.
|
|
15
|
+
*/
|
|
16
|
+
group: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the action is offered in a read-only editor. Copy is; edits are not.
|
|
19
|
+
*/
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
run: (editor: EditorView) => unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface IMenuPosition {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}
|
|
27
|
+
export interface IContextMenuProps {
|
|
28
|
+
editor: EditorView;
|
|
29
|
+
items: IContextMenuItem[];
|
|
30
|
+
position: IMenuPosition;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const CONTEXT_MENU_CLASS = "maql-editor-context-menu";
|
|
34
|
+
export declare const CONTEXT_MENU_TEST_CLASS = "s-maql-editor-context-menu";
|
|
35
|
+
/**
|
|
36
|
+
* The key of a shortcut the way the platform writes it: symbols on a Mac, names elsewhere.
|
|
37
|
+
*/
|
|
38
|
+
export declare function platformShortcut(mac: string, other: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* The actions every editor of this package offers in its context menu, labelled in the locale of
|
|
41
|
+
* the application: multi-cursor editing in the edit group, and the clipboard group.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useCommonMenuItems(): {
|
|
44
|
+
changeAllOccurrences: IContextMenuItem;
|
|
45
|
+
clipboard: IContextMenuItem[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The context menu of an editor, with the actions Monaco's menu offered. It closes on a click
|
|
49
|
+
* outside, on Escape, and when the window changes.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ContextMenu({ editor, items, position, onClose }: IContextMenuProps): ReactElement | null;
|
|
52
|
+
//# sourceMappingURL=ContextMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/MaqlEditor/codemirror/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,YAAY,EAQpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAWnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,aAAa;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAC7D,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AAIpE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI;IAClC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,gBAAgB,EAAE,CAAC;CACjC,CAsCA;AAyDD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,YAAY,GAAG,IAAI,CAyGxG"}
|