@mongodb-js/compass-shell 2.17.0 → 2.18.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.
Files changed (4) hide show
  1. package/lib/1.js +323 -324
  2. package/lib/2.js +55 -22
  3. package/lib/index.js +211 -171
  4. package/package.json +8 -8
package/lib/2.js CHANGED
@@ -1,10 +1,10 @@
1
1
  (window["webpackJsonpCompassShellPlugin"] = window["webpackJsonpCompassShellPlugin"] || []).push([[2],{
2
2
 
3
- /***/ 106:
3
+ /***/ 108:
4
4
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5
5
 
6
6
  "use strict";
7
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78);
7
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80);
8
8
  /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
9
9
  // Imports
10
10
 
@@ -22,7 +22,7 @@ ___CSS_LOADER_EXPORT___.locals = {
22
22
 
23
23
  /***/ }),
24
24
 
25
- /***/ 107:
25
+ /***/ 109:
26
26
  /***/ (function(module, exports, __webpack_require__) {
27
27
 
28
28
  !function (t, n) {
@@ -2077,11 +2077,11 @@ ___CSS_LOADER_EXPORT___.locals = {
2077
2077
 
2078
2078
  /***/ }),
2079
2079
 
2080
- /***/ 108:
2080
+ /***/ 110:
2081
2081
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2082
2082
 
2083
2083
  "use strict";
2084
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78);
2084
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80);
2085
2085
  /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
2086
2086
  // Imports
2087
2087
 
@@ -2102,11 +2102,11 @@ ___CSS_LOADER_EXPORT___.locals = {
2102
2102
 
2103
2103
  /***/ }),
2104
2104
 
2105
- /***/ 176:
2105
+ /***/ 178:
2106
2106
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2107
2107
 
2108
2108
  "use strict";
2109
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(78);
2109
+ /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80);
2110
2110
  /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
2111
2111
  // Imports
2112
2112
 
@@ -2128,7 +2128,7 @@ ___CSS_LOADER_EXPORT___.locals = {
2128
2128
 
2129
2129
  /***/ }),
2130
2130
 
2131
- /***/ 179:
2131
+ /***/ 181:
2132
2132
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2133
2133
 
2134
2134
  "use strict";
@@ -2143,15 +2143,15 @@ var external_react_ = __webpack_require__(0);
2143
2143
  var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
2144
2144
 
2145
2145
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/classnames/index.js
2146
- var classnames = __webpack_require__(64);
2146
+ var classnames = __webpack_require__(66);
2147
2147
  var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
2148
2148
 
2149
2149
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
2150
- var injectStylesIntoStyleTag = __webpack_require__(77);
2150
+ var injectStylesIntoStyleTag = __webpack_require__(79);
2151
2151
  var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
2152
2152
 
2153
2153
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/css-loader/dist/cjs.js??ref--5-1!/Users/alenakhineika/www/compass/node_modules/postcss-loader/lib??ref--5-2!/Users/alenakhineika/www/compass/node_modules/less-loader/dist/cjs.js??ref--5-3!./src/components/compass-shell/compass-shell.module.less
2154
- var compass_shell_module = __webpack_require__(106);
2154
+ var compass_shell_module = __webpack_require__(108);
2155
2155
 
2156
2156
  // CONCATENATED MODULE: ./src/components/compass-shell/compass-shell.module.less
2157
2157
 
@@ -2172,28 +2172,28 @@ var external_prop_types_ = __webpack_require__(23);
2172
2172
  var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
2173
2173
 
2174
2174
  // EXTERNAL MODULE: ./node_modules/react-redux/es/index.js + 25 modules
2175
- var es = __webpack_require__(21);
2175
+ var es = __webpack_require__(20);
2176
2176
 
2177
2177
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/@mongosh/browser-repl/lib/mongosh-browser-repl.js
2178
- var mongosh_browser_repl = __webpack_require__(86);
2178
+ var mongosh_browser_repl = __webpack_require__(88);
2179
2179
 
2180
2180
  // EXTERNAL MODULE: external "@mongodb-js/compass-components"
2181
- var compass_components_ = __webpack_require__(60);
2181
+ var compass_components_ = __webpack_require__(62);
2182
2182
 
2183
2183
  // EXTERNAL MODULE: ../hadron-react-buttons/lib/index.js
2184
- var lib = __webpack_require__(107);
2184
+ var lib = __webpack_require__(109);
2185
2185
 
2186
2186
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/react-bootstrap/es/Modal.js + 16 modules
2187
- var Modal = __webpack_require__(178);
2187
+ var Modal = __webpack_require__(180);
2188
2188
 
2189
2189
  // EXTERNAL MODULE: ../compass-logging/dist/index.js
2190
- var dist = __webpack_require__(20);
2190
+ var dist = __webpack_require__(19);
2191
2191
 
2192
2192
  // EXTERNAL MODULE: ./package.json
2193
2193
  var package_0 = __webpack_require__(4);
2194
2194
 
2195
2195
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/css-loader/dist/cjs.js??ref--5-1!/Users/alenakhineika/www/compass/node_modules/postcss-loader/lib??ref--5-2!/Users/alenakhineika/www/compass/node_modules/less-loader/dist/cjs.js??ref--5-3!./src/components/info-modal/info-modal.module.less
2196
- var info_modal_module = __webpack_require__(108);
2196
+ var info_modal_module = __webpack_require__(110);
2197
2197
 
2198
2198
  // CONCATENATED MODULE: ./src/components/info-modal/info-modal.module.less
2199
2199
 
@@ -2224,6 +2224,9 @@ const {
2224
2224
  const mongoshVersion = `v${package_0.dependencies['@mongosh/browser-repl'].replace('^', '')}`;
2225
2225
 
2226
2226
  const hotkeys = [{
2227
+ key: 'Ctrl+`',
2228
+ description: 'Toggle shell.'
2229
+ }, {
2227
2230
  key: 'Ctrl+A',
2228
2231
  description: 'Moves the cursor to the beginning of the line.'
2229
2232
  }, {
@@ -2280,6 +2283,8 @@ class info_modal_InfoModal extends external_react_["PureComponent"] {
2280
2283
  show
2281
2284
  } = this.props;
2282
2285
  return /*#__PURE__*/external_react_default.a.createElement(Modal["a" /* default */], {
2286
+ restoreFocus: false,
2287
+ onEscapeKeyDown: hideInfoModal,
2283
2288
  show: show,
2284
2289
  onShow: this.showHandler
2285
2290
  }, /*#__PURE__*/external_react_default.a.createElement(Modal["a" /* default */].Header, {
@@ -2330,7 +2335,7 @@ _defineProperty(info_modal_InfoModal, "propTypes", {
2330
2335
 
2331
2336
  /* harmony default export */ var components_info_modal = (info_modal);
2332
2337
  // EXTERNAL MODULE: /Users/alenakhineika/www/compass/node_modules/css-loader/dist/cjs.js??ref--5-1!/Users/alenakhineika/www/compass/node_modules/postcss-loader/lib??ref--5-2!/Users/alenakhineika/www/compass/node_modules/less-loader/dist/cjs.js??ref--5-3!./src/components/shell-header/shell-header.module.less
2333
- var shell_header_module = __webpack_require__(176);
2338
+ var shell_header_module = __webpack_require__(178);
2334
2339
 
2335
2340
  // CONCATENATED MODULE: ./src/components/shell-header/shell-header.module.less
2336
2341
 
@@ -2356,11 +2361,29 @@ function shell_header_defineProperty(obj, key, value) { if (key in obj) { Object
2356
2361
 
2357
2362
 
2358
2363
  class shell_header_ShellHeader extends external_react_["Component"] {
2364
+ componentDidMount() {
2365
+ document.addEventListener('keydown', this.handleKeyboardToggle.bind(this));
2366
+ }
2367
+
2368
+ componentWillUnmount() {
2369
+ document.removeEventListener('keydown', this.handleKeyboardToggle.bind(this));
2370
+ }
2371
+
2372
+ handleKeyboardToggle({
2373
+ ctrlKey,
2374
+ key
2375
+ }) {
2376
+ if (ctrlKey && key === '`') {
2377
+ this.props.onShellToggleClicked();
2378
+ }
2379
+ }
2359
2380
  /**
2360
2381
  * Render ShellHeader component.
2361
2382
  *
2362
2383
  * @returns {React.Component} The rendered component.
2363
2384
  */
2385
+
2386
+
2364
2387
  render() {
2365
2388
  const {
2366
2389
  isExpanded,
@@ -2505,6 +2528,7 @@ class compass_shell_CompassShell extends external_react_["Component"] {
2505
2528
  }
2506
2529
  });
2507
2530
 
2531
+ this.shellRef = /*#__PURE__*/external_react_default.a.createRef();
2508
2532
  this.shellOutput = this.props.shellOutput || [];
2509
2533
  this.state = {
2510
2534
  height: shellHeightClosed,
@@ -2544,6 +2568,16 @@ class compass_shell_CompassShell extends external_react_["Component"] {
2544
2568
  height
2545
2569
  });
2546
2570
  }
2571
+
2572
+ hideInfoModal() {
2573
+ this.setState({
2574
+ showInfoModal: false
2575
+ });
2576
+
2577
+ if (this.shellRef.current) {
2578
+ this.shellRef.current.focusEditor();
2579
+ }
2580
+ }
2547
2581
  /**
2548
2582
  * Render CompassShell component.
2549
2583
  *
@@ -2567,9 +2601,7 @@ class compass_shell_CompassShell extends external_react_["Component"] {
2567
2601
  const renderedHeight = isExpanded ? boundShellHeight(height) : shellHeightClosed;
2568
2602
  return /*#__PURE__*/external_react_default.a.createElement(external_react_["Fragment"], null, /*#__PURE__*/external_react_default.a.createElement(components_info_modal, {
2569
2603
  show: showInfoModal,
2570
- hideInfoModal: () => this.setState({
2571
- showInfoModal: false
2572
- })
2604
+ hideInfoModal: this.hideInfoModal.bind(this)
2573
2605
  }), /*#__PURE__*/external_react_default.a.createElement("div", {
2574
2606
  "data-test-id": "shell-section",
2575
2607
  className: compass_shell_compass_shell_module['compass-shell'],
@@ -2597,6 +2629,7 @@ class compass_shell_CompassShell extends external_react_["Component"] {
2597
2629
  [compass_shell_compass_shell_module['compass-shell-shell-container-visible']]: isExpanded
2598
2630
  })
2599
2631
  }, /*#__PURE__*/external_react_default.a.createElement(mongosh_browser_repl["Shell"], {
2632
+ ref: this.shellRef,
2600
2633
  runtime: this.props.runtime,
2601
2634
  initialHistory: this.state.initialHistory,
2602
2635
  initialOutput: this.shellOutput,