@jupyterlab/cells 4.0.0-alpha.13 → 4.0.0-alpha.14
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/lib/celldragutils.js +7 -3
- package/lib/celldragutils.js.map +1 -1
- package/lib/inputarea.d.ts +0 -8
- package/lib/inputarea.js +2 -5
- package/lib/inputarea.js.map +1 -1
- package/lib/model.d.ts +48 -66
- package/lib/model.js +152 -342
- package/lib/model.js.map +1 -1
- package/lib/placeholder.d.ts +23 -19
- package/lib/placeholder.js +30 -35
- package/lib/placeholder.js.map +1 -1
- package/lib/searchprovider.d.ts +3 -3
- package/lib/searchprovider.js +26 -15
- package/lib/searchprovider.js.map +1 -1
- package/lib/widget.d.ts +151 -21
- package/lib/widget.js +444 -151
- package/lib/widget.js.map +1 -1
- package/package.json +27 -27
package/lib/celldragutils.js
CHANGED
|
@@ -70,12 +70,13 @@ export var CellDragUtils;
|
|
|
70
70
|
* @param target - The DOM node which triggered the MouseEvent
|
|
71
71
|
*/
|
|
72
72
|
function detectTargetArea(cell, target) {
|
|
73
|
+
var _a, _b;
|
|
73
74
|
let targetArea;
|
|
74
75
|
if (cell) {
|
|
75
|
-
if (cell.editorWidget.node.contains(target)) {
|
|
76
|
+
if ((_a = cell.editorWidget) === null || _a === void 0 ? void 0 : _a.node.contains(target)) {
|
|
76
77
|
targetArea = 'input';
|
|
77
78
|
}
|
|
78
|
-
else if (cell.promptNode.contains(target)) {
|
|
79
|
+
else if ((_b = cell.promptNode) === null || _b === void 0 ? void 0 : _b.contains(target)) {
|
|
79
80
|
targetArea = 'prompt';
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
@@ -123,7 +124,10 @@ export var CellDragUtils;
|
|
|
123
124
|
else {
|
|
124
125
|
promptNumber = '';
|
|
125
126
|
}
|
|
126
|
-
const cellContent = activeCell.model.
|
|
127
|
+
const cellContent = activeCell.model.sharedModel
|
|
128
|
+
.getSource()
|
|
129
|
+
.split('\n')[0]
|
|
130
|
+
.slice(0, 26);
|
|
127
131
|
if (count > 1) {
|
|
128
132
|
if (promptNumber !== '') {
|
|
129
133
|
return VirtualDOM.realize(h.div(h.div({ className: DRAG_IMAGE_CLASS }, h.span({ className: CELL_DRAG_PROMPT_CLASS }, '[' + promptNumber + ']:'), h.span({ className: CELL_DRAG_CONTENT_CLASS }, cellContent)), h.div({ className: CELL_DRAG_MULTIPLE_BACK }, '')));
|
package/lib/celldragutils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"celldragutils.js","sourceRoot":"","sources":["../src/celldragutils.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAU/E,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;GAEG;AAEH;;GAEG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAE5D;;GAEG;AACH,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD;;GAEG;AACH,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAE5D,MAAM,KAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"celldragutils.js","sourceRoot":"","sources":["../src/celldragutils.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAU/E,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;GAEG;AAEH;;GAEG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB;;GAEG;AACH,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAE5D;;GAEG;AACH,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAA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C;aACH;SACF;IACH,CAAC;IA1Ee,iCAAmB,sBA0ElC,CAAA;AACH,CAAC,EApKgB,aAAa,KAAb,aAAa,QAoK7B"}
|
package/lib/inputarea.d.ts
CHANGED
|
@@ -74,14 +74,6 @@ export declare namespace InputArea {
|
|
|
74
74
|
* Defaults to one that uses CodeMirror.
|
|
75
75
|
*/
|
|
76
76
|
contentFactory?: IContentFactory;
|
|
77
|
-
/**
|
|
78
|
-
* Whether to send an update request to the editor when it is shown.
|
|
79
|
-
*/
|
|
80
|
-
updateOnShow?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Whether this input area is a placeholder for future rendering.
|
|
83
|
-
*/
|
|
84
|
-
placeholder?: boolean;
|
|
85
77
|
}
|
|
86
78
|
/**
|
|
87
79
|
* An input area widget content factory.
|
package/lib/inputarea.js
CHANGED
|
@@ -44,16 +44,13 @@ export class InputArea extends Widget {
|
|
|
44
44
|
// Editor
|
|
45
45
|
const editorOptions = {
|
|
46
46
|
model,
|
|
47
|
-
factory: contentFactory.editorFactory
|
|
48
|
-
updateOnShow: options.updateOnShow
|
|
47
|
+
factory: contentFactory.editorFactory
|
|
49
48
|
};
|
|
50
49
|
const editor = (this._editor = new CodeEditorWrapper(editorOptions));
|
|
51
50
|
editor.addClass(INPUT_AREA_EDITOR_CLASS);
|
|
52
51
|
const layout = (this.layout = new PanelLayout());
|
|
53
52
|
layout.addWidget(prompt);
|
|
54
|
-
|
|
55
|
-
layout.addWidget(editor);
|
|
56
|
-
}
|
|
53
|
+
layout.addWidget(editor);
|
|
57
54
|
}
|
|
58
55
|
/**
|
|
59
56
|
* Get the CodeEditorWrapper used by the cell.
|
package/lib/inputarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputarea.js","sourceRoot":"","sources":["../src/inputarea.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,MAA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@ import { CodeEditor } from '@jupyterlab/codeeditor';
|
|
|
4
4
|
import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
5
5
|
import * as nbformat from '@jupyterlab/nbformat';
|
|
6
6
|
import * as models from '@jupyterlab/shared-models';
|
|
7
|
-
import {
|
|
7
|
+
import { IObservableJSON, IObservableValue, ObservableValue } from '@jupyterlab/observables';
|
|
8
8
|
import { IOutputAreaModel } from '@jupyterlab/outputarea';
|
|
9
|
+
import { ISharedCell, ISharedCodeCell, ISharedMarkdownCell, ISharedRawCell } from '@jupyterlab/shared-models';
|
|
9
10
|
/**
|
|
10
11
|
* The definition of a model object for a cell.
|
|
11
12
|
*/
|
|
@@ -25,7 +26,7 @@ export interface ICellModel extends CodeEditor.IModel {
|
|
|
25
26
|
/**
|
|
26
27
|
* A signal emitted when a model state changes.
|
|
27
28
|
*/
|
|
28
|
-
readonly stateChanged: ISignal<ICellModel, IChangedArgs<any>>;
|
|
29
|
+
readonly stateChanged: ISignal<ICellModel, IChangedArgs<boolean, boolean, any>>;
|
|
29
30
|
/**
|
|
30
31
|
* Whether the cell is trusted.
|
|
31
32
|
*/
|
|
@@ -34,7 +35,10 @@ export interface ICellModel extends CodeEditor.IModel {
|
|
|
34
35
|
* The metadata associated with the cell.
|
|
35
36
|
*/
|
|
36
37
|
readonly metadata: IObservableJSON;
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The cell shared model.
|
|
40
|
+
*/
|
|
41
|
+
readonly sharedModel: models.ISharedCell;
|
|
38
42
|
/**
|
|
39
43
|
* Serialize the model to JSON.
|
|
40
44
|
*/
|
|
@@ -83,7 +87,7 @@ export interface ICodeCellModel extends ICellModel {
|
|
|
83
87
|
/**
|
|
84
88
|
* The code cell shared model
|
|
85
89
|
*/
|
|
86
|
-
sharedModel: models.ISharedCodeCell;
|
|
90
|
+
readonly sharedModel: models.ISharedCodeCell;
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
89
93
|
* The definition of a markdown cell.
|
|
@@ -118,10 +122,8 @@ export declare function isRawCellModel(model: ICellModel): model is IRawCellMode
|
|
|
118
122
|
* An implementation of the cell model.
|
|
119
123
|
*/
|
|
120
124
|
export declare class CellModel extends CodeEditor.Model implements ICellModel {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
*/
|
|
124
|
-
constructor(options: CellModel.IOptions);
|
|
125
|
+
constructor(options?: CellModel.IOptions<ISharedCell>);
|
|
126
|
+
readonly sharedModel: models.ISharedCell;
|
|
125
127
|
/**
|
|
126
128
|
* The type of cell.
|
|
127
129
|
*/
|
|
@@ -133,7 +135,7 @@ export declare class CellModel extends CodeEditor.Model implements ICellModel {
|
|
|
133
135
|
/**
|
|
134
136
|
* A signal emitted when a model state changes.
|
|
135
137
|
*/
|
|
136
|
-
readonly stateChanged: Signal<this, IChangedArgs<any, any,
|
|
138
|
+
readonly stateChanged: Signal<this, IChangedArgs<any, any, "trusted" | "isDirty" | "executionCount">>;
|
|
137
139
|
/**
|
|
138
140
|
* The id for the cell.
|
|
139
141
|
*/
|
|
@@ -150,10 +152,6 @@ export declare class CellModel extends CodeEditor.Model implements ICellModel {
|
|
|
150
152
|
* Set the trusted state of the model.
|
|
151
153
|
*/
|
|
152
154
|
set trusted(newValue: boolean);
|
|
153
|
-
/**
|
|
154
|
-
* Serialize the model to JSON.
|
|
155
|
-
*/
|
|
156
|
-
toJSON(): nbformat.ICell;
|
|
157
155
|
/**
|
|
158
156
|
* Handle a change to the trusted state.
|
|
159
157
|
*
|
|
@@ -161,17 +159,18 @@ export declare class CellModel extends CodeEditor.Model implements ICellModel {
|
|
|
161
159
|
*/
|
|
162
160
|
onTrustedChanged(trusted: IObservableValue, args: ObservableValue.IChangedArgs): void;
|
|
163
161
|
/**
|
|
164
|
-
*
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
162
|
+
* Serialize the model to JSON.
|
|
163
|
+
*/
|
|
164
|
+
toJSON(): nbformat.ICell;
|
|
165
|
+
/**
|
|
166
|
+
* Handle a change to the observable value.
|
|
169
167
|
*/
|
|
170
|
-
|
|
168
|
+
protected onGenericChange(): void;
|
|
171
169
|
/**
|
|
172
170
|
* Handle a change to the cell metadata modelDB and reflect it in the shared model.
|
|
173
171
|
*/
|
|
174
172
|
protected onModelDBMetadataChange(sender: IObservableJSON, event: IObservableJSON.IChangedArgs): void;
|
|
173
|
+
protected onSharedModelChanged(sender: models.ISharedCell, change: models.CellChange<models.ISharedBaseCellMetadata>): void;
|
|
175
174
|
/**
|
|
176
175
|
* Change the cell metadata for a given event.
|
|
177
176
|
*
|
|
@@ -179,22 +178,6 @@ export declare class CellModel extends CodeEditor.Model implements ICellModel {
|
|
|
179
178
|
* @param event The event to handle.
|
|
180
179
|
*/
|
|
181
180
|
private _changeCellMetadata;
|
|
182
|
-
/**
|
|
183
|
-
* Handle a change to the cell shared model and reflect it in modelDB.
|
|
184
|
-
* We update the modeldb metadata when the shared model changes.
|
|
185
|
-
*
|
|
186
|
-
* This method overrides the CodeEditor protected _onSharedModelChanged
|
|
187
|
-
* so we first call super._onSharedModelChanged
|
|
188
|
-
*
|
|
189
|
-
* @override CodeEditor._onSharedModelChanged
|
|
190
|
-
*/
|
|
191
|
-
protected _onSharedModelChanged(sender: models.ISharedCodeCell, change: models.CellChange<models.ISharedBaseCellMetadata>): void;
|
|
192
|
-
private _updateModelDBMetadata;
|
|
193
|
-
/**
|
|
194
|
-
* Handle a change to the observable value.
|
|
195
|
-
*/
|
|
196
|
-
protected onGenericChange(): void;
|
|
197
|
-
sharedModel: models.ISharedCell;
|
|
198
181
|
}
|
|
199
182
|
/**
|
|
200
183
|
* The namespace for `CellModel` statics.
|
|
@@ -203,19 +186,19 @@ export declare namespace CellModel {
|
|
|
203
186
|
/**
|
|
204
187
|
* The options used to initialize a `CellModel`.
|
|
205
188
|
*/
|
|
206
|
-
interface IOptions {
|
|
189
|
+
interface IOptions<T extends ISharedCell> {
|
|
207
190
|
/**
|
|
208
|
-
*
|
|
191
|
+
* A unique identifier for the model.
|
|
209
192
|
*/
|
|
210
|
-
|
|
193
|
+
id?: string;
|
|
211
194
|
/**
|
|
212
|
-
*
|
|
195
|
+
* The cell shared model.
|
|
213
196
|
*/
|
|
214
|
-
|
|
197
|
+
sharedModel?: T;
|
|
215
198
|
/**
|
|
216
|
-
*
|
|
199
|
+
* Whether the cell is trusted or not.
|
|
217
200
|
*/
|
|
218
|
-
|
|
201
|
+
trusted?: boolean;
|
|
219
202
|
}
|
|
220
203
|
}
|
|
221
204
|
/**
|
|
@@ -225,7 +208,7 @@ export declare class AttachmentsCellModel extends CellModel {
|
|
|
225
208
|
/**
|
|
226
209
|
* Construct a new cell with optional attachments.
|
|
227
210
|
*/
|
|
228
|
-
constructor(options: AttachmentsCellModel.IOptions);
|
|
211
|
+
constructor(options: AttachmentsCellModel.IOptions<ISharedCell>);
|
|
229
212
|
/**
|
|
230
213
|
* Get the attachments of the model.
|
|
231
214
|
*/
|
|
@@ -243,7 +226,7 @@ export declare namespace AttachmentsCellModel {
|
|
|
243
226
|
/**
|
|
244
227
|
* The options used to initialize a `AttachmentsCellModel`.
|
|
245
228
|
*/
|
|
246
|
-
interface IOptions extends CellModel.IOptions {
|
|
229
|
+
interface IOptions<T extends ISharedCell> extends CellModel.IOptions<T> {
|
|
247
230
|
/**
|
|
248
231
|
* The factory for attachment model creation.
|
|
249
232
|
*/
|
|
@@ -276,6 +259,10 @@ export declare namespace AttachmentsCellModel {
|
|
|
276
259
|
* An implementation of a raw cell model.
|
|
277
260
|
*/
|
|
278
261
|
export declare class RawCellModel extends AttachmentsCellModel {
|
|
262
|
+
/**
|
|
263
|
+
* Construct a raw cell model from optional shared model.
|
|
264
|
+
*/
|
|
265
|
+
constructor(options?: AttachmentsCellModel.IOptions<ISharedRawCell>);
|
|
279
266
|
/**
|
|
280
267
|
* The type of the cell.
|
|
281
268
|
*/
|
|
@@ -290,9 +277,9 @@ export declare class RawCellModel extends AttachmentsCellModel {
|
|
|
290
277
|
*/
|
|
291
278
|
export declare class MarkdownCellModel extends AttachmentsCellModel {
|
|
292
279
|
/**
|
|
293
|
-
* Construct a markdown cell model from optional
|
|
280
|
+
* Construct a markdown cell model from optional shared model.
|
|
294
281
|
*/
|
|
295
|
-
constructor(options
|
|
282
|
+
constructor(options?: AttachmentsCellModel.IOptions<ISharedMarkdownCell>);
|
|
296
283
|
/**
|
|
297
284
|
* The type of the cell.
|
|
298
285
|
*/
|
|
@@ -309,8 +296,7 @@ export declare class CodeCellModel extends CellModel implements ICodeCellModel {
|
|
|
309
296
|
/**
|
|
310
297
|
* Construct a new code cell with optional original cell content.
|
|
311
298
|
*/
|
|
312
|
-
constructor(options
|
|
313
|
-
switchSharedModel(sharedModel: models.ISharedCodeCell, reinitialize?: boolean): void;
|
|
299
|
+
constructor(options?: CodeCellModel.IOptions);
|
|
314
300
|
/**
|
|
315
301
|
* The type of the cell.
|
|
316
302
|
*/
|
|
@@ -327,35 +313,28 @@ export declare class CodeCellModel extends CellModel implements ICodeCellModel {
|
|
|
327
313
|
* result of the input code execution.
|
|
328
314
|
*/
|
|
329
315
|
get isDirty(): boolean;
|
|
330
|
-
/**
|
|
331
|
-
* Set whether the cell is dirty or not.
|
|
332
|
-
*/
|
|
333
|
-
private _setDirty;
|
|
334
|
-
clearExecution(): void;
|
|
335
316
|
/**
|
|
336
317
|
* The cell outputs.
|
|
337
318
|
*/
|
|
338
319
|
get outputs(): IOutputAreaModel;
|
|
320
|
+
readonly sharedModel: models.ISharedCodeCell;
|
|
321
|
+
clearExecution(): void;
|
|
339
322
|
/**
|
|
340
323
|
* Dispose of the resources held by the model.
|
|
341
324
|
*/
|
|
342
325
|
dispose(): void;
|
|
343
|
-
/**
|
|
344
|
-
* Serialize the model to JSON.
|
|
345
|
-
*/
|
|
346
|
-
toJSON(): nbformat.ICodeCell;
|
|
347
326
|
/**
|
|
348
327
|
* Handle a change to the trusted state.
|
|
349
328
|
*/
|
|
350
329
|
onTrustedChanged(trusted: IObservableValue, args: ObservableValue.IChangedArgs): void;
|
|
351
330
|
/**
|
|
352
|
-
*
|
|
331
|
+
* Serialize the model to JSON.
|
|
353
332
|
*/
|
|
354
|
-
|
|
333
|
+
toJSON(): nbformat.ICodeCell;
|
|
355
334
|
/**
|
|
356
|
-
* Handle a change to the
|
|
335
|
+
* Handle a change to the cell outputs modelDB and reflect it in the shared model.
|
|
357
336
|
*/
|
|
358
|
-
|
|
337
|
+
protected onModelDBOutputsChange(sender: IOutputAreaModel, event: IOutputAreaModel.ChangedArgs): void;
|
|
359
338
|
/**
|
|
360
339
|
* Handle a change to the output shared model and reflect it in modelDB.
|
|
361
340
|
* We update the modeldb metadata when the nbcell changes.
|
|
@@ -365,12 +344,15 @@ export declare class CodeCellModel extends CellModel implements ICodeCellModel {
|
|
|
365
344
|
*
|
|
366
345
|
* @override CellModel._onSharedModelChanged
|
|
367
346
|
*/
|
|
368
|
-
protected
|
|
347
|
+
protected onSharedModelChanged(sender: models.ISharedCodeCell, change: models.CellChange<models.ISharedBaseCellMetadata>): void;
|
|
369
348
|
/**
|
|
370
|
-
* Handle a change to the
|
|
349
|
+
* Handle a change to the code cell value.
|
|
350
|
+
*/
|
|
351
|
+
private _onValueChanged;
|
|
352
|
+
/**
|
|
353
|
+
* Set whether the cell is dirty or not.
|
|
371
354
|
*/
|
|
372
|
-
private
|
|
373
|
-
sharedModel: models.ISharedCodeCell;
|
|
355
|
+
private _setDirty;
|
|
374
356
|
private _executedCode;
|
|
375
357
|
private _isDirty;
|
|
376
358
|
private _outputs;
|
|
@@ -382,7 +364,7 @@ export declare namespace CodeCellModel {
|
|
|
382
364
|
/**
|
|
383
365
|
* The options used to initialize a `CodeCellModel`.
|
|
384
366
|
*/
|
|
385
|
-
interface IOptions extends CellModel.IOptions {
|
|
367
|
+
interface IOptions extends CellModel.IOptions<ISharedCodeCell> {
|
|
386
368
|
/**
|
|
387
369
|
* The factory for output area model creation.
|
|
388
370
|
*/
|