@jupyterlab/cells 4.0.0-alpha.1 → 4.0.0-alpha.10

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.
@@ -0,0 +1,600 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { CodeMirrorSearchHighlighter } from '@jupyterlab/codemirror';
4
+ import { GenericSearchProvider, TextSearchEngine } from '@jupyterlab/documentsearch';
5
+ import { Signal } from '@lumino/signaling';
6
+ /**
7
+ * Class applied on highlighted search matches
8
+ */
9
+ export const SELECTED_HIGHLIGHT_CLASS = 'jp-mod-selected';
10
+ /**
11
+ * Search provider for cells.
12
+ */
13
+ export class CellSearchProvider {
14
+ /**
15
+ * Constructor
16
+ *
17
+ * @param cell Cell widget
18
+ */
19
+ constructor(cell) {
20
+ this.cell = cell;
21
+ /**
22
+ * Current match index
23
+ */
24
+ this.currentIndex = null;
25
+ /**
26
+ * Current search query
27
+ */
28
+ this.query = null;
29
+ this._isActive = true;
30
+ this._isDisposed = false;
31
+ this._lastReplacementPosition = null;
32
+ this.currentIndex = null;
33
+ this._stateChanged = new Signal(this);
34
+ this.cmHandler = new CodeMirrorSearchHighlighter(this.cell.editor);
35
+ }
36
+ /**
37
+ * Changed signal to be emitted when search matches change.
38
+ */
39
+ get stateChanged() {
40
+ return this._stateChanged;
41
+ }
42
+ /**
43
+ * Current match index
44
+ */
45
+ get currentMatchIndex() {
46
+ return this.isActive ? this.currentIndex : null;
47
+ }
48
+ /**
49
+ * Whether the cell search is active.
50
+ *
51
+ * This is used when applying search only on selected cells.
52
+ */
53
+ get isActive() {
54
+ return this._isActive;
55
+ }
56
+ /**
57
+ * Whether the search provider is disposed or not.
58
+ */
59
+ get isDisposed() {
60
+ return this._isDisposed;
61
+ }
62
+ /**
63
+ * Number of matches in the cell.
64
+ */
65
+ get matchesCount() {
66
+ return this.isActive ? this.cmHandler.matches.length : 0;
67
+ }
68
+ /**
69
+ * Clear currently highlighted match
70
+ */
71
+ clearHighlight() {
72
+ this.currentIndex = null;
73
+ this.cmHandler.clearHighlight();
74
+ return Promise.resolve();
75
+ }
76
+ /**
77
+ * Dispose the search provider
78
+ */
79
+ dispose() {
80
+ if (this._isDisposed) {
81
+ return;
82
+ }
83
+ this._isDisposed = true;
84
+ Signal.clearData(this);
85
+ if (this.isActive) {
86
+ this.endQuery().catch(reason => {
87
+ console.error(`Failed to end search query on cells.`, reason);
88
+ });
89
+ }
90
+ }
91
+ /**
92
+ * Set `isActive` status.
93
+ *
94
+ * #### Notes
95
+ * It will start or end the search
96
+ *
97
+ * @param v New value
98
+ */
99
+ async setIsActive(v) {
100
+ if (this._isActive !== v) {
101
+ this._isActive = v;
102
+ }
103
+ if (this._isActive) {
104
+ if (this.query !== null) {
105
+ await this.startQuery(this.query, this.filters);
106
+ }
107
+ }
108
+ else {
109
+ await this.endQuery();
110
+ }
111
+ }
112
+ /**
113
+ * Initialize the search using the provided options. Should update the UI
114
+ * to highlight all matches and "select" the first match.
115
+ *
116
+ * @param query A RegExp to be use to perform the search
117
+ * @param filters Filter parameters to pass to provider
118
+ */
119
+ async startQuery(query, filters) {
120
+ this.query = query;
121
+ this.filters = filters;
122
+ // Search input
123
+ const content = this.cell.model.modelDB.get('value');
124
+ await this._updateCodeMirror(content);
125
+ content.changed.connect(this.onInputChanged, this);
126
+ }
127
+ /**
128
+ * Stop the search and clean any UI elements.
129
+ */
130
+ async endQuery() {
131
+ await this.cmHandler.endQuery();
132
+ this.currentIndex = null;
133
+ }
134
+ /**
135
+ * Highlight the next match.
136
+ *
137
+ * @returns The next match if there is one.
138
+ */
139
+ async highlightNext() {
140
+ if (this.matchesCount === 0 || !this.isActive) {
141
+ this.currentIndex = null;
142
+ }
143
+ else {
144
+ if (this._lastReplacementPosition) {
145
+ this.cell.editor.setCursorPosition(this._lastReplacementPosition);
146
+ this._lastReplacementPosition = null;
147
+ }
148
+ // This starts from the cursor position
149
+ let match = await this.cmHandler.highlightNext();
150
+ if (match) {
151
+ this.currentIndex = this.cmHandler.currentIndex;
152
+ }
153
+ else {
154
+ this.currentIndex = null;
155
+ }
156
+ return match;
157
+ }
158
+ return Promise.resolve(this.getCurrentMatch());
159
+ }
160
+ /**
161
+ * Highlight the previous match.
162
+ *
163
+ * @returns The previous match if there is one.
164
+ */
165
+ async highlightPrevious() {
166
+ if (this.matchesCount === 0 || !this.isActive) {
167
+ this.currentIndex = null;
168
+ }
169
+ else {
170
+ // This starts from the cursor position
171
+ let match = await this.cmHandler.highlightPrevious();
172
+ if (match) {
173
+ this.currentIndex = this.cmHandler.currentIndex;
174
+ }
175
+ else {
176
+ this.currentIndex = null;
177
+ }
178
+ return match;
179
+ }
180
+ return Promise.resolve(this.getCurrentMatch());
181
+ }
182
+ /**
183
+ * Replace the currently selected match with the provided text.
184
+ *
185
+ * If no match is selected, it won't do anything.
186
+ *
187
+ * @param newText The replacement text.
188
+ * @returns Whether a replace occurred.
189
+ */
190
+ replaceCurrentMatch(newText) {
191
+ if (!this.isActive) {
192
+ return Promise.resolve(false);
193
+ }
194
+ let occurred = false;
195
+ if (this.currentIndex !== null &&
196
+ this.currentIndex < this.cmHandler.matches.length) {
197
+ const editor = this.cell.editor;
198
+ const selection = editor.doc.getSelection();
199
+ const match = this.getCurrentMatch();
200
+ // If cursor is not on a selection, highlight the next match
201
+ if (selection !== (match === null || match === void 0 ? void 0 : match.text)) {
202
+ this.currentIndex = null;
203
+ // The next will be highlighted as a consequence of this returning false
204
+ }
205
+ else {
206
+ this.cmHandler.matches.splice(this.currentIndex, 1);
207
+ this.currentIndex = null;
208
+ // Store the current position to highlight properly the next search hit
209
+ this._lastReplacementPosition = editor.getCursorPosition();
210
+ this.cell.model.value.text =
211
+ this.cell.model.value.text.slice(0, match.position) +
212
+ newText +
213
+ this.cell.model.value.text.slice(match.position + match.text.length);
214
+ occurred = true;
215
+ }
216
+ }
217
+ return Promise.resolve(occurred);
218
+ }
219
+ /**
220
+ * Replace all matches in the cell source with the provided text
221
+ *
222
+ * @param newText The replacement text.
223
+ * @returns Whether a replace occurred.
224
+ */
225
+ replaceAllMatches(newText) {
226
+ if (!this.isActive) {
227
+ return Promise.resolve(false);
228
+ }
229
+ let occurred = this.cmHandler.matches.length > 0;
230
+ let src = this.cell.model.value.text;
231
+ let lastEnd = 0;
232
+ const finalSrc = this.cmHandler.matches.reduce((agg, match) => {
233
+ const start = match.position;
234
+ const end = start + match.text.length;
235
+ const newStep = `${agg}${src.slice(lastEnd, start)}${newText}`;
236
+ lastEnd = end;
237
+ return newStep;
238
+ }, '');
239
+ if (occurred) {
240
+ this.cmHandler.matches = [];
241
+ this.currentIndex = null;
242
+ this.cell.model.value.text = `${finalSrc}${src.slice(lastEnd)}`;
243
+ }
244
+ return Promise.resolve(occurred);
245
+ }
246
+ /**
247
+ * Get the current match if it exists.
248
+ *
249
+ * @returns The current match
250
+ */
251
+ getCurrentMatch() {
252
+ if (this.currentIndex === null) {
253
+ return undefined;
254
+ }
255
+ else {
256
+ let match = undefined;
257
+ if (this.currentIndex < this.cmHandler.matches.length) {
258
+ match = this.cmHandler.matches[this.currentIndex];
259
+ }
260
+ return match;
261
+ }
262
+ }
263
+ /**
264
+ * Callback on source change
265
+ *
266
+ * @param content Cell source
267
+ * @param changes Source change
268
+ */
269
+ async onInputChanged(content, changes) {
270
+ await this._updateCodeMirror(content);
271
+ this._stateChanged.emit();
272
+ }
273
+ async _updateCodeMirror(content) {
274
+ if (this.query !== null) {
275
+ if (this.isActive) {
276
+ this.cmHandler.matches = await TextSearchEngine.search(this.query, content.text);
277
+ }
278
+ else {
279
+ this.cmHandler.matches = [];
280
+ }
281
+ }
282
+ }
283
+ }
284
+ /**
285
+ * Code cell search provider
286
+ */
287
+ class CodeCellSearchProvider extends CellSearchProvider {
288
+ /**
289
+ * Constructor
290
+ *
291
+ * @param cell Cell widget
292
+ */
293
+ constructor(cell) {
294
+ super(cell);
295
+ this.currentProviderIndex = -1;
296
+ this.outputsProvider = [];
297
+ const outputs = this.cell.outputArea;
298
+ this._onOutputsChanged(outputs, outputs.widgets.length).catch(reason => {
299
+ console.error(`Failed to initialize search on cell outputs.`, reason);
300
+ });
301
+ outputs.outputLengthChanged.connect(this._onOutputsChanged, this);
302
+ outputs.disposed.connect(() => {
303
+ outputs.outputLengthChanged.disconnect(this._onOutputsChanged);
304
+ }, this);
305
+ }
306
+ /**
307
+ * Number of matches in the cell.
308
+ */
309
+ get matchesCount() {
310
+ if (!this.isActive) {
311
+ return 0;
312
+ }
313
+ return (super.matchesCount +
314
+ this.outputsProvider.reduce((sum, provider) => { var _a; return sum + ((_a = provider.matchesCount) !== null && _a !== void 0 ? _a : 0); }, 0));
315
+ }
316
+ /**
317
+ * Clear currently highlighted match.
318
+ */
319
+ async clearHighlight() {
320
+ await super.clearHighlight();
321
+ await Promise.all(this.outputsProvider.map(provider => provider.clearHighlight()));
322
+ }
323
+ /**
324
+ * Dispose the search provider
325
+ */
326
+ dispose() {
327
+ if (this.isDisposed) {
328
+ return;
329
+ }
330
+ super.dispose();
331
+ this.outputsProvider.map(provider => {
332
+ provider.dispose();
333
+ });
334
+ this.outputsProvider.length = 0;
335
+ }
336
+ /**
337
+ * Highlight the next match.
338
+ *
339
+ * @returns The next match if there is one.
340
+ */
341
+ async highlightNext() {
342
+ if (this.matchesCount === 0 || !this.isActive) {
343
+ this.currentIndex = null;
344
+ }
345
+ else {
346
+ if (this.currentProviderIndex === -1) {
347
+ const match = await super.highlightNext();
348
+ if (match) {
349
+ this.currentIndex = this.cmHandler.currentIndex;
350
+ return match;
351
+ }
352
+ else {
353
+ this.currentProviderIndex = 0;
354
+ }
355
+ }
356
+ while (this.currentProviderIndex < this.outputsProvider.length) {
357
+ const provider = this.outputsProvider[this.currentProviderIndex];
358
+ const match = await provider.highlightNext(false);
359
+ if (match) {
360
+ this.currentIndex =
361
+ super.matchesCount +
362
+ this.outputsProvider
363
+ .slice(0, this.currentProviderIndex)
364
+ .reduce((sum, provider) => { var _a; return (sum += (_a = provider.matchesCount) !== null && _a !== void 0 ? _a : 0); }, 0) +
365
+ provider.currentMatchIndex;
366
+ return match;
367
+ }
368
+ else {
369
+ this.currentProviderIndex += 1;
370
+ }
371
+ }
372
+ this.currentProviderIndex = -1;
373
+ this.currentIndex = null;
374
+ return undefined;
375
+ }
376
+ }
377
+ /**
378
+ * Highlight the previous match.
379
+ *
380
+ * @returns The previous match if there is one.
381
+ */
382
+ async highlightPrevious() {
383
+ if (this.matchesCount === 0 || !this.isActive) {
384
+ this.currentIndex = null;
385
+ }
386
+ else {
387
+ if (this.currentIndex === null) {
388
+ this.currentProviderIndex = this.outputsProvider.length - 1;
389
+ }
390
+ while (this.currentProviderIndex >= 0) {
391
+ const provider = this.outputsProvider[this.currentProviderIndex];
392
+ const match = await provider.highlightPrevious(false);
393
+ if (match) {
394
+ this.currentIndex =
395
+ super.matchesCount +
396
+ this.outputsProvider
397
+ .slice(0, this.currentProviderIndex)
398
+ .reduce((sum, provider) => { var _a; return (sum += (_a = provider.matchesCount) !== null && _a !== void 0 ? _a : 0); }, 0) +
399
+ provider.currentMatchIndex;
400
+ return match;
401
+ }
402
+ else {
403
+ this.currentProviderIndex -= 1;
404
+ }
405
+ }
406
+ const match = await super.highlightPrevious();
407
+ if (match) {
408
+ this.currentIndex = this.cmHandler.currentIndex;
409
+ return match;
410
+ }
411
+ else {
412
+ this.currentIndex = null;
413
+ return undefined;
414
+ }
415
+ }
416
+ }
417
+ /**
418
+ * Initialize the search using the provided options. Should update the UI to highlight
419
+ * all matches and "select" the first match.
420
+ *
421
+ * @param query A RegExp to be use to perform the search
422
+ * @param filters Filter parameters to pass to provider
423
+ */
424
+ async startQuery(query, filters) {
425
+ await super.startQuery(query, filters);
426
+ // Search outputs
427
+ if ((filters === null || filters === void 0 ? void 0 : filters.output) !== false && this.isActive) {
428
+ await Promise.all(this.outputsProvider.map(provider => provider.startQuery(query)));
429
+ }
430
+ }
431
+ async endQuery() {
432
+ var _a;
433
+ await super.endQuery();
434
+ if (((_a = this.filters) === null || _a === void 0 ? void 0 : _a.output) !== false && this.isActive) {
435
+ await Promise.all(this.outputsProvider.map(provider => provider.endQuery()));
436
+ }
437
+ }
438
+ async _onOutputsChanged(outputArea, changes) {
439
+ var _a;
440
+ this.outputsProvider.forEach(provider => {
441
+ provider.dispose();
442
+ });
443
+ this.outputsProvider.length = 0;
444
+ this.currentProviderIndex = -1;
445
+ this.outputsProvider = this.cell.outputArea.widgets.map(output => new GenericSearchProvider(output));
446
+ if (this.isActive && this.query && ((_a = this.filters) === null || _a === void 0 ? void 0 : _a.output) !== false) {
447
+ await Promise.all([
448
+ this.outputsProvider.map(provider => {
449
+ provider.startQuery(this.query);
450
+ })
451
+ ]);
452
+ }
453
+ this._stateChanged.emit();
454
+ }
455
+ }
456
+ /**
457
+ * Markdown cell search provider
458
+ */
459
+ class MarkdownCellSearchProvider extends CellSearchProvider {
460
+ /**
461
+ * Constructor
462
+ *
463
+ * @param cell Cell widget
464
+ */
465
+ constructor(cell) {
466
+ super(cell);
467
+ this._unrenderedByHighligh = false;
468
+ this.renderedProvider = new GenericSearchProvider(cell.renderer);
469
+ }
470
+ /**
471
+ * Clear currently highlighted match
472
+ */
473
+ async clearHighlight() {
474
+ await super.clearHighlight();
475
+ await this.renderedProvider.clearHighlight();
476
+ }
477
+ /**
478
+ * Dispose the search provider
479
+ */
480
+ dispose() {
481
+ if (this.isDisposed) {
482
+ return;
483
+ }
484
+ super.dispose();
485
+ this.renderedProvider.dispose();
486
+ }
487
+ /**
488
+ * Stop the search and clean any UI elements.
489
+ */
490
+ async endQuery() {
491
+ await super.endQuery();
492
+ await this.renderedProvider.endQuery();
493
+ }
494
+ /**
495
+ * Highlight the next match.
496
+ *
497
+ * @returns The next match if there is one.
498
+ */
499
+ async highlightNext() {
500
+ let match = undefined;
501
+ if (!this.isActive) {
502
+ return match;
503
+ }
504
+ const cell = this.cell;
505
+ if (cell.rendered && this.matchesCount > 0) {
506
+ // Unrender the cell
507
+ this._unrenderedByHighligh = true;
508
+ cell.rendered = false;
509
+ }
510
+ match = await super.highlightNext();
511
+ return match;
512
+ }
513
+ /**
514
+ * Highlight the previous match.
515
+ *
516
+ * @returns The previous match if there is one.
517
+ */
518
+ async highlightPrevious() {
519
+ let match = undefined;
520
+ const cell = this.cell;
521
+ if (cell.rendered && this.matchesCount > 0) {
522
+ // Unrender the cell if there are matches within the cell
523
+ this._unrenderedByHighligh = true;
524
+ cell.rendered = false;
525
+ }
526
+ match = await super.highlightPrevious();
527
+ return match;
528
+ }
529
+ /**
530
+ * Initialize the search using the provided options. Should update the UI
531
+ * to highlight all matches and "select" the first match.
532
+ *
533
+ * @param query A RegExp to be use to perform the search
534
+ * @param filters Filter parameters to pass to provider
535
+ */
536
+ async startQuery(query, filters) {
537
+ await super.startQuery(query, filters);
538
+ const cell = this.cell;
539
+ if (cell.rendered) {
540
+ this.onRenderedChanged(cell, cell.rendered);
541
+ }
542
+ cell.renderedChanged.connect(this.onRenderedChanged, this);
543
+ }
544
+ /**
545
+ * Replace all matches in the cell source with the provided text
546
+ *
547
+ * @param newText The replacement text.
548
+ * @returns Whether a replace occurred.
549
+ */
550
+ async replaceAllMatches(newText) {
551
+ const result = await super.replaceAllMatches(newText);
552
+ // if the cell is rendered force update
553
+ if (this.cell.rendered) {
554
+ this.cell.update();
555
+ }
556
+ return result;
557
+ }
558
+ /**
559
+ * Callback on rendered state change
560
+ *
561
+ * @param cell Cell that emitted the change
562
+ * @param rendered New rendered value
563
+ */
564
+ onRenderedChanged(cell, rendered) {
565
+ if (!this._unrenderedByHighligh) {
566
+ this.currentIndex = null;
567
+ }
568
+ this._unrenderedByHighligh = false;
569
+ if (this.isActive) {
570
+ if (rendered) {
571
+ this.renderedProvider.startQuery(this.query);
572
+ }
573
+ else {
574
+ // Force cursor position to ensure reverse search is working as expected
575
+ cell.editor.setCursorPosition({ column: 0, line: 0 });
576
+ this.renderedProvider.endQuery();
577
+ }
578
+ }
579
+ }
580
+ }
581
+ /**
582
+ * Factory to create a cell search provider
583
+ *
584
+ * @param cell Cell widget
585
+ * @returns Cell search provider
586
+ */
587
+ export function createCellSearchProvider(cell) {
588
+ if (cell.isPlaceholder()) {
589
+ return new CellSearchProvider(cell);
590
+ }
591
+ switch (cell.model.type) {
592
+ case 'code':
593
+ return new CodeCellSearchProvider(cell);
594
+ case 'markdown':
595
+ return new MarkdownCellSearchProvider(cell);
596
+ default:
597
+ return new CellSearchProvider(cell);
598
+ }
599
+ }
600
+ //# sourceMappingURL=searchprovider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchprovider.js","sourceRoot":"","sources":["../src/searchprovider.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EAIrB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKpD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;OAIG;IACH,YAAsB,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;QAgS5C;;WAEG;QACO,iBAAY,GAAkB,IAAI,CAAC;QAK7C;;WAEG;QACO,UAAK,GAAkB,IAAI,CAAC;QAG9B,cAAS,GAAG,IAAI,CAAC;QACjB,gBAAW,GAAG,KAAK,CAAC;QACpB,6BAAwB,GAAgC,IAAI,CAAC;QA/SnE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,IAAI,MAAM,CAA4B,IAAI,CAAC,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,2BAA2B,CAC9C,IAAI,CAAC,IAAI,CAAC,MAA0B,CACrC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OA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