@mongodb-js/compass-editor 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +557 -0
- package/dist/ace/aggregation-autocompleter.d.ts +15 -0
- package/dist/ace/aggregation-autocompleter.d.ts.map +1 -0
- package/dist/ace/aggregation-autocompleter.js +109 -0
- package/dist/ace/aggregation-autocompleter.js.map +1 -0
- package/dist/ace/index.d.ts +2 -0
- package/dist/ace/index.d.ts.map +1 -0
- package/dist/ace/index.js +37 -0
- package/dist/ace/index.js.map +1 -0
- package/dist/ace/mode.d.ts +2 -0
- package/dist/ace/mode.d.ts.map +1 -0
- package/dist/ace/mode.js +67 -0
- package/dist/ace/mode.js.map +1 -0
- package/dist/ace/query-autocompleter.d.ts +12 -0
- package/dist/ace/query-autocompleter.d.ts.map +1 -0
- package/dist/ace/query-autocompleter.js +26 -0
- package/dist/ace/query-autocompleter.js.map +1 -0
- package/dist/ace/stage-autocompleter.d.ts +403 -0
- package/dist/ace/stage-autocompleter.d.ts.map +1 -0
- package/dist/ace/stage-autocompleter.js +89 -0
- package/dist/ace/stage-autocompleter.js.map +1 -0
- package/dist/ace/theme.d.ts +4 -0
- package/dist/ace/theme.d.ts.map +1 -0
- package/dist/ace/theme.js +265 -0
- package/dist/ace/theme.js.map +1 -0
- package/dist/ace/util.d.ts +5 -0
- package/dist/ace/util.d.ts.map +1 -0
- package/dist/ace/util.js +21 -0
- package/dist/ace/util.js.map +1 -0
- package/dist/ace/validation-autocompleter.d.ts +12 -0
- package/dist/ace/validation-autocompleter.d.ts.map +1 -0
- package/dist/ace/validation-autocompleter.js +31 -0
- package/dist/ace/validation-autocompleter.js.map +1 -0
- package/dist/base-editor.d.ts +35 -0
- package/dist/base-editor.d.ts.map +1 -0
- package/dist/base-editor.js +120 -0
- package/dist/base-editor.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/inline-editor.d.ts +6 -0
- package/dist/inline-editor.d.ts.map +1 -0
- package/dist/inline-editor.js +22 -0
- package/dist/inline-editor.js.map +1 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mongodbAceThemeCssText = exports.mongodbAceThemeCssClass = void 0;
|
|
4
|
+
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
5
|
+
const mongodbAceThemeCssClass = 'ace-mongodb';
|
|
6
|
+
exports.mongodbAceThemeCssClass = mongodbAceThemeCssClass;
|
|
7
|
+
const css = String.raw;
|
|
8
|
+
const mongodbAceThemeCssText = css `
|
|
9
|
+
.ace-mongodb {
|
|
10
|
+
--editor-color: ${compass_components_1.palette.black};
|
|
11
|
+
--editor-background: ${compass_components_1.palette.gray.light3};
|
|
12
|
+
|
|
13
|
+
--gutter-color: ${compass_components_1.palette.gray.base};
|
|
14
|
+
--gutter-background: ${compass_components_1.palette.gray.light3};
|
|
15
|
+
--gutter-active-line-background: ${compass_components_1.palette.gray.light2};
|
|
16
|
+
|
|
17
|
+
--cursor-color: ${compass_components_1.palette.gray.base};
|
|
18
|
+
|
|
19
|
+
--print-margin-background: ${compass_components_1.palette.gray.light2};
|
|
20
|
+
|
|
21
|
+
--indent-guide-from: transparent;
|
|
22
|
+
--indent-guide-to: ${compass_components_1.palette.gray.light1};
|
|
23
|
+
|
|
24
|
+
--marker-active-line-background: ${compass_components_1.palette.gray.light2};
|
|
25
|
+
--marker-focus-active-line-background: ${compass_components_1.palette.gray.light2};
|
|
26
|
+
--marker-selection-background: ${compass_components_1.palette.blue.light2};
|
|
27
|
+
--marker-step-background: ${compass_components_1.palette.yellow.light2};
|
|
28
|
+
--marker-stack-background: ${compass_components_1.palette.green.base};
|
|
29
|
+
--marker-bracket-border-color: ${compass_components_1.palette.gray.light1};
|
|
30
|
+
--marker-selected-word-background: transparent;
|
|
31
|
+
|
|
32
|
+
--keyword-color: ${compass_components_1.palette.gray.base};
|
|
33
|
+
--string-color: ${compass_components_1.palette.blue.base};
|
|
34
|
+
--string-regexp-color: ${compass_components_1.palette.blue.base};
|
|
35
|
+
--boolean-color: ${compass_components_1.palette.blue.base};
|
|
36
|
+
--constant-numeric-color: ${compass_components_1.palette.blue.base};
|
|
37
|
+
--constant-builtin-color: ${compass_components_1.palette.blue.light1};
|
|
38
|
+
--variable-class-color: ${compass_components_1.palette.green.dark2};
|
|
39
|
+
--variable-instance-color: ${compass_components_1.palette.green.dark2};
|
|
40
|
+
--variable-language-color: ${compass_components_1.palette.blue.light1};
|
|
41
|
+
--support-function-color: ${compass_components_1.palette.blue.light1};
|
|
42
|
+
--comment-color: ${compass_components_1.palette.gray.base};
|
|
43
|
+
--invisible-color: ${compass_components_1.palette.gray.light1};
|
|
44
|
+
|
|
45
|
+
--autocomplete-color: ${compass_components_1.palette.black};
|
|
46
|
+
--autocomplete-background: ${compass_components_1.palette.gray.light3};
|
|
47
|
+
--autocomplete-border-color: ${compass_components_1.palette.gray.light2};
|
|
48
|
+
--autocompletion-highlight-color: ${compass_components_1.palette.green.dark1};
|
|
49
|
+
--autocompletion-marker-active-line-background: ${compass_components_1.palette.gray.light2};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ace_dark.ace-mongodb {
|
|
53
|
+
--editor-color: ${compass_components_1.palette.gray.light3};
|
|
54
|
+
--editor-background: ${compass_components_1.palette.gray.dark3};
|
|
55
|
+
|
|
56
|
+
--gutter-color: ${compass_components_1.palette.gray.light3};
|
|
57
|
+
--gutter-background: ${compass_components_1.palette.gray.dark3};
|
|
58
|
+
--gutter-active-line-background: ${compass_components_1.palette.gray.dark2};
|
|
59
|
+
|
|
60
|
+
--cursor-color: ${compass_components_1.palette.green.base};
|
|
61
|
+
|
|
62
|
+
--print-margin-background: ${compass_components_1.palette.gray.light2};
|
|
63
|
+
|
|
64
|
+
--indent-guide-from: transparent;
|
|
65
|
+
--indent-guide-to: ${compass_components_1.palette.gray.light1};
|
|
66
|
+
|
|
67
|
+
--marker-active-line-background: ${compass_components_1.palette.gray.dark2};
|
|
68
|
+
--marker-focus-active-line-background: ${compass_components_1.palette.gray.dark2};
|
|
69
|
+
--marker-selection-background: ${compass_components_1.palette.gray.dark1};
|
|
70
|
+
--marker-step-background: ${compass_components_1.palette.yellow.light2};
|
|
71
|
+
--marker-stack-background: ${compass_components_1.palette.green.base};
|
|
72
|
+
--marker-bracket-border-color: ${compass_components_1.palette.gray.light1};
|
|
73
|
+
--marker-selected-word-background: transparent;
|
|
74
|
+
|
|
75
|
+
--keyword-color: #ff7dc3;
|
|
76
|
+
--string-color: #35de7b;
|
|
77
|
+
--string-regexp-color: #35de7b;
|
|
78
|
+
--boolean-color: #2dc4ff;
|
|
79
|
+
--constant-numeric-color: #ff6f44;
|
|
80
|
+
--constant-builtin-color: ${compass_components_1.palette.blue.light1};
|
|
81
|
+
--variable-class-color: #a5e3ff;
|
|
82
|
+
--variable-instance-color: #a5e3ff;
|
|
83
|
+
--variable-language-color: ${compass_components_1.palette.blue.light1};
|
|
84
|
+
--support-function-color: ${compass_components_1.palette.blue.light1};
|
|
85
|
+
--comment-color: ${compass_components_1.palette.gray.base};
|
|
86
|
+
--invisible-color: ${compass_components_1.palette.gray.dark2};
|
|
87
|
+
|
|
88
|
+
--autocomplete-color: ${compass_components_1.palette.gray.light1};
|
|
89
|
+
--autocomplete-background: ${compass_components_1.palette.gray.dark3};
|
|
90
|
+
--autocomplete-border-color: ${compass_components_1.palette.gray.dark1};
|
|
91
|
+
--autocompletion-highlight-color: ${compass_components_1.palette.gray.light3};
|
|
92
|
+
--autocompletion-marker-active-line-background: ${compass_components_1.palette.gray.dark2};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ace-mongodb.ace_editor {
|
|
96
|
+
color: var(--editor-color);
|
|
97
|
+
background: var(--editor-background);
|
|
98
|
+
line-height: ${compass_components_1.spacing[3]}px;
|
|
99
|
+
}
|
|
100
|
+
.inline-editor.ace-mongodb.ace_editor {
|
|
101
|
+
background: transparent;
|
|
102
|
+
}
|
|
103
|
+
.ace-mongodb .ace_placeholder {
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-family: inherit;
|
|
106
|
+
font-size: inherit;
|
|
107
|
+
font-style: inherit !important;
|
|
108
|
+
transform: none;
|
|
109
|
+
opacity: 1;
|
|
110
|
+
/* To match ace editor text padding */
|
|
111
|
+
padding: 0 4px !important;
|
|
112
|
+
}
|
|
113
|
+
.ace-mongodb .ace_gutter {
|
|
114
|
+
color: var(--gutter-color);
|
|
115
|
+
background: var(--gutter-background);
|
|
116
|
+
}
|
|
117
|
+
.inline-editor.ace-mongodb .ace_gutter {
|
|
118
|
+
background: inherit;
|
|
119
|
+
}
|
|
120
|
+
.ace-mongodb .ace_gutter-cell {
|
|
121
|
+
/* gutter left padding has to account for error annotation size */
|
|
122
|
+
padding-left: 20px;
|
|
123
|
+
padding-right: 10px;
|
|
124
|
+
}
|
|
125
|
+
.ace-mongodb .ace_keyword {
|
|
126
|
+
color: var(--keyword-color);
|
|
127
|
+
font-weight: normal;
|
|
128
|
+
}
|
|
129
|
+
.ace-mongodb .ace_string {
|
|
130
|
+
color: var(--string-color);
|
|
131
|
+
}
|
|
132
|
+
.ace-mongodb .ace_boolean {
|
|
133
|
+
color: var(--boolean-color);
|
|
134
|
+
font-weight: normal;
|
|
135
|
+
}
|
|
136
|
+
.ace-mongodb .ace_constant.ace_numeric {
|
|
137
|
+
color: var(--constant-numeric-color);
|
|
138
|
+
}
|
|
139
|
+
.ace-mongodb .ace_string.ace_regexp {
|
|
140
|
+
color: var(--string-regexp-color);
|
|
141
|
+
}
|
|
142
|
+
.ace-mongodb .ace_variable.ace_class {
|
|
143
|
+
color: var(--variable-class-color);
|
|
144
|
+
}
|
|
145
|
+
.ace-mongodb .ace_constant.ace_buildin {
|
|
146
|
+
color: var(--constant-builtin-color);
|
|
147
|
+
}
|
|
148
|
+
.ace-mongodb .ace_support.ace_function {
|
|
149
|
+
color: var(--support-function-color);
|
|
150
|
+
}
|
|
151
|
+
.ace-mongodb .ace_comment {
|
|
152
|
+
color: var(--comment-color);
|
|
153
|
+
font-style: italic;
|
|
154
|
+
}
|
|
155
|
+
.ace-mongodb .ace_variable.ace_language {
|
|
156
|
+
color: var(--variable-language-color);
|
|
157
|
+
}
|
|
158
|
+
.ace-mongodb .ace_paren {
|
|
159
|
+
font-weight: normal;
|
|
160
|
+
}
|
|
161
|
+
.ace-mongodb .ace_variable.ace_instance {
|
|
162
|
+
color: var(--variable-instance-color);
|
|
163
|
+
}
|
|
164
|
+
.ace-mongodb .ace_constant.ace_language {
|
|
165
|
+
font-weight: bold;
|
|
166
|
+
}
|
|
167
|
+
.ace-mongodb .ace_cursor {
|
|
168
|
+
background: transparent;
|
|
169
|
+
color: var(--cursor-color);
|
|
170
|
+
border-color: var(--cursor-color);
|
|
171
|
+
}
|
|
172
|
+
.ace-mongodb .ace_marker-layer .ace_active-line {
|
|
173
|
+
background: var(--marker-active-line-background);
|
|
174
|
+
}
|
|
175
|
+
.ace-mongodb.ace_focus .ace_marker-layer .ace_active-line {
|
|
176
|
+
background: var(--marker-focus-active-line-background);
|
|
177
|
+
}
|
|
178
|
+
.ace-mongodb .ace_marker-layer .ace_selection {
|
|
179
|
+
background: var(--marker-selection-background);
|
|
180
|
+
}
|
|
181
|
+
.ace-mongodb.ace_nobold .ace_line > span {
|
|
182
|
+
font-weight: normal !important;
|
|
183
|
+
}
|
|
184
|
+
.ace-mongodb .ace_marker-layer .ace_step {
|
|
185
|
+
background: var(--marker-step-background);
|
|
186
|
+
}
|
|
187
|
+
.ace-mongodb .ace_marker-layer .ace_stack {
|
|
188
|
+
background: var(--marker-stack-background);
|
|
189
|
+
}
|
|
190
|
+
.ace-mongodb .ace_marker-layer .ace_bracket {
|
|
191
|
+
margin: 0px;
|
|
192
|
+
border: 1px solid var(--marker-bracket-border-color);
|
|
193
|
+
}
|
|
194
|
+
.ace-mongodb .ace_gutter-active-line {
|
|
195
|
+
background: var(--gutter-active-line-background);
|
|
196
|
+
}
|
|
197
|
+
.ace-mongodb .ace_marker-layer .ace_selected-word {
|
|
198
|
+
background: var(--marker-selected-word-background);
|
|
199
|
+
border: none;
|
|
200
|
+
}
|
|
201
|
+
.ace-mongodb .ace_invisible {
|
|
202
|
+
color: var(--invisible-color);
|
|
203
|
+
}
|
|
204
|
+
.ace-mongodb .ace_print-margin {
|
|
205
|
+
width: 1px;
|
|
206
|
+
background: var(--print-margin-background);
|
|
207
|
+
}
|
|
208
|
+
.ace-mongodb .ace_hidden-cursors {
|
|
209
|
+
opacity: 0;
|
|
210
|
+
}
|
|
211
|
+
.ace-mongodb .ace_indent-guide {
|
|
212
|
+
background: linear-gradient(
|
|
213
|
+
to top,
|
|
214
|
+
var(--indent-guide-from) 0%,
|
|
215
|
+
var(--indent-guide-from) 50%,
|
|
216
|
+
var(--indent-guide-to) 50%,
|
|
217
|
+
var(--indent-guide-to) 100%
|
|
218
|
+
)
|
|
219
|
+
right repeat-y;
|
|
220
|
+
background-size: 1px 2px;
|
|
221
|
+
}
|
|
222
|
+
.ace-mongodb .ace_scroller.ace_scroll-left {
|
|
223
|
+
/* Hide ace's default left box shadow when scrolled. */
|
|
224
|
+
box-shadow: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* Autocomplete colors */
|
|
228
|
+
|
|
229
|
+
/* duplicating class names to override default ace styles */
|
|
230
|
+
.ace-mongodb.ace-mongodb.ace_editor.ace_autocomplete {
|
|
231
|
+
box-sizing: border-box;
|
|
232
|
+
border: 1px solid var(--autocomplete-border-color);
|
|
233
|
+
background-color: var(--autocomplete-background);
|
|
234
|
+
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.5);
|
|
235
|
+
color: var(--autocomplete-color);
|
|
236
|
+
/* line-height: 24px; */
|
|
237
|
+
}
|
|
238
|
+
.ace-mongodb.ace-mongodb.ace_editor.ace_autocomplete
|
|
239
|
+
.ace_completion-highlight {
|
|
240
|
+
color: var(--autocompletion-highlight-color);
|
|
241
|
+
text-shadow: none;
|
|
242
|
+
font-weight: bold;
|
|
243
|
+
}
|
|
244
|
+
.ace-mongodb.ace-mongodb.ace_editor.ace_autocomplete
|
|
245
|
+
.ace_marker-layer
|
|
246
|
+
.ace_active-line {
|
|
247
|
+
background-color: var(--autocompletion-marker-active-line-background);
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
exports.mongodbAceThemeCssText = mongodbAceThemeCssText;
|
|
251
|
+
ace.define('ace/theme/mongodb', ['require', 'exports', 'module', 'ace/lib/dom'], function (acequire, exports) {
|
|
252
|
+
exports.isDark = false;
|
|
253
|
+
exports.cssClass = mongodbAceThemeCssClass;
|
|
254
|
+
exports.cssText = mongodbAceThemeCssText;
|
|
255
|
+
const dom = acequire('../lib/dom');
|
|
256
|
+
dom.importCssString(exports.cssText, exports.cssClass);
|
|
257
|
+
});
|
|
258
|
+
ace.define('ace/theme/mongodb-dark', ['require', 'exports', 'module', 'ace/lib/dom'], function (acequire, exports) {
|
|
259
|
+
exports.isDark = true;
|
|
260
|
+
exports.cssClass = mongodbAceThemeCssClass;
|
|
261
|
+
exports.cssText = mongodbAceThemeCssText;
|
|
262
|
+
const dom = acequire('../lib/dom');
|
|
263
|
+
dom.importCssString(exports.cssText, exports.cssClass);
|
|
264
|
+
});
|
|
265
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/ace/theme.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAsRrC,0DAAuB;AAnRhC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;AAEvB,MAAM,sBAAsB,GAAG,GA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AQ,EAAE,aAAa,CAAC,EAC/C,UAAU,QAAQ,EAAE,OAAO;IACzB,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;IACvB,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC;IAC3C,OAAO,CAAC,OAAO,GAAG,sBAAsB,CAAC;IACzC,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACnC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC,CACF,CAAC;AAOF,GAAG,CAAC,MAAM,CACR,wBAAwB,EACxB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,EAC/C,UAAU,QAAQ,EAAE,OAAO;IACzB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,QAAQ,GAAG,uBAAuB,CAAC;IAC3C,OAAO,CAAC,OAAO,GAAG,sBAAsB,CAAC;IACzC,MAAM,GAAG,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACnC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompletionWithServerInfo } from '../types';
|
|
2
|
+
declare const filter: (version: string, entries: CompletionWithServerInfo[], prefix: string) => CompletionWithServerInfo[];
|
|
3
|
+
declare const MATCH_COMPLETIONS: CompletionWithServerInfo[];
|
|
4
|
+
export { filter, MATCH_COMPLETIONS };
|
|
5
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/ace/util.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,QAAA,MAAM,MAAM,YACD,MAAM,WACN,wBAAwB,EAAE,UAC3B,MAAM,+BAWf,CAAC;AAKF,QAAA,MAAM,iBAAiB,4BAGtB,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/ace/util.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MATCH_COMPLETIONS = exports.filter = void 0;
|
|
7
|
+
const mongodb_constants_1 = require("@mongodb-js/mongodb-constants");
|
|
8
|
+
const semver_1 = __importDefault(require("semver"));
|
|
9
|
+
const filter = (version, entries, prefix) => {
|
|
10
|
+
const parsedVersion = semver_1.default.parse(version);
|
|
11
|
+
return entries.filter((e) => {
|
|
12
|
+
const cleanVersion = parsedVersion
|
|
13
|
+
? [parsedVersion.major, parsedVersion.minor, parsedVersion.patch].join('.')
|
|
14
|
+
: version;
|
|
15
|
+
return e.value.startsWith(prefix) && semver_1.default.gte(cleanVersion, e.version);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
exports.filter = filter;
|
|
19
|
+
const MATCH_COMPLETIONS = [].concat(mongodb_constants_1.QUERY_OPERATORS, mongodb_constants_1.BSON_TYPES);
|
|
20
|
+
exports.MATCH_COMPLETIONS = MATCH_COMPLETIONS;
|
|
21
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/ace/util.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA4E;AAC5E,oDAA4B;AAG5B,MAAM,MAAM,GAAG,CACb,OAAe,EACf,OAAmC,EACnC,MAAc,EACd,EAAE;IACF,MAAM,aAAa,GAAG,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1B,MAAM,YAAY,GAAG,aAAa;YAChC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,CAClE,GAAG,CACJ;YACH,CAAC,CAAC,OAAO,CAAC;QACZ,OAAO,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,gBAAM,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAUO,wBAAM;AALf,MAAM,iBAAiB,GAAI,EAAiC,CAAC,MAAM,CACjE,mCAAe,EACf,8BAAU,CACX,CAAC;AAEe,8CAAiB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Ace } from 'ace-builds';
|
|
2
|
+
import type { CompletionWithServerInfo } from '../types';
|
|
3
|
+
declare class ValidationAutoCompleter implements Ace.Completer {
|
|
4
|
+
version: string;
|
|
5
|
+
textCompleter: Ace.Completer;
|
|
6
|
+
fields: CompletionWithServerInfo[];
|
|
7
|
+
constructor(version: string, textCompleter: Ace.Completer, fields: CompletionWithServerInfo[]);
|
|
8
|
+
update(fields: CompletionWithServerInfo[]): void;
|
|
9
|
+
getCompletions: Ace.Completer['getCompletions'];
|
|
10
|
+
}
|
|
11
|
+
export { ValidationAutoCompleter };
|
|
12
|
+
//# sourceMappingURL=validation-autocompleter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-autocompleter.d.ts","sourceRoot":"","sources":["../../src/ace/validation-autocompleter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAMzD,cAAM,uBAAwB,YAAW,GAAG,CAAC,SAAS;IAE3C,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,GAAG,CAAC,SAAS;IAC5B,MAAM,EAAE,wBAAwB,EAAE;gBAFlC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,GAAG,CAAC,SAAS,EAC5B,MAAM,EAAE,wBAAwB,EAAE;IAO3C,MAAM,CAAC,MAAM,EAAE,wBAAwB,EAAE;IAIzC,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAuB7C;CACH;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationAutoCompleter = void 0;
|
|
4
|
+
const mongodb_constants_1 = require("@mongodb-js/mongodb-constants");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
class ValidationAutoCompleter {
|
|
7
|
+
constructor(version, textCompleter, fields) {
|
|
8
|
+
this.version = version;
|
|
9
|
+
this.textCompleter = textCompleter;
|
|
10
|
+
this.fields = fields;
|
|
11
|
+
this.getCompletions = (_editor, session, position, prefix, done) => {
|
|
12
|
+
if (prefix === '')
|
|
13
|
+
return done(null, []);
|
|
14
|
+
const currentToken = session.getTokenAt(position.row, position.column);
|
|
15
|
+
if ((currentToken === null || currentToken === void 0 ? void 0 : currentToken.type) === 'string') {
|
|
16
|
+
const strings = [].concat(mongodb_constants_1.BSON_TYPE_ALIASES, this.fields);
|
|
17
|
+
return done(null, (0, util_1.filter)(this.version, strings, prefix));
|
|
18
|
+
}
|
|
19
|
+
const expressions = util_1.MATCH_COMPLETIONS.concat(this.fields, mongodb_constants_1.JSON_SCHEMA);
|
|
20
|
+
return done(null, (0, util_1.filter)(this.version, expressions, prefix));
|
|
21
|
+
};
|
|
22
|
+
this.version = version;
|
|
23
|
+
this.textCompleter = textCompleter;
|
|
24
|
+
this.fields = fields;
|
|
25
|
+
}
|
|
26
|
+
update(fields) {
|
|
27
|
+
this.fields = fields;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ValidationAutoCompleter = ValidationAutoCompleter;
|
|
31
|
+
//# sourceMappingURL=validation-autocompleter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-autocompleter.js","sourceRoot":"","sources":["../../src/ace/validation-autocompleter.ts"],"names":[],"mappings":";;;AAAA,qEAA+E;AAG/E,iCAAmD;AAKnD,MAAM,uBAAuB;IAC3B,YACS,OAAe,EACf,aAA4B,EAC5B,MAAkC;QAFlC,YAAO,GAAP,OAAO,CAAQ;QACf,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAA4B;QAW3C,mBAAc,GAAoC,CAChD,OAAO,EACP,OAAO,EACP,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,EAAE;YAEF,IAAI,MAAM,KAAK,EAAE;gBAAE,OAAO,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAGzC,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;YACvE,IAAI,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,MAAK,QAAQ,EAAE;gBACnC,MAAM,OAAO,GAAI,EAAiC,CAAC,MAAM,CACvD,qCAAiB,EACjB,IAAI,CAAC,MAAM,CACZ,CAAC;gBACF,OAAO,IAAI,CAAC,IAAI,EAAE,IAAA,aAAM,EAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;aAC1D;YAGD,MAAM,WAAW,GAAG,wBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,+BAAW,CAAC,CAAC;YACvE,OAAO,IAAI,CAAC,IAAI,EAAE,IAAA,aAAM,EAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC;QAhCA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,MAAkC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CA0BF;AAEQ,0DAAuB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'ace-builds';
|
|
3
|
+
import type { IAceEditorProps, IAceOptions } from 'react-ace';
|
|
4
|
+
import 'ace-builds/src-noconflict/ext-language_tools';
|
|
5
|
+
import 'ace-builds/src-noconflict/mode-javascript';
|
|
6
|
+
import 'ace-builds/src-noconflict/mode-json';
|
|
7
|
+
import 'ace-builds/src-noconflict/mode-csharp';
|
|
8
|
+
import 'ace-builds/src-noconflict/mode-python';
|
|
9
|
+
import 'ace-builds/src-noconflict/mode-java';
|
|
10
|
+
import 'ace-builds/src-noconflict/mode-ruby';
|
|
11
|
+
import 'ace-builds/src-noconflict/mode-rust';
|
|
12
|
+
import 'ace-builds/src-noconflict/mode-golang';
|
|
13
|
+
import 'ace-builds/src-noconflict/mode-php';
|
|
14
|
+
import './ace';
|
|
15
|
+
declare const EditorVariant: {
|
|
16
|
+
readonly Shell: "Shell";
|
|
17
|
+
readonly EJSON: "EJSON";
|
|
18
|
+
readonly Generic: "Generic";
|
|
19
|
+
};
|
|
20
|
+
export declare type EditorProps = {
|
|
21
|
+
variant: keyof typeof EditorVariant;
|
|
22
|
+
text?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
options?: Omit<IAceOptions, 'readOnly' | 'fontFamily' | 'fontSize' | 'enableLiveAutocompletion'>;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
completer?: unknown;
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
onChangeText?: (text: string, event?: any) => void;
|
|
29
|
+
darkMode?: boolean;
|
|
30
|
+
} & Omit<IAceEditorProps, 'onChange' | 'value' | 'theme'>;
|
|
31
|
+
declare function BaseEditor({ text, variant, options, readOnly, id, name, commands: _commands, onChangeText, completer, 'data-testid': dataTestId, onFocus, darkMode: _darkMode, ...aceProps }: EditorProps): React.ReactElement;
|
|
32
|
+
declare function setEditorValue(element: HTMLElement, value: string): void;
|
|
33
|
+
declare const EditorTextCompleter: any;
|
|
34
|
+
export { BaseEditor as Editor, EditorVariant, EditorTextCompleter, setEditorValue, };
|
|
35
|
+
//# sourceMappingURL=base-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-editor.d.ts","sourceRoot":"","sources":["../src/base-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAQhE,OAAO,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI9D,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,oCAAoC,CAAC;AAG5C,OAAO,OAAO,CAAC;AAuBf,QAAA,MAAM,aAAa;;;;CAIT,CAAC;AAEX,oBAAY,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,OAAO,aAAa,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,IAAI,CACZ,WAAW,EACX,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,0BAA0B,CACpE,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;AAQ1D,iBAAS,UAAU,CAAC,EAClB,IAAI,EACJ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,EAAE,EACF,IAAI,EACJ,QAAQ,EAAE,SAAS,EACnB,YAAY,EACZ,SAAS,EACT,aAAa,EAAE,UAAU,EACzB,OAAO,EACP,QAAQ,EAAE,SAAS,EACnB,GAAG,QAAQ,EACZ,EAAE,WAAW,GAAG,KAAK,CAAC,YAAY,CAmElC;AAUD,iBAAS,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAQjE;AAED,QAAA,MAAM,mBAAmB,KAAsB,CAAC;AAGhD,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.setEditorValue = exports.EditorTextCompleter = exports.EditorVariant = exports.Editor = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
32
|
+
require("ace-builds");
|
|
33
|
+
const react_ace_1 = __importDefault(require("react-ace"));
|
|
34
|
+
require("ace-builds/src-noconflict/ext-language_tools");
|
|
35
|
+
require("ace-builds/src-noconflict/mode-javascript");
|
|
36
|
+
require("ace-builds/src-noconflict/mode-json");
|
|
37
|
+
require("ace-builds/src-noconflict/mode-csharp");
|
|
38
|
+
require("ace-builds/src-noconflict/mode-python");
|
|
39
|
+
require("ace-builds/src-noconflict/mode-java");
|
|
40
|
+
require("ace-builds/src-noconflict/mode-ruby");
|
|
41
|
+
require("ace-builds/src-noconflict/mode-rust");
|
|
42
|
+
require("ace-builds/src-noconflict/mode-golang");
|
|
43
|
+
require("ace-builds/src-noconflict/mode-php");
|
|
44
|
+
const ext_language_tools_1 = __importDefault(require("ace-builds/src-noconflict/ext-language_tools"));
|
|
45
|
+
const ext_beautify_1 = __importDefault(require("ace-builds/src-noconflict/ext-beautify"));
|
|
46
|
+
require("./ace");
|
|
47
|
+
const DEFAULT_OPTIONS = {
|
|
48
|
+
enableLiveAutocompletion: false,
|
|
49
|
+
tabSize: 2,
|
|
50
|
+
minLines: 10,
|
|
51
|
+
maxLines: Infinity,
|
|
52
|
+
showGutter: true,
|
|
53
|
+
showPrintMargin: false,
|
|
54
|
+
useWorker: false,
|
|
55
|
+
fontFamily: compass_components_1.fontFamilies.code,
|
|
56
|
+
fontSize: 13,
|
|
57
|
+
};
|
|
58
|
+
const EditorVariant = {
|
|
59
|
+
Shell: 'Shell',
|
|
60
|
+
EJSON: 'EJSON',
|
|
61
|
+
Generic: 'Generic',
|
|
62
|
+
};
|
|
63
|
+
exports.EditorVariant = EditorVariant;
|
|
64
|
+
const editorStyle = (0, compass_components_1.css)({
|
|
65
|
+
position: 'relative',
|
|
66
|
+
width: '100%',
|
|
67
|
+
zIndex: 0,
|
|
68
|
+
});
|
|
69
|
+
function BaseEditor({ text, variant, options, readOnly, id, name, commands: _commands, onChangeText, completer, 'data-testid': dataTestId, onFocus, darkMode: _darkMode, ...aceProps }) {
|
|
70
|
+
const setOptions = {
|
|
71
|
+
...DEFAULT_OPTIONS,
|
|
72
|
+
...options,
|
|
73
|
+
...(typeof readOnly === 'boolean' && { readOnly }),
|
|
74
|
+
...(variant === 'Shell' && { mode: 'ace/mode/mongodb' }),
|
|
75
|
+
...(!!completer && { enableLiveAutocompletion: true }),
|
|
76
|
+
};
|
|
77
|
+
const editorRef = (0, react_1.useRef)(null);
|
|
78
|
+
const providerDarkMode = (0, compass_components_1.useDarkMode)();
|
|
79
|
+
const darkMode = _darkMode !== null && _darkMode !== void 0 ? _darkMode : providerDarkMode;
|
|
80
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
81
|
+
if (!editorRef.current) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
editorRef.current.editor.setTheme(`ace/theme/${darkMode ? 'mongodb-dark' : 'mongodb'}`);
|
|
85
|
+
}, [darkMode]);
|
|
86
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
87
|
+
if (id && editorRef.current) {
|
|
88
|
+
editorRef.current.editor.textInput.getElement().id = id;
|
|
89
|
+
}
|
|
90
|
+
}, [id]);
|
|
91
|
+
const editorName = (0, compass_components_1.useId)();
|
|
92
|
+
const commands = (0, react_1.useMemo)(() => {
|
|
93
|
+
return ext_beautify_1.default.commands.concat(_commands !== null && _commands !== void 0 ? _commands : []);
|
|
94
|
+
}, [_commands]);
|
|
95
|
+
return (react_1.default.createElement("div", { "data-testid": dataTestId, className: editorStyle },
|
|
96
|
+
react_1.default.createElement(react_ace_1.default, { ref: editorRef, mode: variant === 'Generic'
|
|
97
|
+
? undefined
|
|
98
|
+
: variant === 'EJSON'
|
|
99
|
+
? 'json'
|
|
100
|
+
: 'javascript', width: "100%", value: text, onChange: onChangeText, editorProps: { $blockScrolling: Infinity }, setOptions: setOptions, readOnly: readOnly, name: name !== null && name !== void 0 ? name : editorName, commands: commands, onFocus: (ev) => {
|
|
101
|
+
if (completer) {
|
|
102
|
+
ext_language_tools_1.default.setCompleters([completer]);
|
|
103
|
+
}
|
|
104
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev);
|
|
105
|
+
}, ...aceProps })));
|
|
106
|
+
}
|
|
107
|
+
exports.Editor = BaseEditor;
|
|
108
|
+
function setEditorValue(element, value) {
|
|
109
|
+
const container = element.querySelector('.ace_editor');
|
|
110
|
+
if (!container) {
|
|
111
|
+
throw new Error('Cannot find editor container');
|
|
112
|
+
}
|
|
113
|
+
window.ace
|
|
114
|
+
.edit(element.querySelector(`#${container.id}`))
|
|
115
|
+
.setValue(value);
|
|
116
|
+
}
|
|
117
|
+
exports.setEditorValue = setEditorValue;
|
|
118
|
+
const EditorTextCompleter = ext_language_tools_1.default.textCompleter;
|
|
119
|
+
exports.EditorTextCompleter = EditorTextCompleter;
|
|
120
|
+
//# sourceMappingURL=base-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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* from './base-editor';
|
|
3
|
+
export { ValidationAutoCompleter } from './ace/validation-autocompleter';
|
|
4
|
+
export { QueryAutoCompleter } from './ace/query-autocompleter';
|
|
5
|
+
export { StageAutoCompleter } from './ace/stage-autocompleter';
|
|
6
|
+
export { AggregationAutoCompleter } from './ace/aggregation-autocompleter';
|
|
7
|
+
export declare type AceEditor = Ace.Editor;
|
|
8
|
+
export declare type AceAnnotation = Ace.Annotation;
|
|
9
|
+
export type { CompletionWithServerInfo } from './types';
|
|
10
|
+
export { InlineEditor } from './inline-editor';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,oBAAY,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;AACnC,oBAAY,aAAa,GAAG,GAAG,CAAC,UAAU,CAAC;AAC3C,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.InlineEditor = exports.AggregationAutoCompleter = exports.StageAutoCompleter = exports.QueryAutoCompleter = exports.ValidationAutoCompleter = void 0;
|
|
18
|
+
__exportStar(require("./base-editor"), exports);
|
|
19
|
+
var validation_autocompleter_1 = require("./ace/validation-autocompleter");
|
|
20
|
+
Object.defineProperty(exports, "ValidationAutoCompleter", { enumerable: true, get: function () { return validation_autocompleter_1.ValidationAutoCompleter; } });
|
|
21
|
+
var query_autocompleter_1 = require("./ace/query-autocompleter");
|
|
22
|
+
Object.defineProperty(exports, "QueryAutoCompleter", { enumerable: true, get: function () { return query_autocompleter_1.QueryAutoCompleter; } });
|
|
23
|
+
var stage_autocompleter_1 = require("./ace/stage-autocompleter");
|
|
24
|
+
Object.defineProperty(exports, "StageAutoCompleter", { enumerable: true, get: function () { return stage_autocompleter_1.StageAutoCompleter; } });
|
|
25
|
+
var aggregation_autocompleter_1 = require("./ace/aggregation-autocompleter");
|
|
26
|
+
Object.defineProperty(exports, "AggregationAutoCompleter", { enumerable: true, get: function () { return aggregation_autocompleter_1.AggregationAutoCompleter; } });
|
|
27
|
+
var inline_editor_1 = require("./inline-editor");
|
|
28
|
+
Object.defineProperty(exports, "InlineEditor", { enumerable: true, get: function () { return inline_editor_1.InlineEditor; } });
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,gDAA8B;AAC9B,2EAAyE;AAAhE,mIAAA,uBAAuB,OAAA;AAChC,iEAA+D;AAAtD,yHAAA,kBAAkB,OAAA;AAC3B,iEAA+D;AAAtD,yHAAA,kBAAkB,OAAA;AAC3B,6EAA2E;AAAlE,qIAAA,wBAAwB,OAAA;AAIjC,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorProps } from './base-editor';
|
|
3
|
+
declare type InlineEditorProps = EditorProps & Omit<EditorProps['options'], 'showGutter' | 'highlightActiveLine' | 'highlightGutterLine' | 'minLines'>;
|
|
4
|
+
declare const InlineEditor: React.FunctionComponent<InlineEditorProps>;
|
|
5
|
+
export { InlineEditor };
|
|
6
|
+
//# sourceMappingURL=inline-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-editor.d.ts","sourceRoot":"","sources":["../src/inline-editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,aAAK,iBAAiB,GAAG,WAAW,GAClC,IAAI,CACF,WAAW,CAAC,SAAS,CAAC,EACtB,YAAY,GAAG,qBAAqB,GAAG,qBAAqB,GAAG,UAAU,CAC1E,CAAC;AAEJ,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAoB5D,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InlineEditor = void 0;
|
|
7
|
+
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const base_editor_1 = require("./base-editor");
|
|
10
|
+
const InlineEditor = ({ options, className, ...props }) => {
|
|
11
|
+
const inlineEditorOptions = {
|
|
12
|
+
maxLines: 10,
|
|
13
|
+
...options,
|
|
14
|
+
minLines: 1,
|
|
15
|
+
showGutter: false,
|
|
16
|
+
highlightActiveLine: false,
|
|
17
|
+
highlightGutterLine: false,
|
|
18
|
+
};
|
|
19
|
+
return (react_1.default.createElement(base_editor_1.Editor, { options: inlineEditorOptions, className: (0, compass_components_1.cx)('inline-editor', className), ...props }));
|
|
20
|
+
};
|
|
21
|
+
exports.InlineEditor = InlineEditor;
|
|
22
|
+
//# sourceMappingURL=inline-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-editor.js","sourceRoot":"","sources":["../src/inline-editor.tsx"],"names":[],"mappings":";;;;;;AAAA,uEAAoD;AACpD,kDAA0B;AAE1B,+CAAuC;AAQvC,MAAM,YAAY,GAA+C,CAAC,EAChE,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,mBAAmB,GAAG;QAC1B,QAAQ,EAAE,EAAE;QACZ,GAAG,OAAO;QACV,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,KAAK;QACjB,mBAAmB,EAAE,KAAK;QAC1B,mBAAmB,EAAE,KAAK;KAC3B,CAAC;IACF,OAAO,CACL,8BAAC,oBAAM,IACL,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,IAAA,uBAAE,EAAC,eAAe,EAAE,SAAS,CAAC,KACrC,KAAK,GACD,CACX,CAAC;AACJ,CAAC,CAAC;AAEO,oCAAY"}
|