@difizen/libro-search 0.1.18 → 0.1.20

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.
@@ -1,6 +1,6 @@
1
- import type { CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
2
1
  import { LibroCommandRegister, LibroExtensionSlotContribution } from '@difizen/libro-core';
3
2
  import type { LibroExtensionSlotFactory, LibroSlot, LibroView } from '@difizen/libro-core';
3
+ import type { CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
4
4
  import { ViewManager, CommandContribution, KeybindingContribution } from '@difizen/mana-app';
5
5
  import { LibroSearchView } from './libro-search-view.js';
6
6
  export declare const LibroSearchToggleCommand: {
@@ -1 +1 @@
1
- {"version":3,"file":"libro-search-manager.d.ts","sourceRoot":"","sources":["../src/libro-search-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EAGvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,eAAO,MAAM,wBAAwB;;;;;CASpC,CAAC;AAEF,qBAOa,kBACX,YACE,mBAAmB,EACnB,sBAAsB,EACtB,8BAA8B;IAEX,WAAW,EAAE,WAAW,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IACzE,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAa;IAE5D,SAAgB,IAAI,EAAE,SAAS,CAAe;IAC9C,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAQ1D,gBAAgB,CAAC,QAAQ,EAAE,eAAe;IAa1C,OAAO,EAAE,yBAAyB,CAUhC;IAEF,cAAc,UAAW,SAAS,UAEhC;CACH"}
1
+ {"version":3,"file":"libro-search-manager.d.ts","sourceRoot":"","sources":["../src/libro-search-manager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,sBAAsB,EAGvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,eAAO,MAAM,wBAAwB;;;;;CASpC,CAAC;AAEF,qBAOa,kBACX,YACE,mBAAmB,EACnB,sBAAsB,EACtB,8BAA8B;IAEX,WAAW,EAAE,WAAW,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IACzE,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAa;IAE5D,SAAgB,IAAI,EAAE,SAAS,CAAe;IAC9C,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAQ1D,gBAAgB,CAAC,QAAQ,EAAE,eAAe;IAa1C,OAAO,EAAE,yBAAyB,CAUhC;IAEF,cAAc,UAAW,SAAS,UAEhC;CACH"}
@@ -12,7 +12,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
12
12
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
13
13
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
14
14
  /* eslint-disable @typescript-eslint/no-unused-vars */
15
-
16
15
  import { LibroCommandRegister, LibroExtensionSlotContribution } from '@difizen/libro-core';
17
16
  import { ViewManager, CommandContribution, KeybindingContribution, inject, singleton } from '@difizen/mana-app';
18
17
  import { LibroSearchView } from "./libro-search-view.js";
@@ -1,6 +1,6 @@
1
1
  import type { SearchMatch } from '@difizen/libro-code-editor';
2
2
  import type { CellView, VirtualizedManager } from '@difizen/libro-core';
3
- import { LibroView, VirtualizedManagerHelper } from '@difizen/libro-core';
3
+ import { LibroView, VirtualizedManagerHelper, LirboContextKey } from '@difizen/libro-core';
4
4
  import { Deferred, DisposableCollection } from '@difizen/mana-app';
5
5
  import { AbstractSearchProvider } from './abstract-search-provider.js';
6
6
  import { LibroCellSearchProvider } from './libro-cell-search-provider.js';
@@ -13,6 +13,7 @@ export declare const LibroSearchProviderFactory: unique symbol;
13
13
  * Libro view search provider
14
14
  */
15
15
  export declare class LibroSearchProvider extends AbstractSearchProvider {
16
+ contextKey: LirboContextKey;
16
17
  libroCellSearchProvider: LibroCellSearchProvider;
17
18
  protected cellsChangeDeferred: Deferred<void> | undefined;
18
19
  protected toDispose: DisposableCollection;
@@ -1 +1 @@
1
- {"version":3,"file":"libro-search-provider.d.ts","sourceRoot":"","sources":["../src/libro-search-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAEL,S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AS,CAAC,CAGnE;IAEF;;;;;;OAMG;IACH,iBAAiB,sBAAwB,QAAQ,WAAW,GAAG,SAAS,CAAC,CAGvE;IAEF;;;;;;OAMG;IACH,UAAU,UACD,MAAM,YACH,aAAa,8BAEtB,QAAQ,IAAI,CAAC,CA+Cd;IAEF;;OAEG;IACH,QAAQ,QAAa,QAAQ,IAAI,CAAC,CAShC;IAEF;;;;;;;OAOG;IACH,mBAAmB,YAAmB,MAAM,qBAAgB,QAAQ,OAAO,CAAC,CAyB1E;IAEF;;;;;;OAMG;IACH,iBAAiB,YAAmB,MAAM,KAAG,QAAQ,OAAO,CAAC,CAO3D;IAEF,SAAS,CAAC,eAAe,UAAW,MAAM,UAoBxC;IAEF,SAAS,CAAC,kBAAkB,UAAW,MAAM,UAI3C;IAEF,SAAS,CAAC,cAAc,QAAa,QAAQ,IAAI,CAAC,CAQhD;IAEF,cAAc,QAAa,QAAQ,IAAI,CAAC,CAMtC;IAEF,SAAS,CAAC,cAAc,QAAO,MAAM,GAAG,SAAS,CAW/C;IAEF,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM;IAMxC,SAAS,CAAC,QAAQ,yCAGf,QAAQ,WAAW,GAAG,SAAS,CAAC,CAoFjC;IAEF,mBAAmB,sBAMjB;IAEF,SAAS,CAAC,uBAAuB,aAK/B;IAEF,SAAS,CAAC,mBAAmB,sBAU3B;CACH"}
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
2
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
3
3
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
4
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
5
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
20
20
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
21
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
22
22
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
23
- import { EditorCellView, LibroView, VirtualizedManagerHelper } from '@difizen/libro-core';
23
+ import { EditorCellView, LibroView, VirtualizedManagerHelper, LirboContextKey } from '@difizen/libro-core';
24
24
  import { inject, prop, transient, equals } from '@difizen/mana-app';
25
25
  import { Deferred, DisposableCollection } from '@difizen/mana-app';
26
26
  import { l10n } from '@difizen/mana-l10n';
@@ -35,7 +35,7 @@ export var LibroSearchProviderFactory = Symbol('LibroSearchProviderFactory');
35
35
  /**
36
36
  * Libro view search provider
37
37
  */
38
- export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSearchProvider), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_AbstractSearchProvid) {
38
+ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LirboContextKey), _dec3 = inject(LibroCellSearchProvider), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_AbstractSearchProvid) {
39
39
  _inherits(LibroSearchProvider, _AbstractSearchProvid);
40
40
  var _super = _createSuper(LibroSearchProvider);
41
41
  /**
@@ -45,15 +45,16 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
45
45
  var _this;
46
46
  _classCallCheck(this, LibroSearchProvider);
47
47
  _this = _super.call(this, option);
48
- _initializerDefineProperty(_this, "libroCellSearchProvider", _descriptor, _assertThisInitialized(_this));
48
+ _initializerDefineProperty(_this, "contextKey", _descriptor, _assertThisInitialized(_this));
49
+ _initializerDefineProperty(_this, "libroCellSearchProvider", _descriptor2, _assertThisInitialized(_this));
49
50
  _this.toDispose = new DisposableCollection();
50
- _initializerDefineProperty(_this, "currentProviderIndex", _descriptor2, _assertThisInitialized(_this));
51
- _initializerDefineProperty(_this, "searchCellOutput", _descriptor3, _assertThisInitialized(_this));
52
- _initializerDefineProperty(_this, "onlySearchSelectedCells", _descriptor4, _assertThisInitialized(_this));
53
- _initializerDefineProperty(_this, "replaceMode", _descriptor5, _assertThisInitialized(_this));
51
+ _initializerDefineProperty(_this, "currentProviderIndex", _descriptor3, _assertThisInitialized(_this));
52
+ _initializerDefineProperty(_this, "searchCellOutput", _descriptor4, _assertThisInitialized(_this));
53
+ _initializerDefineProperty(_this, "onlySearchSelectedCells", _descriptor5, _assertThisInitialized(_this));
54
+ _initializerDefineProperty(_this, "replaceMode", _descriptor6, _assertThisInitialized(_this));
54
55
  _this.query = undefined;
55
- _initializerDefineProperty(_this, "searchProviders", _descriptor6, _assertThisInitialized(_this));
56
- _initializerDefineProperty(_this, "providerMap", _descriptor7, _assertThisInitialized(_this));
56
+ _initializerDefineProperty(_this, "searchProviders", _descriptor7, _assertThisInitialized(_this));
57
+ _initializerDefineProperty(_this, "providerMap", _descriptor8, _assertThisInitialized(_this));
57
58
  _this.documentHasChanged = false;
58
59
  _this.getProvider = function (cell) {
59
60
  return _this.providerMap.get(cell.id);
@@ -65,7 +66,7 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
65
66
  * @returns Initial value used to populate the search box.
66
67
  */
67
68
  _this.getInitialQuery = function () {
68
- var activeCell = _this.view.model.active;
69
+ var activeCell = _this.view.activeCell;
69
70
  if (activeCell) {
70
71
  return _this.libroCellSearchProvider.getInitialQuery(activeCell);
71
72
  }
@@ -162,15 +163,21 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
162
163
  while (1) switch (_context5.prev = _context5.next) {
163
164
  case 0:
164
165
  highlightNext = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : true;
165
- if (_this.view) {
166
+ if (!(_this.contextKey.commandModeEnabled === true)) {
166
167
  _context5.next = 3;
167
168
  break;
168
169
  }
169
170
  return _context5.abrupt("return");
170
171
  case 3:
171
- _context5.next = 5;
172
- return _this.endQuery();
172
+ if (_this.view) {
173
+ _context5.next = 5;
174
+ break;
175
+ }
176
+ return _context5.abrupt("return");
173
177
  case 5:
178
+ _context5.next = 7;
179
+ return _this.endQuery();
180
+ case 7:
174
181
  cells = _this.view.model.cells;
175
182
  _this.query = query;
176
183
 
@@ -180,7 +187,7 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
180
187
  // this.view.model.selectionChanged.connect(this._onSelectionChanged, this);
181
188
  }
182
189
  // For each cell, create a search provider
183
- _context5.next = 10;
190
+ _context5.next = 12;
184
191
  return Promise.all(cells.map( /*#__PURE__*/function () {
185
192
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cell) {
186
193
  var _cellSearchProvider;
@@ -214,19 +221,19 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
214
221
  return _ref5.apply(this, arguments);
215
222
  };
216
223
  }()));
217
- case 10:
224
+ case 12:
218
225
  _this.searchProviders = _context5.sent;
219
226
  _this.currentProviderIndex = _this.getActiveIndex();
220
227
  if (!(!_this.documentHasChanged && highlightNext)) {
221
- _context5.next = 15;
228
+ _context5.next = 17;
222
229
  break;
223
230
  }
224
- _context5.next = 15;
231
+ _context5.next = 17;
225
232
  return _this.highlightNext(false);
226
- case 15:
233
+ case 17:
227
234
  _this.documentHasChanged = false;
228
235
  return _context5.abrupt("return", Promise.resolve());
229
- case 17:
236
+ case 19:
230
237
  case "end":
231
238
  return _context5.stop();
232
239
  }
@@ -446,16 +453,9 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
446
453
  if (!elementInViewport(node)) {
447
454
  try {
448
455
  if (_this.view.activeCell) {
449
- if (_this.virtualizedManager.isVirtualized) {
450
- if (EditorCellView.is(activeCell)) {
451
- line = (_activeCell$editor = activeCell.editor) === null || _activeCell$editor === void 0 || (_activeCell$editor = _activeCell$editor.getPositionAt(match.position)) === null || _activeCell$editor === void 0 ? void 0 : _activeCell$editor.line;
452
- _this.view.model.scrollToCellView({
453
- cellIndex: _this.view.activeCellIndex,
454
- lineIndex: line
455
- });
456
- }
457
- } else {
458
- _this.view.model.scrollToView(_this.view.activeCell);
456
+ if (EditorCellView.is(activeCell)) {
457
+ line = (_activeCell$editor = activeCell.editor) === null || _activeCell$editor === void 0 || (_activeCell$editor = _activeCell$editor.getPositionAt(match.position)) === null || _activeCell$editor === void 0 ? void 0 : _activeCell$editor.line;
458
+ _this.view.model.scrollToView(_this.view.activeCell, (line !== null && line !== void 0 ? line : 0) * 20);
459
459
  }
460
460
  }
461
461
  } catch (error) {
@@ -766,47 +766,52 @@ export var LibroSearchProvider = (_dec = transient(), _dec2 = inject(LibroCellSe
766
766
  }
767
767
  }]);
768
768
  return LibroSearchProvider;
769
- }(AbstractSearchProvider), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "libroCellSearchProvider", [_dec2], {
769
+ }(AbstractSearchProvider), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "contextKey", [_dec2], {
770
+ configurable: true,
771
+ enumerable: true,
772
+ writable: true,
773
+ initializer: null
774
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "libroCellSearchProvider", [_dec3], {
770
775
  configurable: true,
771
776
  enumerable: true,
772
777
  writable: true,
773
778
  initializer: null
774
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "currentProviderIndex", [_dec3], {
779
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "currentProviderIndex", [_dec4], {
775
780
  configurable: true,
776
781
  enumerable: true,
777
782
  writable: true,
778
783
  initializer: function initializer() {
779
784
  return undefined;
780
785
  }
781
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "searchCellOutput", [_dec4], {
786
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "searchCellOutput", [_dec5], {
782
787
  configurable: true,
783
788
  enumerable: true,
784
789
  writable: true,
785
790
  initializer: function initializer() {
786
791
  return false;
787
792
  }
788
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "onlySearchSelectedCells", [_dec5], {
793
+ }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "onlySearchSelectedCells", [_dec6], {
789
794
  configurable: true,
790
795
  enumerable: true,
791
796
  writable: true,
792
797
  initializer: function initializer() {
793
798
  return false;
794
799
  }
795
- }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "replaceMode", [_dec6], {
800
+ }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "replaceMode", [_dec7], {
796
801
  configurable: true,
797
802
  enumerable: true,
798
803
  writable: true,
799
804
  initializer: function initializer() {
800
805
  return false;
801
806
  }
802
- }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "searchProviders", [_dec7], {
807
+ }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "searchProviders", [_dec8], {
803
808
  configurable: true,
804
809
  enumerable: true,
805
810
  writable: true,
806
811
  initializer: function initializer() {
807
812
  return [];
808
813
  }
809
- }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "providerMap", [_dec8], {
814
+ }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "providerMap", [_dec9], {
810
815
  configurable: true,
811
816
  enumerable: true,
812
817
  writable: true,
@@ -28,6 +28,7 @@ export declare class LibroSearchView extends BaseView {
28
28
  caseSensitive: boolean;
29
29
  useRegex: boolean;
30
30
  isSearching: boolean;
31
+ hasFocus: boolean;
31
32
  view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
32
33
  get contentHeight(): number;
33
34
  get currentMatchIndex(): number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"libro-search-view.d.ts","sourceRoot":"","sources":["../src/libro-search-view.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAsB,MAAM,mBAAmB,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B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AAC,EAAE,SAAS,CAAC;IACV,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,aAAa,UAAS;IAC9B,IAAI,cAAc,IAAI,OAAO,CAE5B;IACO,cAAc,UAAS;IACvB,OAAO,CAAC,EAAE,MAAM,CAAa;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAa;IAChC,UAAU,SAAM;IAChB,aAAa,UAAS;IACtB,QAAQ,UAAS;IACjB,WAAW,UAAS;IAC5B,QAAQ,UAAS;IAER,IAAI,2FAAmB;IAEhC,IAAI,aAAa,WAShB;IACD,IAAI,iBAAiB,uBAMpB;IACD,IAAI,YAAY,uBAEf;IAEQ,WAAW,aAsBlB;IAEF,mBAAmB,aAIjB;IAEF,cAAc,aAIZ;IAEF,iBAAiB,sBAGf;IAEF,IAAI,aAKF;IACF,IAAI,aAQF;IAEF,OAAO,aAEL;IAEF,MAAM,MAAO,gBAAgB,CAAC,cAAc,CAAC,UAI3C;IAEF,MAAM,8CAgBJ;IACF,aAAa,aAKX;IAEF,aAAa,aAGX;IAEF,mBAAmB,aAGjB;IAEF,cAAc,aAGZ;IAEF,IAAI,aAEF;IAEF,QAAQ,aAEN;IAEF,sBAAsB,MAAO,mBAAmB,UAI9C;IAEF,OAAO,aAEL;IACF,UAAU,aAER;IACF,YAAY,aAMV;IACF,eAAe,eAUb;IAEF,SAAS,YAAmB,OAAO,mBAMjC;IAEF,aAAa,MAAO,aAAa,UAqB/B;IAEF,gBAAgB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAKxD;IAEF,mBAAmB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAE3D;CACH"}
@@ -99,6 +99,12 @@ export var SearchContent = function SearchContent() {
99
99
  onChange: instance.handleFindChange,
100
100
  size: "small",
101
101
  placeholder: "\u641C\u7D22",
102
+ onFocus: function onFocus() {
103
+ instance.hasFocus = true;
104
+ },
105
+ onBlur: function onBlur() {
106
+ instance.hasFocus = false;
107
+ },
102
108
  suffix: /*#__PURE__*/_jsxs("span", {
103
109
  className: "libro-search-input-suffix",
104
110
  children: [/*#__PURE__*/_jsx(IconFont, {
@@ -226,6 +232,7 @@ export var LibroSearchView = (_dec = transient(), _dec2 = view('libro-search-vie
226
232
  _initializerDefineProperty(_this, "caseSensitive", _descriptor10, _assertThisInitialized(_this));
227
233
  _initializerDefineProperty(_this, "useRegex", _descriptor11, _assertThisInitialized(_this));
228
234
  _initializerDefineProperty(_this, "isSearching", _descriptor12, _assertThisInitialized(_this));
235
+ _this.hasFocus = false;
229
236
  _this.view = SearchComponent;
230
237
  _this.onViewMount = function () {
231
238
  if (!_this.searchProvider && _this.libro) {
@@ -236,6 +243,18 @@ export var LibroSearchView = (_dec = transient(), _dec2 = view('libro-search-vie
236
243
  _this.toDispose.push(_this.libro.model.onSourceChanged(function () {
237
244
  return _this.onCellsChanged();
238
245
  }));
246
+ _this.toDispose.push(_this.libro.model.onCellViewChanged(function () {
247
+ return _this.onCellsChanged();
248
+ }));
249
+ _this.toDispose.push(_this.libro.model.onCommandModeChanged(function (mode) {
250
+ if (mode) {
251
+ setTimeout(function () {
252
+ if (_this.hasFocus === false) {
253
+ _this.hide();
254
+ }
255
+ }, 0);
256
+ }
257
+ }));
239
258
  }
240
259
  };
241
260
  _this.onActiveCellChanged = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-search",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -36,9 +36,9 @@
36
36
  "@difizen/mana-app": "latest",
37
37
  "@difizen/mana-l10n": "latest",
38
38
  "@ant-design/icons": "^5.1.0",
39
- "@difizen/libro-common": "^0.1.18",
40
- "@difizen/libro-core": "^0.1.18",
41
- "@difizen/libro-code-editor": "^0.1.18",
39
+ "@difizen/libro-common": "^0.1.20",
40
+ "@difizen/libro-core": "^0.1.20",
41
+ "@difizen/libro-code-editor": "^0.1.20",
42
42
  "@types/lodash.debounce": "^4.0.7",
43
43
  "classnames": "^2.3.2",
44
44
  "lodash.debounce": "^4.0.8",
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import type { CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
3
2
  import {
4
3
  LibroCommandRegister,
5
4
  LibroExtensionSlotContribution,
@@ -9,6 +8,7 @@ import type {
9
8
  LibroSlot,
10
9
  LibroView,
11
10
  } from '@difizen/libro-core';
11
+ import type { CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
12
12
  import {
13
13
  ViewManager,
14
14
  CommandContribution,
@@ -4,6 +4,7 @@ import {
4
4
  EditorCellView,
5
5
  LibroView,
6
6
  VirtualizedManagerHelper,
7
+ LirboContextKey,
7
8
  } from '@difizen/libro-core';
8
9
  import { inject, prop, transient, equals } from '@difizen/mana-app';
9
10
  import { Deferred, DisposableCollection } from '@difizen/mana-app';
@@ -39,6 +40,7 @@ export const LibroSearchProviderFactory = Symbol('LibroSearchProviderFactory');
39
40
  */
40
41
  @transient()
41
42
  export class LibroSearchProvider extends AbstractSearchProvider {
43
+ @inject(LirboContextKey) contextKey: LirboContextKey;
42
44
  @inject(LibroCellSearchProvider) libroCellSearchProvider: LibroCellSearchProvider;
43
45
  protected cellsChangeDeferred: Deferred<void> | undefined;
44
46
 
@@ -201,7 +203,7 @@ export class LibroSearchProvider extends AbstractSearchProvider {
201
203
  * @returns Initial value used to populate the search box.
202
204
  */
203
205
  override getInitialQuery = (): string => {
204
- const activeCell = this.view.model.active;
206
+ const activeCell = this.view.activeCell;
205
207
  if (activeCell) {
206
208
  return this.libroCellSearchProvider.getInitialQuery(activeCell);
207
209
  }
@@ -254,6 +256,10 @@ export class LibroSearchProvider extends AbstractSearchProvider {
254
256
  filters?: SearchFilters,
255
257
  highlightNext = true,
256
258
  ): Promise<void> => {
259
+ if (this.contextKey.commandModeEnabled === true) {
260
+ return;
261
+ }
262
+
257
263
  if (!this.view) {
258
264
  return;
259
265
  }
@@ -447,17 +453,9 @@ export class LibroSearchProvider extends AbstractSearchProvider {
447
453
  if (!elementInViewport(node!)) {
448
454
  try {
449
455
  if (this.view.activeCell) {
450
- if (this.virtualizedManager.isVirtualized) {
451
- if (EditorCellView.is(activeCell)) {
452
- const line = activeCell.editor?.getPositionAt(match.position)?.line;
453
-
454
- this.view.model.scrollToCellView({
455
- cellIndex: this.view.activeCellIndex,
456
- lineIndex: line,
457
- });
458
- }
459
- } else {
460
- this.view.model.scrollToView(this.view.activeCell);
456
+ if (EditorCellView.is(activeCell)) {
457
+ const line = activeCell.editor?.getPositionAt(match.position)?.line;
458
+ this.view.model.scrollToView(this.view.activeCell, (line ?? 0) * 20);
461
459
  }
462
460
  }
463
461
  } catch (error) {
@@ -93,6 +93,12 @@ export const SearchContent = () => {
93
93
  onChange={instance.handleFindChange}
94
94
  size="small"
95
95
  placeholder="搜索"
96
+ onFocus={() => {
97
+ instance.hasFocus = true;
98
+ }}
99
+ onBlur={() => {
100
+ instance.hasFocus = false;
101
+ }}
96
102
  suffix={
97
103
  <span className="libro-search-input-suffix">
98
104
  <IconFont
@@ -228,6 +234,7 @@ export class LibroSearchView extends BaseView {
228
234
  @prop() caseSensitive = false;
229
235
  @prop() useRegex = false;
230
236
  @prop() isSearching = false;
237
+ hasFocus = false;
231
238
 
232
239
  override view = SearchComponent;
233
240
 
@@ -259,6 +266,20 @@ export class LibroSearchView extends BaseView {
259
266
  this.toDispose.push(
260
267
  this.libro.model.onSourceChanged(() => this.onCellsChanged()),
261
268
  );
269
+ this.toDispose.push(
270
+ this.libro.model.onCellViewChanged(() => this.onCellsChanged()),
271
+ );
272
+ this.toDispose.push(
273
+ this.libro.model.onCommandModeChanged((mode) => {
274
+ if (mode) {
275
+ setTimeout(() => {
276
+ if (this.hasFocus === false) {
277
+ this.hide();
278
+ }
279
+ }, 0);
280
+ }
281
+ }),
282
+ );
262
283
  }
263
284
  };
264
285