@mongodb-js/compass-editor 0.7.0 → 0.9.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/dist/autocompleter.d.ts +12 -0
- package/dist/autocompleter.d.ts.map +1 -1
- package/dist/index.d.ts +2 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -38
- package/dist/index.js.map +1 -1
- package/dist/json-editor.d.ts +52 -2
- package/dist/json-editor.d.ts.map +1 -1
- package/dist/json-editor.js +99 -58
- package/dist/json-editor.js.map +1 -1
- package/dist/types.d.ts +3 -36
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -10
- package/dist/ace/aggregation-autocompleter.d.ts +0 -15
- package/dist/ace/aggregation-autocompleter.d.ts.map +0 -1
- package/dist/ace/aggregation-autocompleter.js +0 -109
- package/dist/ace/aggregation-autocompleter.js.map +0 -1
- package/dist/ace/index.d.ts +0 -2
- package/dist/ace/index.d.ts.map +0 -1
- package/dist/ace/index.js +0 -37
- package/dist/ace/index.js.map +0 -1
- package/dist/ace/mode.d.ts +0 -2
- package/dist/ace/mode.d.ts.map +0 -1
- package/dist/ace/mode.js +0 -67
- package/dist/ace/mode.js.map +0 -1
- package/dist/ace/query-autocompleter.d.ts +0 -12
- package/dist/ace/query-autocompleter.d.ts.map +0 -1
- package/dist/ace/query-autocompleter.js +0 -38
- package/dist/ace/query-autocompleter.js.map +0 -1
- package/dist/ace/stage-autocompleter.d.ts +0 -16
- package/dist/ace/stage-autocompleter.d.ts.map +0 -1
- package/dist/ace/stage-autocompleter.js +0 -70
- package/dist/ace/stage-autocompleter.js.map +0 -1
- package/dist/ace/theme.d.ts +0 -4
- package/dist/ace/theme.d.ts.map +0 -1
- package/dist/ace/theme.js +0 -297
- package/dist/ace/theme.js.map +0 -1
- package/dist/ace/util.d.ts +0 -3
- package/dist/ace/util.d.ts.map +0 -1
- package/dist/ace/util.js +0 -12
- package/dist/ace/util.js.map +0 -1
- package/dist/ace/validation-autocompleter.d.ts +0 -12
- package/dist/ace/validation-autocompleter.d.ts.map +0 -1
- package/dist/ace/validation-autocompleter.js +0 -36
- package/dist/ace/validation-autocompleter.js.map +0 -1
- package/dist/base-editor.d.ts +0 -36
- package/dist/base-editor.d.ts.map +0 -1
- package/dist/base-editor.js +0 -156
- package/dist/base-editor.js.map +0 -1
- package/dist/inline-editor.d.ts +0 -8
- package/dist/inline-editor.d.ts.map +0 -1
- package/dist/inline-editor.js +0 -21
- package/dist/inline-editor.js.map +0 -1
- package/dist/multiline-editor.d.ts +0 -18
- package/dist/multiline-editor.d.ts.map +0 -1
- package/dist/multiline-editor.js +0 -83
- package/dist/multiline-editor.js.map +0 -1
- package/dist/syntax-highlight.d.ts +0 -10
- package/dist/syntax-highlight.d.ts.map +0 -1
- package/dist/syntax-highlight.js +0 -26
- package/dist/syntax-highlight.js.map +0 -1
package/dist/base-editor.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
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.BaseEditor = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
32
|
-
const compass_components_2 = require("@mongodb-js/compass-components");
|
|
33
|
-
require("ace-builds");
|
|
34
|
-
const react_ace_1 = __importDefault(require("react-ace"));
|
|
35
|
-
require("ace-builds/src-noconflict/ext-language_tools");
|
|
36
|
-
require("ace-builds/src-noconflict/mode-javascript");
|
|
37
|
-
require("ace-builds/src-noconflict/mode-json");
|
|
38
|
-
require("ace-builds/src-noconflict/mode-csharp");
|
|
39
|
-
require("ace-builds/src-noconflict/mode-python");
|
|
40
|
-
require("ace-builds/src-noconflict/mode-java");
|
|
41
|
-
require("ace-builds/src-noconflict/mode-ruby");
|
|
42
|
-
require("ace-builds/src-noconflict/mode-rust");
|
|
43
|
-
require("ace-builds/src-noconflict/mode-golang");
|
|
44
|
-
require("ace-builds/src-noconflict/mode-php");
|
|
45
|
-
const ext_language_tools_1 = __importDefault(require("ace-builds/src-noconflict/ext-language_tools"));
|
|
46
|
-
require("./ace");
|
|
47
|
-
const prettify_1 = require("./prettify");
|
|
48
|
-
const DEFAULT_OPTIONS = {
|
|
49
|
-
enableLiveAutocompletion: false,
|
|
50
|
-
tabSize: 2,
|
|
51
|
-
minLines: 10,
|
|
52
|
-
maxLines: Infinity,
|
|
53
|
-
showGutter: true,
|
|
54
|
-
showPrintMargin: false,
|
|
55
|
-
useWorker: false,
|
|
56
|
-
fontFamily: compass_components_2.fontFamilies.code,
|
|
57
|
-
fontSize: 13,
|
|
58
|
-
};
|
|
59
|
-
const EditorVariant = {
|
|
60
|
-
Shell: 'Shell',
|
|
61
|
-
EJSON: 'EJSON',
|
|
62
|
-
Generic: 'Generic',
|
|
63
|
-
};
|
|
64
|
-
exports.EditorVariant = EditorVariant;
|
|
65
|
-
const editorStyle = (0, compass_components_2.css)({
|
|
66
|
-
lineHeight: `${compass_components_1.spacing[3]}px`,
|
|
67
|
-
minHeight: 'inherit',
|
|
68
|
-
position: 'relative',
|
|
69
|
-
width: '100%',
|
|
70
|
-
zIndex: 0,
|
|
71
|
-
});
|
|
72
|
-
const defaultCommands = [
|
|
73
|
-
{
|
|
74
|
-
name: 'prettify',
|
|
75
|
-
exec(editor) {
|
|
76
|
-
try {
|
|
77
|
-
const mode = editor.session.getMode().$id;
|
|
78
|
-
const format = mode.endsWith('/json')
|
|
79
|
-
? 'json'
|
|
80
|
-
: 'javascript-expression';
|
|
81
|
-
const code = (0, prettify_1.prettify)(editor.getValue(), format);
|
|
82
|
-
const currentSelection = editor.selection.toJSON();
|
|
83
|
-
editor.session.doc.setValue(code);
|
|
84
|
-
editor.selection.fromJSON(currentSelection);
|
|
85
|
-
}
|
|
86
|
-
catch (_a) {
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
bindKey: {
|
|
90
|
-
win: 'Ctrl-Shift-B',
|
|
91
|
-
mac: 'Ctrl-Shift-B',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'copy-all',
|
|
96
|
-
exec(editor) {
|
|
97
|
-
void navigator.clipboard.writeText(editor.getValue());
|
|
98
|
-
},
|
|
99
|
-
bindKey: {
|
|
100
|
-
win: 'Ctrl-Shift-C',
|
|
101
|
-
mac: 'Ctrl-Shift-C',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
function BaseEditor({ text, variant, options, readOnly, id, name, commands: _commands, onChangeText, completer, 'data-testid': dataTestId, onFocus, darkMode: _darkMode, className, editorClassName, ...aceProps }) {
|
|
106
|
-
const setOptions = {
|
|
107
|
-
...DEFAULT_OPTIONS,
|
|
108
|
-
...options,
|
|
109
|
-
...(typeof readOnly === 'boolean' && { readOnly }),
|
|
110
|
-
...(variant === 'Shell' && { mode: 'ace/mode/mongodb' }),
|
|
111
|
-
...(!!completer && { enableLiveAutocompletion: true }),
|
|
112
|
-
};
|
|
113
|
-
const editorRef = (0, react_1.useRef)(null);
|
|
114
|
-
const providerDarkMode = (0, compass_components_2.useDarkMode)();
|
|
115
|
-
const darkMode = _darkMode !== null && _darkMode !== void 0 ? _darkMode : providerDarkMode;
|
|
116
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
117
|
-
if (!editorRef.current) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
editorRef.current.editor.setTheme(`ace/theme/${darkMode ? 'mongodb-dark' : 'mongodb'}`);
|
|
121
|
-
}, [darkMode]);
|
|
122
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
123
|
-
if (id && editorRef.current) {
|
|
124
|
-
editorRef.current.editor.textInput.getElement().id = id;
|
|
125
|
-
}
|
|
126
|
-
}, [id]);
|
|
127
|
-
const editorName = (0, compass_components_2.useId)();
|
|
128
|
-
const commands = (0, react_1.useMemo)(() => {
|
|
129
|
-
return defaultCommands.concat(_commands !== null && _commands !== void 0 ? _commands : []);
|
|
130
|
-
}, [_commands]);
|
|
131
|
-
return (react_1.default.createElement("div", { "data-testid": dataTestId, className: (0, compass_components_1.cx)(editorStyle, className) },
|
|
132
|
-
react_1.default.createElement(react_ace_1.default, { ref: editorRef, mode: variant === 'Generic'
|
|
133
|
-
? undefined
|
|
134
|
-
: variant === 'EJSON'
|
|
135
|
-
? 'json'
|
|
136
|
-
: '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) => {
|
|
137
|
-
if (completer) {
|
|
138
|
-
ext_language_tools_1.default.setCompleters([completer]);
|
|
139
|
-
}
|
|
140
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev);
|
|
141
|
-
}, className: editorClassName, ...aceProps })));
|
|
142
|
-
}
|
|
143
|
-
exports.BaseEditor = BaseEditor;
|
|
144
|
-
function setEditorValue(element, value) {
|
|
145
|
-
const container = element.querySelector('.ace_editor');
|
|
146
|
-
if (!container) {
|
|
147
|
-
throw new Error('Cannot find editor container');
|
|
148
|
-
}
|
|
149
|
-
window.ace
|
|
150
|
-
.edit(element.querySelector(`#${container.id}`))
|
|
151
|
-
.setValue(value);
|
|
152
|
-
}
|
|
153
|
-
exports.setEditorValue = setEditorValue;
|
|
154
|
-
const EditorTextCompleter = ext_language_tools_1.default.textCompleter;
|
|
155
|
-
exports.EditorTextCompleter = EditorTextCompleter;
|
|
156
|
-
//# sourceMappingURL=base-editor.js.map
|
package/dist/base-editor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-editor.js","sourceRoot":"","sources":["../src/base-editor.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgE;AAChE,uEAA6D;AAC7D,uEAKwC;AAExC,sBAAoB;AAEpB,0DAAkC;AAGlC,wDAAsD;AACtD,qDAAmD;AACnD,+CAA6C;AAC7C,iDAA+C;AAC/C,iDAA+C;AAC/C,+CAA6C;AAC7C,+CAA6C;AAC7C,+CAA6C;AAC7C,iDAA+C;AAC/C,8CAA4C;AAC5C,sGAAiE;AACjE,iBAAe;AACf,yCAAsC;AAKtC,MAAM,eAAe,GAAgB;IACnC,wBAAwB,EAAE,KAAK;IAC/B,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAA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AAQ,GACZ,CACE,CACP,CAAC;AACJ,CAAC;AAsBQ,gCAAU;AAZnB,SAAS,cAAc,CAAC,OAAoB,EAAE,KAAa;IACzD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IACvD,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;IACA,MAAc,CAAC,GAAG;SAChB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;SAC/C,QAAQ,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAIwD,wCAAc;AAFvE,MAAM,mBAAmB,GAAG,4BAAK,CAAC,aAAa,CAAC;AAEZ,kDAAmB"}
|
package/dist/inline-editor.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { EditorProps } from './base-editor';
|
|
3
|
-
type InlineEditorProps = Omit<EditorProps, 'options' | 'editorClassName'> & {
|
|
4
|
-
options?: Omit<EditorProps['options'], 'showGutter' | 'highlightActiveLine' | 'highlightGutterLine' | 'minLines'>;
|
|
5
|
-
};
|
|
6
|
-
declare const InlineEditor: React.FunctionComponent<InlineEditorProps>;
|
|
7
|
-
export { InlineEditor };
|
|
8
|
-
//# sourceMappingURL=inline-editor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-editor.d.ts","sourceRoot":"","sources":["../src/inline-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,KAAK,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,iBAAiB,CAAC,GAAG;IAC1E,OAAO,CAAC,EAAE,IAAI,CACZ,WAAW,CAAC,SAAS,CAAC,EACtB,YAAY,GAAG,qBAAqB,GAAG,qBAAqB,GAAG,UAAU,CAC1E,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAmB5D,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/inline-editor.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
8
|
-
const base_editor_1 = require("./base-editor");
|
|
9
|
-
const InlineEditor = ({ options, ...props }) => {
|
|
10
|
-
const inlineEditorOptions = {
|
|
11
|
-
maxLines: 10,
|
|
12
|
-
...options,
|
|
13
|
-
minLines: 1,
|
|
14
|
-
showGutter: false,
|
|
15
|
-
highlightActiveLine: false,
|
|
16
|
-
highlightGutterLine: false,
|
|
17
|
-
};
|
|
18
|
-
return (react_1.default.createElement(base_editor_1.BaseEditor, { options: inlineEditorOptions, editorClassName: "inline-editor", ...props }));
|
|
19
|
-
};
|
|
20
|
-
exports.InlineEditor = InlineEditor;
|
|
21
|
-
//# sourceMappingURL=inline-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-editor.js","sourceRoot":"","sources":["../src/inline-editor.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,+CAA2C;AAS3C,MAAM,YAAY,GAA+C,CAAC,EAChE,OAAO,EACP,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,wBAAU,IACT,OAAO,EAAE,mBAAmB,EAC5B,eAAe,EAAC,eAAe,KAC3B,KAAK,GACG,CACf,CAAC;AACJ,CAAC,CAAC;AAEO,oCAAY"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { IconGlyph } from '@mongodb-js/compass-components';
|
|
2
|
-
import type { Ace } from 'ace-builds';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import type { EditorProps as BaseEditorProps } from './base-editor';
|
|
5
|
-
type CustomActionItem = {
|
|
6
|
-
icon: IconGlyph;
|
|
7
|
-
action: string;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
type EditorProps = Omit<BaseEditorProps, 'editorClassName'> & {
|
|
11
|
-
copyable?: boolean;
|
|
12
|
-
formattable?: boolean;
|
|
13
|
-
customActions?: CustomActionItem[];
|
|
14
|
-
onAction?: (editor: Ace.Editor | undefined, action: string) => void;
|
|
15
|
-
};
|
|
16
|
-
declare const MultilineEditor: React.FunctionComponent<EditorProps>;
|
|
17
|
-
export { MultilineEditor as Editor };
|
|
18
|
-
//# sourceMappingURL=multiline-editor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiline-editor.d.ts","sourceRoot":"","sources":["../src/multiline-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAGhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAGpE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,GAAG;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrE,CAAC;AA8BF,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CA2EzD,CAAC;AAEF,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,CAAC"}
|
package/dist/multiline-editor.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Editor = void 0;
|
|
27
|
-
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
28
|
-
const compass_components_2 = require("@mongodb-js/compass-components");
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const actions_1 = require("./actions");
|
|
31
|
-
const base_editor_1 = require("./base-editor");
|
|
32
|
-
const multilineEditorContainerStyle = (0, compass_components_2.css)({
|
|
33
|
-
position: 'relative',
|
|
34
|
-
height: '100%',
|
|
35
|
-
[`&:focus-within > .multiline-editor-actions,
|
|
36
|
-
&:hover > .multiline-editor-actions`]: {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
const editorContainerStyle = (0, compass_components_2.css)({
|
|
41
|
-
overflow: 'auto',
|
|
42
|
-
paddingTop: compass_components_2.spacing[1],
|
|
43
|
-
height: `calc(100% - ${compass_components_2.spacing[1]}px)`,
|
|
44
|
-
minHeight: 'inherit',
|
|
45
|
-
});
|
|
46
|
-
const actionsContainerStyle = (0, compass_components_2.css)({
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
top: compass_components_2.spacing[1],
|
|
49
|
-
right: compass_components_2.spacing[2],
|
|
50
|
-
display: 'none',
|
|
51
|
-
gap: compass_components_2.spacing[2],
|
|
52
|
-
});
|
|
53
|
-
const MultilineEditor = ({ copyable = true, formattable = true, customActions = [], onAction, onLoad, className, ...props }) => {
|
|
54
|
-
const editorRef = (0, react_1.useRef)();
|
|
55
|
-
const actions = (0, react_1.useMemo)(() => {
|
|
56
|
-
return [
|
|
57
|
-
copyable && (react_1.default.createElement(actions_1.ActionButton, { key: "Copy", label: "Copy", icon: "Copy", onClick: () => {
|
|
58
|
-
var _a;
|
|
59
|
-
(_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.execCommand('copy-all');
|
|
60
|
-
return true;
|
|
61
|
-
} })),
|
|
62
|
-
formattable && (react_1.default.createElement(actions_1.ActionButton, { key: "Format", label: "Format", icon: react_1.default.createElement(actions_1.FormatIcon, { size: 14, role: "presentation" }), onClick: () => {
|
|
63
|
-
var _a;
|
|
64
|
-
(_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.execCommand('prettify');
|
|
65
|
-
return true;
|
|
66
|
-
} })),
|
|
67
|
-
...customActions.map((action) => {
|
|
68
|
-
return (react_1.default.createElement(actions_1.ActionButton, { key: action.action, icon: action.icon, label: action.label, onClick: () => {
|
|
69
|
-
onAction === null || onAction === void 0 ? void 0 : onAction(editorRef.current, action.action);
|
|
70
|
-
} }));
|
|
71
|
-
}),
|
|
72
|
-
];
|
|
73
|
-
}, [copyable, formattable, customActions, onAction]);
|
|
74
|
-
return (react_1.default.createElement("div", { className: (0, compass_components_1.cx)(multilineEditorContainerStyle, className) },
|
|
75
|
-
react_1.default.createElement("div", { className: editorContainerStyle },
|
|
76
|
-
react_1.default.createElement(base_editor_1.BaseEditor, { onLoad: (editor) => {
|
|
77
|
-
editorRef.current = editor;
|
|
78
|
-
onLoad === null || onLoad === void 0 ? void 0 : onLoad(editor);
|
|
79
|
-
}, ...props })),
|
|
80
|
-
actions.length > 0 && (react_1.default.createElement("div", { className: (0, compass_components_1.cx)('multiline-editor-actions', actionsContainerStyle) }, actions))));
|
|
81
|
-
};
|
|
82
|
-
exports.Editor = MultilineEditor;
|
|
83
|
-
//# sourceMappingURL=multiline-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiline-editor.js","sourceRoot":"","sources":["../src/multiline-editor.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uEAAoD;AACpD,uEAA8D;AAE9D,+CAA+C;AAC/C,uCAAqD;AAErD,+CAA2C;AAe3C,MAAM,6BAA6B,GAAG,IAAA,wBAAG,EAAC;IACxC,QAAQ,EAAE,UAAU;IACpB,MAAM,EAA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json-editor';
|
|
3
|
-
export declare const SyntaxHighlight: React.FunctionComponent<Omit<React.ComponentProps<typeof BaseEditor>, 'onChangeText' | 'onLoad' | 'highlightActiveLine' | 'readOnly' | 'completer' | 'commands' | 'placeholder'> & ({
|
|
4
|
-
text: string;
|
|
5
|
-
initialText?: never;
|
|
6
|
-
} | {
|
|
7
|
-
text?: never;
|
|
8
|
-
initialText: string;
|
|
9
|
-
})>;
|
|
10
|
-
//# sourceMappingURL=syntax-highlight.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlight.d.ts","sourceRoot":"","sources":["../src/syntax-highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwB3C,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACnD,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EACrC,cAAc,GACd,QAAQ,GACR,qBAAqB,GACrB,UAAU,GACV,WAAW,GACX,UAAU,GACV,aAAa,CAChB,GACC,CACI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GACrC;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CACxC,CASJ,CAAC"}
|
package/dist/syntax-highlight.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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.SyntaxHighlight = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
9
|
-
const json_editor_1 = require("./json-editor");
|
|
10
|
-
const syntaxHighlightStyles = (0, compass_components_1.css)({
|
|
11
|
-
'& .cm-editor': {
|
|
12
|
-
backgroundColor: 'transparent',
|
|
13
|
-
},
|
|
14
|
-
'& .cm-line': {
|
|
15
|
-
paddingLeft: 1,
|
|
16
|
-
paddingRight: 1,
|
|
17
|
-
},
|
|
18
|
-
'& .cm-content': {
|
|
19
|
-
padding: 0,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
const SyntaxHighlight = ({ className, ...props }) => {
|
|
23
|
-
return (react_1.default.createElement(json_editor_1.BaseEditor, { ...props, className: (0, compass_components_1.cx)(syntaxHighlightStyles, className), readOnly: true }));
|
|
24
|
-
};
|
|
25
|
-
exports.SyntaxHighlight = SyntaxHighlight;
|
|
26
|
-
//# sourceMappingURL=syntax-highlight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlight.js","sourceRoot":"","sources":["../src/syntax-highlight.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uEAAyD;AACzD,+CAA2C;AAK3C,MAAM,qBAAqB,GAAG,IAAA,wBAAG,EAAC;IAChC,cAAc,EAAE;QACd,eAAe,EAAE,aAAa;KAC/B;IACD,YAAY,EAAE;QAGZ,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;KAChB;IACD,eAAe,EAAE;QACf,OAAO,EAAE,CAAC;KACX;CACF,CAAC,CAAC;AAMI,MAAM,eAAe,GAexB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC9B,OAAO,CACL,8BAAC,wBAAU,OACL,KAAK,EACT,SAAS,EAAE,IAAA,uBAAE,EAAC,qBAAqB,EAAE,SAAS,CAAC,EAC/C,QAAQ,SACI,CACf,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,eAAe,mBAuB1B"}
|