@difizen/libro-search 0.1.1 → 0.1.2
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/es/abstract-search-provider.d.ts +2 -1
- package/es/abstract-search-provider.d.ts.map +1 -1
- package/es/index.less +10 -8
- package/es/libro-search-engine-text.d.ts +1 -1
- package/es/libro-search-generic-provider.d.ts +5 -4
- package/es/libro-search-generic-provider.d.ts.map +1 -1
- package/es/libro-search-generic-provider.js +11 -11
- package/es/libro-search-manager.d.ts +1 -1
- package/es/libro-search-manager.d.ts.map +1 -1
- package/es/libro-search-manager.js +3 -3
- package/es/libro-search-model.d.ts +4 -4
- package/es/libro-search-model.d.ts.map +1 -1
- package/es/libro-search-model.js +19 -9
- package/es/libro-search-protocol.d.ts +1 -13
- package/es/libro-search-protocol.d.ts.map +1 -1
- package/es/libro-search-protocol.js +0 -5
- package/es/libro-search-provider.d.ts +11 -7
- package/es/libro-search-provider.d.ts.map +1 -1
- package/es/libro-search-provider.js +70 -13
- package/es/libro-search-utils.d.ts +1 -1
- package/es/libro-search-utils.d.ts.map +1 -1
- package/es/libro-search-utils.js +11 -7
- package/es/libro-search-view.d.ts +11 -11
- package/es/libro-search-view.d.ts.map +1 -1
- package/es/libro-search-view.js +136 -79
- package/package.json +4 -3
- package/src/abstract-search-provider.ts +1 -2
- package/src/index.less +10 -8
- package/src/libro-search-engine-text.ts +1 -1
- package/src/libro-search-generic-provider.ts +6 -6
- package/src/libro-search-manager.ts +4 -3
- package/src/libro-search-model.ts +10 -11
- package/src/libro-search-protocol.ts +1 -16
- package/src/libro-search-provider.ts +88 -41
- package/src/libro-search-utils.spec.ts +2 -2
- package/src/libro-search-utils.ts +11 -9
- package/src/libro-search-view.tsx +63 -43
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { SearchMatch } from '@difizen/libro-code-editor';
|
|
1
2
|
import type { Event } from '@difizen/mana-app';
|
|
2
3
|
import type { View } from '@difizen/mana-app';
|
|
3
4
|
import { Emitter } from '@difizen/mana-app';
|
|
4
|
-
import type { SearchFilter, SearchFilters,
|
|
5
|
+
import type { SearchFilter, SearchFilters, SearchProvider } from './libro-search-protocol.js';
|
|
5
6
|
/**
|
|
6
7
|
* Abstract class implementing the search provider interface.
|
|
7
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-search-provider.d.ts","sourceRoot":"","sources":["../src/abstract-search-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"abstract-search-provider.d.ts","sourceRoot":"","sources":["../src/abstract-search-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC;;GAEG;AACH,8BACsB,sBAAuB,YAAW,cAAc;IAEpE,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAiB;IACvD,SAAS,CAAC,SAAS,UAAS;IAC5B,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;IACrB,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD;;OAEG;gBACS,MAAM,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IAIlC;;OAEG;IACH,IAAI,YAAY,IAAI,KAA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background-color: var(--mana-color-bg-elevated);
|
|
7
5
|
z-index: 2000;
|
|
6
|
+
background-color: var(--mana-color-bg-elevated);
|
|
7
|
+
box-shadow: 0 2px 2px 0 #7c68681a;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.libro-search-content {
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
|
-
padding: 2px 6px;
|
|
14
13
|
min-width: 320px;
|
|
14
|
+
padding: 2px 6px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.libro-search-row {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
18
20
|
height: 32px;
|
|
19
21
|
|
|
20
22
|
input {
|
|
@@ -22,18 +24,18 @@
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
.ant-btn {
|
|
27
|
+
margin-left: 4px;
|
|
25
28
|
border: none;
|
|
26
29
|
box-shadow: none;
|
|
27
|
-
margin-left: 4px;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.libro-search-replace-toggle {
|
|
32
|
-
padding: 4px;
|
|
33
34
|
display: flex;
|
|
34
35
|
align-items: center;
|
|
35
36
|
height: 100%;
|
|
36
37
|
margin-right: 4px;
|
|
38
|
+
padding: 4px;
|
|
37
39
|
cursor: pointer;
|
|
38
40
|
|
|
39
41
|
&:hover {
|
|
@@ -42,8 +44,8 @@
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
.libro-search-input {
|
|
45
|
-
align-items: center;
|
|
46
47
|
flex: 1;
|
|
48
|
+
align-items: center;
|
|
47
49
|
|
|
48
50
|
.ant-input-affix-wrapper-sm {
|
|
49
51
|
margin-right: 4px;
|
|
@@ -67,12 +69,12 @@
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
.libro-search-index {
|
|
70
|
-
// width: 24px;
|
|
71
72
|
display: flex;
|
|
72
73
|
align-items: center;
|
|
73
74
|
justify-content: center;
|
|
74
|
-
|
|
75
|
+
width: 50px;
|
|
75
76
|
margin-right: 16px;
|
|
77
|
+
margin-left: 4px;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
.libro-search-action {
|
|
@@ -80,7 +80,7 @@ export declare class GenericSearchProvider extends AbstractSearchProvider {
|
|
|
80
80
|
*
|
|
81
81
|
* @returns A promise that resolves with a boolean indicating whether a replace occurred.
|
|
82
82
|
*/
|
|
83
|
-
replaceCurrentMatch(
|
|
83
|
+
replaceCurrentMatch(newText: string, loop?: boolean): Promise<boolean>;
|
|
84
84
|
/**
|
|
85
85
|
* Replace all matches in the notebook with the provided text
|
|
86
86
|
*
|
|
@@ -88,7 +88,7 @@ export declare class GenericSearchProvider extends AbstractSearchProvider {
|
|
|
88
88
|
*
|
|
89
89
|
* @returns A promise that resolves with a boolean indicating whether a replace occurred.
|
|
90
90
|
*/
|
|
91
|
-
replaceAllMatches(
|
|
91
|
+
replaceAllMatches(newText: string): Promise<boolean>;
|
|
92
92
|
/**
|
|
93
93
|
* Initialize the search using the provided options. Should update the UI
|
|
94
94
|
* to highlight all matches and "select" whatever the first match should be.
|
|
@@ -96,12 +96,13 @@ export declare class GenericSearchProvider extends AbstractSearchProvider {
|
|
|
96
96
|
* @param query A RegExp to be use to perform the search
|
|
97
97
|
* @param filters Filter parameters to pass to provider
|
|
98
98
|
*/
|
|
99
|
-
startQuery: (query: RegExp | null,
|
|
99
|
+
startQuery: (query: RegExp | null, filters?: {}) => Promise<void>;
|
|
100
100
|
/**
|
|
101
101
|
* Clear the highlighted matches and any internal state.
|
|
102
102
|
*/
|
|
103
103
|
endQuery(): Promise<void>;
|
|
104
104
|
protected _highlightNext(reverse: boolean, loop: boolean): HTMLSearchMatch | null;
|
|
105
|
-
protected _onWidgetChanged(
|
|
105
|
+
protected _onWidgetChanged(mutations: MutationRecord[], observer: MutationObserver): Promise<void>;
|
|
106
106
|
}
|
|
107
|
+
export declare function elementInViewport(el: HTMLElement): boolean;
|
|
107
108
|
//# sourceMappingURL=libro-search-generic-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-search-generic-provider.d.ts","sourceRoot":"","sources":["../src/libro-search-generic-provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAGL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,4BAA4B,GAAG,CACzC,MAAM,EAAE,oBAAoB,KACzB,qBAAqB,CAAC;AAC3B,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AACnF;;GAEG;AACH,qBACa,qBAAsB,SAAQ,sBAAsB;IAC/D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAM;IACnD,SAAS,CAAC,iBAAiB,EAAE,gBAAgB,CAE3C;IACF,SAAS,CAAC,UAAU,oBAAgC;IACpD;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO;IAI1C;;OAEG;IACH,IAAa,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAEnD;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,eAAe,GAAG,SAAS,CAE9C;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,eAAe,EAAE,CAM/B;IAED;;OAEG;IACH,IAAa,YAAY,IAAI,MAAM,GAAG,SAAS,CAE9C;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAU,QAAQ;gBAEe,MAAM,EAAE,oBAAoB;IAGtE;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B;;;;;;;;;;OAUG;IACM,OAAO,IAAI,IAAI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IAAa,YAAY,IAAI,MAAM,GAAG,SAAS,CAE9C;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAU,QAAQ;gBAEe,MAAM,EAAE,oBAAoB;IAGtE;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B;;;;;;;;;;OAUG;IACM,OAAO,IAAI,IAAI;IAWxB;;;;;;OAMG;IACG,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAIzE;;;;;;OAMG;IACG,iBAAiB,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAI7E;;;;;;;OAOG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5E;;;;;;OAMG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1D;;;;;;OAMG;IACH,UAAU,UAAiB,MAAM,GAAG,IAAI,mBAAiB,QAAQ,IAAI,CAAC,CAuDpE;IAEF;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAY/B,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI;cA0CjE,gBAAgB,CAC9B,SAAS,EAAE,cAAc,EAAE,EAC3B,QAAQ,EAAE,gBAAgB;CAO7B;AACD,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAU1D"}
|
|
@@ -64,16 +64,16 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
64
64
|
_this.startQuery = /*#__PURE__*/function () {
|
|
65
65
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query) {
|
|
66
66
|
var _this$view$container, _this$view$container2, _this$view$container3;
|
|
67
|
-
var
|
|
67
|
+
var filters,
|
|
68
68
|
matches,
|
|
69
69
|
nodeIdx,
|
|
70
|
-
|
|
70
|
+
_loop,
|
|
71
71
|
_this$view$container4,
|
|
72
72
|
_args2 = arguments;
|
|
73
73
|
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
74
74
|
while (1) switch (_context2.prev = _context2.next) {
|
|
75
75
|
case 0:
|
|
76
|
-
|
|
76
|
+
filters = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
77
77
|
_context2.next = 3;
|
|
78
78
|
return _this.endQuery();
|
|
79
79
|
case 3:
|
|
@@ -100,9 +100,9 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
100
100
|
matches = _context2.t0;
|
|
101
101
|
// Transform the DOM
|
|
102
102
|
nodeIdx = 0;
|
|
103
|
-
|
|
103
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
104
104
|
var activeNode, parent, subMatches, markedNodes, i;
|
|
105
|
-
return _regeneratorRuntime().wrap(function
|
|
105
|
+
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
106
106
|
while (1) switch (_context.prev = _context.next) {
|
|
107
107
|
case 0:
|
|
108
108
|
activeNode = matches[nodeIdx].node;
|
|
@@ -130,14 +130,14 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
130
130
|
case "end":
|
|
131
131
|
return _context.stop();
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, _loop);
|
|
134
134
|
});
|
|
135
135
|
case 16:
|
|
136
136
|
if (!(nodeIdx < matches.length)) {
|
|
137
137
|
_context2.next = 20;
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
|
-
return _context2.delegateYield(
|
|
140
|
+
return _context2.delegateYield(_loop(), "t1", 18);
|
|
141
141
|
case 18:
|
|
142
142
|
_context2.next = 16;
|
|
143
143
|
break;
|
|
@@ -311,7 +311,7 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
311
311
|
}, {
|
|
312
312
|
key: "replaceCurrentMatch",
|
|
313
313
|
value: function () {
|
|
314
|
-
var _replaceCurrentMatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(
|
|
314
|
+
var _replaceCurrentMatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(newText, loop) {
|
|
315
315
|
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
316
316
|
while (1) switch (_context5.prev = _context5.next) {
|
|
317
317
|
case 0:
|
|
@@ -337,7 +337,7 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
337
337
|
}, {
|
|
338
338
|
key: "replaceAllMatches",
|
|
339
339
|
value: function () {
|
|
340
|
-
var _replaceAllMatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(
|
|
340
|
+
var _replaceAllMatches = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(newText) {
|
|
341
341
|
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
342
342
|
while (1) switch (_context6.prev = _context6.next) {
|
|
343
343
|
case 0:
|
|
@@ -420,7 +420,7 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
420
420
|
}, {
|
|
421
421
|
key: "_onWidgetChanged",
|
|
422
422
|
value: function () {
|
|
423
|
-
var _onWidgetChanged2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(
|
|
423
|
+
var _onWidgetChanged2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(mutations, observer) {
|
|
424
424
|
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
425
425
|
while (1) switch (_context8.prev = _context8.next) {
|
|
426
426
|
case 0:
|
|
@@ -461,7 +461,7 @@ export var GenericSearchProvider = (_dec = transient(), _dec2 = prop(), _dec(_cl
|
|
|
461
461
|
return [];
|
|
462
462
|
}
|
|
463
463
|
})), _class2)) || _class);
|
|
464
|
-
function elementInViewport(el) {
|
|
464
|
+
export function elementInViewport(el) {
|
|
465
465
|
var boundingClientRect = el.getBoundingClientRect();
|
|
466
466
|
return boundingClientRect.top >= 0 && boundingClientRect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && boundingClientRect.left >= 0 && boundingClientRect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
467
467
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { CommandRegistry, KeybindingRegistry } from '@difizen/mana-app';
|
|
1
2
|
import { LibroCommandRegister, LibroExtensionSlotContribution } from '@difizen/libro-core';
|
|
2
3
|
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,EACL,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,
|
|
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"}
|
|
@@ -12,9 +12,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
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
|
+
|
|
15
16
|
import { LibroCommandRegister, LibroExtensionSlotContribution } from '@difizen/libro-core';
|
|
16
|
-
import { ViewManager, CommandContribution, KeybindingContribution } from '@difizen/mana-app';
|
|
17
|
-
import { inject, singleton } from '@difizen/mana-app';
|
|
17
|
+
import { ViewManager, CommandContribution, KeybindingContribution, inject, singleton } from '@difizen/mana-app';
|
|
18
18
|
import { LibroSearchView } from "./libro-search-view.js";
|
|
19
19
|
export var LibroSearchToggleCommand = {
|
|
20
20
|
ShowLibroSearch: {
|
|
@@ -80,7 +80,7 @@ export var LibroSearchManager = (_dec = singleton({
|
|
|
80
80
|
value: function registerCommands(commands) {
|
|
81
81
|
var _this2 = this;
|
|
82
82
|
this.libroCommandRegister.registerLibroCommand(commands, LibroSearchToggleCommand.ShowLibroSearch, {
|
|
83
|
-
execute: function execute(
|
|
83
|
+
execute: function execute(cell, libro, position) {
|
|
84
84
|
if (libro) {
|
|
85
85
|
_this2.showSearchView(libro);
|
|
86
86
|
}
|
|
@@ -8,7 +8,7 @@ import { LibroSearchUtils } from './libro-search-utils.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class LibroSearchModel implements Disposable {
|
|
10
10
|
utils: LibroSearchUtils;
|
|
11
|
-
protected _disposed?: boolean;
|
|
11
|
+
protected _disposed?: boolean | undefined;
|
|
12
12
|
protected _caseSensitive: boolean;
|
|
13
13
|
protected parsingError: string;
|
|
14
14
|
protected _filters: SearchFilters;
|
|
@@ -20,13 +20,13 @@ export declare class LibroSearchModel implements Disposable {
|
|
|
20
20
|
protected searchProvider: SearchProvider;
|
|
21
21
|
protected toDispose: DisposableCollection;
|
|
22
22
|
get onDisposed(): import("@difizen/mana-app").Event<void>;
|
|
23
|
-
get disposed(): boolean;
|
|
23
|
+
get disposed(): boolean | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* Search document model
|
|
26
26
|
* @param searchProvider Provider for the current document
|
|
27
27
|
* @param searchDebounceTime Debounce search time
|
|
28
28
|
*/
|
|
29
|
-
constructor(
|
|
29
|
+
constructor(searchProvider: SearchProvider, searchDebounceTime: number);
|
|
30
30
|
/**
|
|
31
31
|
* Whether the search is case sensitive or not.
|
|
32
32
|
*/
|
|
@@ -105,7 +105,7 @@ export declare class LibroSearchModel implements Disposable {
|
|
|
105
105
|
* @param name Filter name
|
|
106
106
|
* @param v Filter value
|
|
107
107
|
*/
|
|
108
|
-
setFilter(
|
|
108
|
+
setFilter(name: string, v: boolean): Promise<void>;
|
|
109
109
|
protected updateSearch(): Promise<void>;
|
|
110
110
|
}
|
|
111
111
|
//# sourceMappingURL=libro-search-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-search-model.d.ts","sourceRoot":"","sources":["../src/libro-search-model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"libro-search-model.d.ts","sourceRoot":"","sources":["../src/libro-search-model.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;GAEG;AACH,qBACa,gBAAiB,YAAW,UAAU;IACvB,KAAK,EAAE,gBAAgB,CAAC;IAClD,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAS;IAClD,SAAS,CAAC,cAAc,UAAS;IACjC,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,QAAQ,EAAE,aAAa,CAG/B;IACF,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC;IAC/B,SAAS,CAAC,iBAAiB,SAAM;IACjC,SAA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G;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxC;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;OAKG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;cAexC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB9C"}
|
package/es/libro-search-model.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
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, _class;
|
|
2
|
+
var _dec, _dec2, _class, _class2, _descriptor;
|
|
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); }); }; }
|
|
6
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
6
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
8
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
9
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
9
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
11
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
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
|
+
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
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
15
|
+
// Copyright (c) Jupyter Development Team.
|
|
16
|
+
// Distributed under the terms of the Modified BSD License.
|
|
17
|
+
|
|
11
18
|
import { DisposableCollection, Emitter } from '@difizen/mana-app';
|
|
12
19
|
import { inject, singleton } from '@difizen/mana-app';
|
|
13
20
|
import debounce from 'lodash.debounce';
|
|
@@ -16,15 +23,16 @@ import { LibroSearchUtils } from "./libro-search-utils.js";
|
|
|
16
23
|
/**
|
|
17
24
|
* Search in a document model.
|
|
18
25
|
*/
|
|
19
|
-
export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/function () {
|
|
26
|
+
export var LibroSearchModel = (_dec = singleton(), _dec2 = inject(LibroSearchUtils), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
20
27
|
/**
|
|
21
28
|
* Search document model
|
|
22
29
|
* @param searchProvider Provider for the current document
|
|
23
30
|
* @param searchDebounceTime Debounce search time
|
|
24
31
|
*/
|
|
25
|
-
function LibroSearchModel(
|
|
32
|
+
function LibroSearchModel(searchProvider, searchDebounceTime) {
|
|
26
33
|
var _this = this;
|
|
27
34
|
_classCallCheck(this, LibroSearchModel);
|
|
35
|
+
_initializerDefineProperty(this, "utils", _descriptor, this);
|
|
28
36
|
this._disposed = false;
|
|
29
37
|
this._caseSensitive = false;
|
|
30
38
|
this.parsingError = '';
|
|
@@ -32,12 +40,10 @@ export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/fu
|
|
|
32
40
|
searchCellOutput: true,
|
|
33
41
|
onlySearchSelectedCells: false
|
|
34
42
|
};
|
|
35
|
-
this._replaceText = '';
|
|
36
43
|
this._searchExpression = '';
|
|
37
44
|
this._useRegex = false;
|
|
38
45
|
this.disposedEmitter = new Emitter();
|
|
39
46
|
this.toDispose = new DisposableCollection();
|
|
40
|
-
this.utils = utils;
|
|
41
47
|
this.searchProvider = searchProvider;
|
|
42
48
|
// this._filters = {};
|
|
43
49
|
// if (this.searchProvider.getFilters) {
|
|
@@ -58,7 +64,6 @@ export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/fu
|
|
|
58
64
|
/**
|
|
59
65
|
* Whether the search is case sensitive or not.
|
|
60
66
|
*/
|
|
61
|
-
LibroSearchModel = inject(LibroSearchUtils)(LibroSearchModel, undefined, 0) || LibroSearchModel;
|
|
62
67
|
_createClass(LibroSearchModel, [{
|
|
63
68
|
key: "onDisposed",
|
|
64
69
|
get: function get() {
|
|
@@ -67,7 +72,7 @@ export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/fu
|
|
|
67
72
|
}, {
|
|
68
73
|
key: "disposed",
|
|
69
74
|
get: function get() {
|
|
70
|
-
return
|
|
75
|
+
return this._disposed;
|
|
71
76
|
}
|
|
72
77
|
}, {
|
|
73
78
|
key: "caseSensitive",
|
|
@@ -338,7 +343,7 @@ export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/fu
|
|
|
338
343
|
}, {
|
|
339
344
|
key: "setFilter",
|
|
340
345
|
value: function () {
|
|
341
|
-
var _setFilter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(
|
|
346
|
+
var _setFilter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(name, v) {
|
|
342
347
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
343
348
|
while (1) switch (_context6.prev = _context6.next) {
|
|
344
349
|
case 0:
|
|
@@ -392,4 +397,9 @@ export var LibroSearchModel = (_dec = singleton(), _dec(_class = /*#__PURE__*/fu
|
|
|
392
397
|
}()
|
|
393
398
|
}]);
|
|
394
399
|
return LibroSearchModel;
|
|
395
|
-
}()
|
|
400
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "utils", [_dec2], {
|
|
401
|
+
configurable: true,
|
|
402
|
+
enumerable: true,
|
|
403
|
+
writable: true,
|
|
404
|
+
initializer: null
|
|
405
|
+
})), _class2)) || _class);
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
+
import type { SearchMatch } from '@difizen/libro-code-editor';
|
|
1
2
|
import type { CellView } from '@difizen/libro-core';
|
|
2
3
|
import type { Disposable, Event } from '@difizen/mana-app';
|
|
3
4
|
import type { View } from '@difizen/mana-app';
|
|
4
5
|
import { Syringe } from '@difizen/mana-app';
|
|
5
|
-
/**
|
|
6
|
-
* Base search match interface
|
|
7
|
-
*/
|
|
8
|
-
export interface SearchMatch {
|
|
9
|
-
/**
|
|
10
|
-
* Text of the exact match itself
|
|
11
|
-
*/
|
|
12
|
-
readonly text: string;
|
|
13
|
-
/**
|
|
14
|
-
* Start location of the match (in a text, this is the column)
|
|
15
|
-
*/
|
|
16
|
-
position: number;
|
|
17
|
-
}
|
|
18
6
|
/**
|
|
19
7
|
* HTML search match interface
|
|
20
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-search-protocol.d.ts","sourceRoot":"","sources":["../src/libro-search-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-search-protocol.d.ts","sourceRoot":"","sources":["../src/libro-search-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,OA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OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE5C;;;;;;;OAOG;IACH,cAAc,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE;AAID,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,kBAAkB,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;CAC9C;AAED,eAAO,MAAM,8BAA8B,sBAE1C,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAKtC,CAAC;AACF,eAAO,MAAM,6BAA6B,UAGzC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAC;CACZ;AACD,eAAO,MAAM,oBAAoB,eAAiC,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { SearchMatch } from '@difizen/libro-code-editor';
|
|
2
|
+
import type { CellView, VirtualizedManager } from '@difizen/libro-core';
|
|
3
|
+
import { LibroView, VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
3
4
|
import { Deferred, DisposableCollection } from '@difizen/mana-app';
|
|
4
5
|
import { AbstractSearchProvider } from './abstract-search-provider.js';
|
|
5
6
|
import { LibroCellSearchProvider } from './libro-cell-search-provider.js';
|
|
6
|
-
import type { CellSearchProvider, SearchFilter, SearchMatch, SearchFilters } from './libro-search-protocol.js';
|
|
7
7
|
import { SearchProviderOption } from './libro-search-protocol.js';
|
|
8
|
+
import type { CellSearchProvider, SearchFilter, SearchFilters } from './libro-search-protocol.js';
|
|
9
|
+
export declare function elementInViewport(el: HTMLElement): boolean;
|
|
8
10
|
export type LibroSearchProviderFactory = (option: SearchProviderOption) => LibroSearchProvider;
|
|
9
11
|
export declare const LibroSearchProviderFactory: unique symbol;
|
|
10
12
|
/**
|
|
@@ -24,11 +26,12 @@ export declare class LibroSearchProvider extends AbstractSearchProvider {
|
|
|
24
26
|
protected providerMap: Map<string, CellSearchProvider>;
|
|
25
27
|
protected documentHasChanged: boolean;
|
|
26
28
|
protected view: LibroView;
|
|
29
|
+
protected virtualizedManager: VirtualizedManager;
|
|
27
30
|
updateSearchCellOutput(value: boolean): void;
|
|
28
31
|
/**
|
|
29
32
|
* @param option Provide the view to search in
|
|
30
33
|
*/
|
|
31
|
-
constructor(option: SearchProviderOption);
|
|
34
|
+
constructor(option: SearchProviderOption, virtualizedManagerHelper: VirtualizedManagerHelper);
|
|
32
35
|
protected getProvider: (cell: CellView) => CellSearchProvider | undefined;
|
|
33
36
|
/**
|
|
34
37
|
* Report whether or not this provider has the ability to search on the given object
|
|
@@ -103,7 +106,7 @@ export declare class LibroSearchProvider extends AbstractSearchProvider {
|
|
|
103
106
|
* @param filters Filter parameters to pass to provider
|
|
104
107
|
*
|
|
105
108
|
*/
|
|
106
|
-
startQuery: (query: RegExp,
|
|
109
|
+
startQuery: (query: RegExp, filters?: SearchFilters, highlightNext?: boolean) => Promise<void>;
|
|
107
110
|
/**
|
|
108
111
|
* Stop the search and clear all internal state.
|
|
109
112
|
*/
|
|
@@ -128,10 +131,11 @@ export declare class LibroSearchProvider extends AbstractSearchProvider {
|
|
|
128
131
|
protected addCellProvider: (index: number) => void;
|
|
129
132
|
protected removeCellProvider: (index: number) => void;
|
|
130
133
|
protected doCellsChanged: () => Promise<void>;
|
|
131
|
-
|
|
134
|
+
onCellsChanged: () => Promise<void>;
|
|
132
135
|
protected getActiveIndex: () => number | undefined;
|
|
136
|
+
protected selectCell(selectIndex: number): void;
|
|
133
137
|
protected stepNext: (reverse?: boolean, loop?: boolean) => Promise<SearchMatch | undefined>;
|
|
134
|
-
|
|
138
|
+
onActiveCellChanged: () => Promise<void>;
|
|
135
139
|
protected onSearchProviderChanged: () => void;
|
|
136
140
|
protected _onSelectionChanged: () => Promise<void>;
|
|
137
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-search-provider.d.ts","sourceRoot":"","sources":["../src/libro-search-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
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,SAAS,EACT,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAU1D;AAED,MAAM,MAAM,0BAA0B,GAAG,CACvC,MAAM,EAAE,oBAAoB,KACzB,mBAAmB,CAAC;AACzB,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAC/E;;GAEG;AACH,qBACa,mBAAoB,SAAQ,sBAAsB;IAC5B,uBAAuB,E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