@jupyterlab/debugger 4.0.0-alpha.9 → 4.0.0-beta.1
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/debugger.d.ts +3 -1
- package/lib/debugger.js +5 -3
- package/lib/debugger.js.map +1 -1
- package/lib/dialogs/evaluate.d.ts +5 -0
- package/lib/dialogs/evaluate.js +16 -6
- package/lib/dialogs/evaluate.js.map +1 -1
- package/lib/factory.d.ts +1 -1
- package/lib/factory.js +15 -9
- package/lib/factory.js.map +1 -1
- package/lib/handler.js +15 -7
- package/lib/handler.js.map +1 -1
- package/lib/handlers/console.js +9 -3
- package/lib/handlers/console.js.map +1 -1
- package/lib/handlers/editor.d.ts +26 -12
- package/lib/handlers/editor.js +166 -89
- package/lib/handlers/editor.js.map +1 -1
- package/lib/handlers/file.js +6 -2
- package/lib/handlers/file.js.map +1 -1
- package/lib/handlers/notebook.d.ts +0 -7
- package/lib/handlers/notebook.js +11 -17
- package/lib/handlers/notebook.js.map +1 -1
- package/lib/icons.d.ts +2 -1
- package/lib/icons.js +6 -1
- package/lib/icons.js.map +1 -1
- package/lib/model.js +1 -0
- package/lib/model.js.map +1 -1
- package/lib/panels/breakpoints/index.d.ts +2 -2
- package/lib/panels/breakpoints/index.js +9 -7
- package/lib/panels/breakpoints/index.js.map +1 -1
- package/lib/panels/breakpoints/pauseonexceptions.d.ts +53 -0
- package/lib/panels/breakpoints/pauseonexceptions.js +98 -0
- package/lib/panels/breakpoints/pauseonexceptions.js.map +1 -0
- package/lib/panels/callstack/index.d.ts +1 -1
- package/lib/panels/kernelSources/body.d.ts +5 -7
- package/lib/panels/kernelSources/body.js +37 -47
- package/lib/panels/kernelSources/body.js.map +1 -1
- package/lib/panels/kernelSources/filter.d.ts +1 -2
- package/lib/panels/kernelSources/filter.js +2 -2
- package/lib/panels/kernelSources/filter.js.map +1 -1
- package/lib/panels/kernelSources/index.js +1 -1
- package/lib/panels/kernelSources/index.js.map +1 -1
- package/lib/panels/kernelSources/model.d.ts +10 -1
- package/lib/panels/kernelSources/model.js +19 -1
- package/lib/panels/kernelSources/model.js.map +1 -1
- package/lib/panels/sources/body.js +5 -3
- package/lib/panels/sources/body.js.map +1 -1
- package/lib/panels/sources/sourcepath.js +1 -1
- package/lib/panels/sources/sourcepath.js.map +1 -1
- package/lib/panels/variables/grid.d.ts +23 -10
- package/lib/panels/variables/grid.js +42 -367
- package/lib/panels/variables/grid.js.map +1 -1
- package/lib/panels/variables/gridpanel.d.ts +138 -0
- package/lib/panels/variables/gridpanel.js +362 -0
- package/lib/panels/variables/gridpanel.js.map +1 -0
- package/lib/panels/variables/mimerenderer.js +9 -1
- package/lib/panels/variables/mimerenderer.js.map +1 -1
- package/lib/panels/variables/scope.js +4 -0
- package/lib/panels/variables/scope.js.map +1 -1
- package/lib/panels/variables/tree.d.ts +1 -0
- package/lib/panels/variables/tree.js +136 -47
- package/lib/panels/variables/tree.js.map +1 -1
- package/lib/service.d.ts +20 -6
- package/lib/service.js +84 -59
- package/lib/service.js.map +1 -1
- package/lib/session.d.ts +20 -6
- package/lib/session.js +59 -11
- package/lib/session.js.map +1 -1
- package/lib/sidebar.js +1 -1
- package/lib/sources.d.ts +2 -2
- package/lib/sources.js +32 -17
- package/lib/sources.js.map +1 -1
- package/lib/tokens.d.ts +57 -13
- package/lib/tokens.js.map +1 -1
- package/package.json +38 -46
- package/src/config.ts +78 -0
- package/src/debugger.ts +154 -0
- package/src/dialogs/evaluate.ts +144 -0
- package/src/factory.ts +72 -0
- package/src/handler.ts +528 -0
- package/src/handlers/console.ts +118 -0
- package/src/handlers/editor.ts +469 -0
- package/src/handlers/file.ts +86 -0
- package/src/handlers/notebook.ts +128 -0
- package/src/hash.ts +69 -0
- package/src/icons.ts +64 -0
- package/src/index.ts +16 -0
- package/src/model.ts +155 -0
- package/src/panels/breakpoints/body.tsx +145 -0
- package/src/panels/breakpoints/index.ts +116 -0
- package/src/panels/breakpoints/model.ts +74 -0
- package/src/panels/breakpoints/pauseonexceptions.tsx +141 -0
- package/src/panels/callstack/body.tsx +96 -0
- package/src/panels/callstack/index.ts +152 -0
- package/src/panels/callstack/model.ts +86 -0
- package/src/panels/kernelSources/body.tsx +139 -0
- package/src/panels/kernelSources/filter.tsx +44 -0
- package/src/panels/kernelSources/index.tsx +106 -0
- package/src/panels/kernelSources/model.ts +160 -0
- package/src/panels/sources/body.ts +161 -0
- package/src/panels/sources/index.tsx +85 -0
- package/src/panels/sources/model.ts +94 -0
- package/src/panels/sources/sourcepath.tsx +31 -0
- package/src/panels/variables/grid.ts +145 -0
- package/src/panels/variables/gridpanel.ts +453 -0
- package/src/panels/variables/index.ts +199 -0
- package/src/panels/variables/mimerenderer.ts +125 -0
- package/src/panels/variables/model.ts +61 -0
- package/src/panels/variables/scope.tsx +132 -0
- package/src/panels/variables/tree.tsx +521 -0
- package/src/service.ts +1009 -0
- package/src/session.ts +342 -0
- package/src/sidebar.ts +194 -0
- package/src/sources.ts +327 -0
- package/src/svg.d.ts +9 -0
- package/src/tokens.ts +1071 -0
- package/style/breakpoints.css +21 -12
- package/style/callstack.css +2 -2
- package/style/icons/exceptions.svg +10 -0
- package/style/index.css +1 -1
- package/style/index.js +1 -1
- package/style/kernelSources.css +3 -9
- package/style/sources.css +1 -1
- package/style/variables.css +68 -21
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IThemeManager } from '@jupyterlab/apputils';
|
|
2
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
2
3
|
import { CommandRegistry } from '@lumino/commands';
|
|
4
|
+
import { Message } from '@lumino/messaging';
|
|
3
5
|
import { Panel } from '@lumino/widgets';
|
|
4
6
|
import { IDebugger } from '../../tokens';
|
|
5
|
-
import { ITranslator } from '@jupyterlab/translation';
|
|
6
7
|
/**
|
|
7
8
|
* A data grid that displays variables in a debugger session.
|
|
8
9
|
*/
|
|
@@ -14,23 +15,35 @@ export declare class VariablesBodyGrid extends Panel {
|
|
|
14
15
|
*/
|
|
15
16
|
constructor(options: VariablesBodyGrid.IOptions);
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param filter The variable filter to apply.
|
|
18
|
+
* The variable filter list.
|
|
20
19
|
*/
|
|
20
|
+
get filter(): Set<string>;
|
|
21
21
|
set filter(filter: Set<string>);
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param scope The current scope for the variables.
|
|
23
|
+
* The current scope of the variables.
|
|
26
24
|
*/
|
|
25
|
+
get scope(): string;
|
|
27
26
|
set scope(scope: string);
|
|
27
|
+
protected commands: CommandRegistry;
|
|
28
|
+
protected model: IDebugger.Model.IVariables;
|
|
29
|
+
protected themeManager: IThemeManager | null | undefined;
|
|
30
|
+
protected translator: ITranslator | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Load the grid panel implementation and instantiate a grid.
|
|
33
|
+
*/
|
|
34
|
+
protected initialize(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Wait until actually displaying the grid to trigger initialization.
|
|
37
|
+
*/
|
|
38
|
+
protected onBeforeShow(msg: Message): void;
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
40
|
+
* Handle `update-request` messages.
|
|
30
41
|
*/
|
|
31
|
-
|
|
42
|
+
protected onUpdateRequest(msg: Message): void;
|
|
43
|
+
private _filter;
|
|
32
44
|
private _grid;
|
|
33
|
-
private
|
|
45
|
+
private _pending;
|
|
46
|
+
private _scope;
|
|
34
47
|
}
|
|
35
48
|
/**
|
|
36
49
|
* A namespace for `VariablesBodyGrid` statics.
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { BasicKeyHandler, BasicMouseHandler, BasicSelectionModel, DataGrid, DataModel, TextRenderer } from '@lumino/datagrid';
|
|
4
|
-
import { Signal } from '@lumino/signaling';
|
|
5
3
|
import { Panel } from '@lumino/widgets';
|
|
6
|
-
import { Debugger } from '../../';
|
|
7
|
-
import { nullTranslator } from '@jupyterlab/translation';
|
|
8
4
|
/**
|
|
9
5
|
* A data grid that displays variables in a debugger session.
|
|
10
6
|
*/
|
|
@@ -16,394 +12,73 @@ export class VariablesBodyGrid extends Panel {
|
|
|
16
12
|
*/
|
|
17
13
|
constructor(options) {
|
|
18
14
|
super();
|
|
19
|
-
|
|
20
|
-
this._grid =
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
this.addWidget(this._grid);
|
|
15
|
+
this._filter = new Set();
|
|
16
|
+
this._grid = null;
|
|
17
|
+
this._pending = null;
|
|
18
|
+
this.commands = options.commands;
|
|
19
|
+
this.model = options.model;
|
|
20
|
+
this.themeManager = options.themeManager;
|
|
21
|
+
this.translator = options.translator;
|
|
22
|
+
this.model.changed.connect(() => this.update(), this);
|
|
28
23
|
this.addClass('jp-DebuggerVariables-body');
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param filter The variable filter to apply.
|
|
34
|
-
*/
|
|
35
|
-
set filter(filter) {
|
|
36
|
-
this._grid.dataModel.filter = filter;
|
|
37
|
-
this._update();
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Set the current scope.
|
|
41
|
-
*
|
|
42
|
-
* @param scope The current scope for the variables.
|
|
43
|
-
*/
|
|
44
|
-
set scope(scope) {
|
|
45
|
-
this._grid.dataModel.scope = scope;
|
|
46
|
-
this._update();
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Update the underlying data model
|
|
50
|
-
*/
|
|
51
|
-
_update() {
|
|
52
|
-
var _a;
|
|
53
|
-
this._grid.dataModel.setData((_a = this._model.scopes) !== null && _a !== void 0 ? _a : []);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* A class wrapping the underlying variables datagrid.
|
|
58
|
-
*/
|
|
59
|
-
class Grid extends Panel {
|
|
60
|
-
/**
|
|
61
|
-
* Instantiate a new VariablesGrid.
|
|
62
|
-
*
|
|
63
|
-
* @param options The instantiation options for a VariablesGrid.
|
|
64
|
-
*/
|
|
65
|
-
constructor(options) {
|
|
66
|
-
super();
|
|
67
|
-
const { commands, model, themeManager } = options;
|
|
68
|
-
this.model = model;
|
|
69
|
-
const dataModel = new GridModel(options.translator);
|
|
70
|
-
const grid = new DataGrid();
|
|
71
|
-
const mouseHandler = new Private.MouseHandler();
|
|
72
|
-
mouseHandler.doubleClicked.connect((_, hit) => commands.execute(Debugger.CommandIDs.inspectVariable, {
|
|
73
|
-
variableReference: dataModel.getVariableReference(hit.row),
|
|
74
|
-
name: dataModel.getVariableName(hit.row)
|
|
75
|
-
}));
|
|
76
|
-
mouseHandler.selected.connect((_, hit) => {
|
|
77
|
-
const { row } = hit;
|
|
78
|
-
this.model.selectedVariable = {
|
|
79
|
-
name: dataModel.getVariableName(row),
|
|
80
|
-
value: dataModel.data('body', row, 1),
|
|
81
|
-
type: dataModel.data('body', row, 2),
|
|
82
|
-
variablesReference: dataModel.getVariableReference(row)
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
grid.dataModel = dataModel;
|
|
86
|
-
grid.keyHandler = new BasicKeyHandler();
|
|
87
|
-
grid.mouseHandler = mouseHandler;
|
|
88
|
-
grid.selectionModel = new BasicSelectionModel({
|
|
89
|
-
dataModel
|
|
90
|
-
});
|
|
91
|
-
grid.stretchLastColumn = true;
|
|
92
|
-
grid.node.style.height = '100%';
|
|
93
|
-
this._grid = grid;
|
|
94
|
-
// Compute the grid's styles based on the current theme.
|
|
95
|
-
if (themeManager) {
|
|
96
|
-
themeManager.themeChanged.connect(this._updateStyles, this);
|
|
97
|
-
}
|
|
98
|
-
this.addWidget(grid);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Set the variable filter list.
|
|
102
|
-
*
|
|
103
|
-
* @param filter The variable filter to apply.
|
|
104
|
-
*/
|
|
105
|
-
set filter(filter) {
|
|
106
|
-
this._grid.dataModel.filter = filter;
|
|
107
|
-
this.update();
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Set the scope for the variables data model.
|
|
111
|
-
*
|
|
112
|
-
* @param scope The scopes for the variables
|
|
113
|
-
*/
|
|
114
|
-
set scope(scope) {
|
|
115
|
-
this._grid.dataModel.scope = scope;
|
|
116
|
-
this.update();
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get the data model for the data grid.
|
|
120
|
-
*/
|
|
121
|
-
get dataModel() {
|
|
122
|
-
return this._grid.dataModel;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Handle `after-attach` messages.
|
|
126
|
-
*
|
|
127
|
-
* @param message - The `after-attach` message.
|
|
128
|
-
*/
|
|
129
|
-
onAfterAttach(message) {
|
|
130
|
-
super.onAfterAttach(message);
|
|
131
|
-
this._updateStyles();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Update the computed style for the data grid on theme change.
|
|
135
|
-
*/
|
|
136
|
-
_updateStyles() {
|
|
137
|
-
const { style, textRenderer } = Private.computeStyle();
|
|
138
|
-
this._grid.cellRenderers.update({}, textRenderer);
|
|
139
|
-
this._grid.style = style;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* A data grid model for variables.
|
|
144
|
-
*/
|
|
145
|
-
class GridModel extends DataModel {
|
|
146
|
-
/**
|
|
147
|
-
* Create gird model
|
|
148
|
-
* @param translator optional translator
|
|
26
|
+
* The variable filter list.
|
|
149
27
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this._filter = new Set();
|
|
153
|
-
this._scope = '';
|
|
154
|
-
this._data = {
|
|
155
|
-
name: [],
|
|
156
|
-
type: [],
|
|
157
|
-
value: [],
|
|
158
|
-
variablesReference: []
|
|
159
|
-
};
|
|
160
|
-
translator = translator || nullTranslator;
|
|
161
|
-
this._trans = translator.load('jupyterlab');
|
|
28
|
+
get filter() {
|
|
29
|
+
return this._filter;
|
|
162
30
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Set the variable filter list.
|
|
165
|
-
*/
|
|
166
31
|
set filter(filter) {
|
|
167
32
|
this._filter = filter;
|
|
33
|
+
this.update();
|
|
168
34
|
}
|
|
169
35
|
/**
|
|
170
|
-
*
|
|
36
|
+
* The current scope of the variables.
|
|
171
37
|
*/
|
|
172
38
|
get scope() {
|
|
173
39
|
return this._scope;
|
|
174
40
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Set the variable scope
|
|
177
|
-
*/
|
|
178
41
|
set scope(scope) {
|
|
179
42
|
this._scope = scope;
|
|
43
|
+
this.update();
|
|
180
44
|
}
|
|
181
45
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @param region The datagrid region.
|
|
185
|
-
*/
|
|
186
|
-
rowCount(region) {
|
|
187
|
-
return region === 'body' ? this._data.name.length : 1;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get the column count for a particular region in the data grid.
|
|
191
|
-
*
|
|
192
|
-
* @param region The datagrid region.
|
|
193
|
-
*/
|
|
194
|
-
columnCount(region) {
|
|
195
|
-
return region === 'body' ? 2 : 1;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get the data count for a particular region, row and column in the data grid.
|
|
199
|
-
*
|
|
200
|
-
* @param region The datagrid region.
|
|
201
|
-
* @param row The datagrid row
|
|
202
|
-
* @param column The datagrid column
|
|
46
|
+
* Load the grid panel implementation and instantiate a grid.
|
|
203
47
|
*/
|
|
204
|
-
|
|
205
|
-
if (
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
if (region === 'column-header') {
|
|
209
|
-
return column === 1 ? this._trans.__('Value') : this._trans.__('Type');
|
|
48
|
+
async initialize() {
|
|
49
|
+
if (this._grid || this._pending) {
|
|
50
|
+
return;
|
|
210
51
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* @param row The row in the datagrid.
|
|
220
|
-
*/
|
|
221
|
-
getVariableReference(row) {
|
|
222
|
-
return this._data.variablesReference[row];
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Get the variable name for a given row
|
|
226
|
-
*
|
|
227
|
-
* @param row The row in the datagrid.
|
|
228
|
-
*/
|
|
229
|
-
getVariableName(row) {
|
|
230
|
-
return this._data.name[row];
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Set the datagrid model data from the list of variables.
|
|
234
|
-
*
|
|
235
|
-
* @param scopes The list of variables.
|
|
236
|
-
*/
|
|
237
|
-
setData(scopes) {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
this._clearData();
|
|
240
|
-
this.emitChanged({
|
|
241
|
-
type: 'model-reset',
|
|
242
|
-
region: 'body'
|
|
243
|
-
});
|
|
244
|
-
const scope = (_a = scopes.find(scope => scope.name === this._scope)) !== null && _a !== void 0 ? _a : scopes[0];
|
|
245
|
-
const variables = (_b = scope === null || scope === void 0 ? void 0 : scope.variables) !== null && _b !== void 0 ? _b : [];
|
|
246
|
-
const filtered = variables.filter(variable => variable.name && !this._filter.has(variable.name));
|
|
247
|
-
filtered.forEach((variable, index) => {
|
|
248
|
-
var _a;
|
|
249
|
-
this._data.name[index] = variable.name;
|
|
250
|
-
this._data.type[index] = (_a = variable.type) !== null && _a !== void 0 ? _a : '';
|
|
251
|
-
this._data.value[index] = variable.value;
|
|
252
|
-
this._data.variablesReference[index] = variable.variablesReference;
|
|
253
|
-
});
|
|
254
|
-
this.emitChanged({
|
|
255
|
-
type: 'rows-inserted',
|
|
256
|
-
region: 'body',
|
|
257
|
-
index: 1,
|
|
258
|
-
span: filtered.length
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Clear all the data in the datagrid.
|
|
263
|
-
*/
|
|
264
|
-
_clearData() {
|
|
265
|
-
this._data = {
|
|
266
|
-
name: [],
|
|
267
|
-
type: [],
|
|
268
|
-
value: [],
|
|
269
|
-
variablesReference: []
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* A namespace for private data.
|
|
275
|
-
*/
|
|
276
|
-
var Private;
|
|
277
|
-
(function (Private) {
|
|
278
|
-
/**
|
|
279
|
-
* Create a color palette element.
|
|
280
|
-
*/
|
|
281
|
-
function createPalette() {
|
|
282
|
-
const div = document.createElement('div');
|
|
283
|
-
div.className = 'jp-DebuggerVariables-colorPalette';
|
|
284
|
-
div.innerHTML = `
|
|
285
|
-
<div class="jp-mod-void"></div>
|
|
286
|
-
<div class="jp-mod-background"></div>
|
|
287
|
-
<div class="jp-mod-header-background"></div>
|
|
288
|
-
<div class="jp-mod-grid-line"></div>
|
|
289
|
-
<div class="jp-mod-header-grid-line"></div>
|
|
290
|
-
<div class="jp-mod-selection"></div>
|
|
291
|
-
<div class="jp-mod-text"></div>
|
|
292
|
-
`;
|
|
293
|
-
return div;
|
|
52
|
+
// Lazily load the datagrid module when the first grid is requested.
|
|
53
|
+
const { Grid } = await (this._pending = import('./gridpanel'));
|
|
54
|
+
const { commands, model, themeManager, translator } = this;
|
|
55
|
+
this._grid = new Grid({ commands, model, themeManager, translator });
|
|
56
|
+
this._grid.addClass('jp-DebuggerVariables-grid');
|
|
57
|
+
this._pending = null;
|
|
58
|
+
this.addWidget(this._grid);
|
|
59
|
+
this.update();
|
|
294
60
|
}
|
|
295
61
|
/**
|
|
296
|
-
*
|
|
62
|
+
* Wait until actually displaying the grid to trigger initialization.
|
|
297
63
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const voidColor = getComputedStyle(node).color;
|
|
304
|
-
node = palette.querySelector('.jp-mod-background');
|
|
305
|
-
const backgroundColor = getComputedStyle(node).color;
|
|
306
|
-
node = palette.querySelector('.jp-mod-header-background');
|
|
307
|
-
const headerBackgroundColor = getComputedStyle(node).color;
|
|
308
|
-
node = palette.querySelector('.jp-mod-grid-line');
|
|
309
|
-
const gridLineColor = getComputedStyle(node).color;
|
|
310
|
-
node = palette.querySelector('.jp-mod-header-grid-line');
|
|
311
|
-
const headerGridLineColor = getComputedStyle(node).color;
|
|
312
|
-
node = palette.querySelector('.jp-mod-selection');
|
|
313
|
-
const selectionFillColor = getComputedStyle(node).color;
|
|
314
|
-
node = palette.querySelector('.jp-mod-text');
|
|
315
|
-
const textColor = getComputedStyle(node).color;
|
|
316
|
-
document.body.removeChild(palette);
|
|
317
|
-
return {
|
|
318
|
-
style: {
|
|
319
|
-
voidColor,
|
|
320
|
-
backgroundColor,
|
|
321
|
-
headerBackgroundColor,
|
|
322
|
-
gridLineColor,
|
|
323
|
-
headerGridLineColor,
|
|
324
|
-
rowBackgroundColor: (i) => i % 2 === 0 ? voidColor : backgroundColor,
|
|
325
|
-
selectionFillColor
|
|
326
|
-
},
|
|
327
|
-
textRenderer: new TextRenderer({
|
|
328
|
-
font: '12px sans-serif',
|
|
329
|
-
textColor,
|
|
330
|
-
backgroundColor: '',
|
|
331
|
-
verticalAlignment: 'center',
|
|
332
|
-
horizontalAlignment: 'left'
|
|
333
|
-
})
|
|
334
|
-
};
|
|
64
|
+
onBeforeShow(msg) {
|
|
65
|
+
if (!this._grid && !this._pending) {
|
|
66
|
+
void this.initialize();
|
|
67
|
+
}
|
|
68
|
+
super.onBeforeShow(msg);
|
|
335
69
|
}
|
|
336
|
-
Private.computeStyle = computeStyle;
|
|
337
70
|
/**
|
|
338
|
-
*
|
|
71
|
+
* Handle `update-request` messages.
|
|
339
72
|
*/
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
* A signal emitted when the variables grid is double clicked.
|
|
348
|
-
*/
|
|
349
|
-
get doubleClicked() {
|
|
350
|
-
return this._doubleClicked;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* A signal emitted when the variables grid received mouse down or context menu event.
|
|
354
|
-
*/
|
|
355
|
-
get selected() {
|
|
356
|
-
return this._selected;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Dispose of the resources held by the mouse handler.
|
|
360
|
-
*/
|
|
361
|
-
dispose() {
|
|
362
|
-
if (this.isDisposed) {
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
Signal.disconnectSender(this);
|
|
366
|
-
super.dispose();
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Handle a mouse double-click event.
|
|
370
|
-
*
|
|
371
|
-
* @param grid The datagrid clicked.
|
|
372
|
-
* @param event The mouse event.
|
|
373
|
-
*/
|
|
374
|
-
onMouseDoubleClick(grid, event) {
|
|
375
|
-
const hit = grid.hitTest(event.clientX, event.clientY);
|
|
376
|
-
this._doubleClicked.emit(hit);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Handle the mouse down event for the data grid.
|
|
380
|
-
*
|
|
381
|
-
* @param grid - The data grid of interest.
|
|
382
|
-
*
|
|
383
|
-
* @param event - The mouse down event of interest.
|
|
384
|
-
*/
|
|
385
|
-
onMouseDown(grid, event) {
|
|
386
|
-
// Unpack the event.
|
|
387
|
-
let { clientX, clientY } = event;
|
|
388
|
-
// Hit test the grid.
|
|
389
|
-
let hit = grid.hitTest(clientX, clientY);
|
|
390
|
-
this._selected.emit(hit);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Handle the context menu event for the data grid.
|
|
394
|
-
*
|
|
395
|
-
* @param grid - The data grid of interest.
|
|
396
|
-
*
|
|
397
|
-
* @param event - The context menu event of interest.
|
|
398
|
-
*/
|
|
399
|
-
onContextMenu(grid, event) {
|
|
400
|
-
// Unpack the event.
|
|
401
|
-
let { clientX, clientY } = event;
|
|
402
|
-
// Hit test the grid.
|
|
403
|
-
let hit = grid.hitTest(clientX, clientY);
|
|
404
|
-
this._selected.emit(hit);
|
|
73
|
+
onUpdateRequest(msg) {
|
|
74
|
+
var _a;
|
|
75
|
+
if (this._grid) {
|
|
76
|
+
const { dataModel } = this._grid;
|
|
77
|
+
dataModel.filter = this._filter;
|
|
78
|
+
dataModel.scope = this._scope;
|
|
79
|
+
dataModel.setData((_a = this.model.scopes) !== null && _a !== void 0 ? _a : []);
|
|
405
80
|
}
|
|
81
|
+
super.onUpdateRequest(msg);
|
|
406
82
|
}
|
|
407
|
-
|
|
408
|
-
})(Private || (Private = {}));
|
|
83
|
+
}
|
|
409
84
|
//# sourceMappingURL=grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/panels/variables/grid.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/panels/variables/grid.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
2
|
+
import { DataModel } from '@lumino/datagrid';
|
|
3
|
+
import { Panel } from '@lumino/widgets';
|
|
4
|
+
import { IThemeManager } from '@jupyterlab/apputils';
|
|
5
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
6
|
+
import { IDebugger } from '../../tokens';
|
|
7
|
+
/**
|
|
8
|
+
* A class wrapping the underlying variables datagrid.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Grid extends Panel {
|
|
11
|
+
/**
|
|
12
|
+
* Instantiate a new VariablesGrid.
|
|
13
|
+
*
|
|
14
|
+
* @param options The instantiation options for a VariablesGrid.
|
|
15
|
+
*/
|
|
16
|
+
constructor(options: Grid.IOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Set the variable filter list.
|
|
19
|
+
*
|
|
20
|
+
* @param filter The variable filter to apply.
|
|
21
|
+
*/
|
|
22
|
+
set filter(filter: Set<string>);
|
|
23
|
+
/**
|
|
24
|
+
* Set the scope for the variables data model.
|
|
25
|
+
*
|
|
26
|
+
* @param scope The scopes for the variables
|
|
27
|
+
*/
|
|
28
|
+
set scope(scope: string);
|
|
29
|
+
/**
|
|
30
|
+
* Get the data model for the data grid.
|
|
31
|
+
*/
|
|
32
|
+
get dataModel(): GridModel;
|
|
33
|
+
/**
|
|
34
|
+
* Handle `after-attach` messages.
|
|
35
|
+
*
|
|
36
|
+
* @param message - The `after-attach` message.
|
|
37
|
+
*/
|
|
38
|
+
protected onAfterAttach(message: any): void;
|
|
39
|
+
/**
|
|
40
|
+
* Update the computed style for the data grid on theme change.
|
|
41
|
+
*/
|
|
42
|
+
private _updateStyles;
|
|
43
|
+
private _grid;
|
|
44
|
+
protected model: IDebugger.Model.IVariables;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A namespace for VariablesGrid `statics`.
|
|
48
|
+
*/
|
|
49
|
+
declare namespace Grid {
|
|
50
|
+
/**
|
|
51
|
+
* Instantiation options for `VariablesGrid`.
|
|
52
|
+
*/
|
|
53
|
+
interface IOptions {
|
|
54
|
+
/**
|
|
55
|
+
* The commands registry.
|
|
56
|
+
*/
|
|
57
|
+
commands: CommandRegistry;
|
|
58
|
+
/**
|
|
59
|
+
* The variables model.
|
|
60
|
+
*/
|
|
61
|
+
model: IDebugger.Model.IVariables;
|
|
62
|
+
/**
|
|
63
|
+
* An optional application theme manager to detect theme changes.
|
|
64
|
+
*/
|
|
65
|
+
themeManager?: IThemeManager | null;
|
|
66
|
+
/**
|
|
67
|
+
* The application language translator.
|
|
68
|
+
*/
|
|
69
|
+
translator?: ITranslator;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A data grid model for variables.
|
|
74
|
+
*/
|
|
75
|
+
export declare class GridModel extends DataModel {
|
|
76
|
+
/**
|
|
77
|
+
* Create gird model
|
|
78
|
+
* @param translator optional translator
|
|
79
|
+
*/
|
|
80
|
+
constructor(translator?: ITranslator);
|
|
81
|
+
/**
|
|
82
|
+
* The variable filter list.
|
|
83
|
+
*/
|
|
84
|
+
get filter(): Set<string>;
|
|
85
|
+
set filter(filter: Set<string>);
|
|
86
|
+
/**
|
|
87
|
+
* The current scope for the variables.
|
|
88
|
+
*/
|
|
89
|
+
get scope(): string;
|
|
90
|
+
set scope(scope: string);
|
|
91
|
+
/**
|
|
92
|
+
* Get the row count for a particular region in the data grid.
|
|
93
|
+
*
|
|
94
|
+
* @param region The datagrid region.
|
|
95
|
+
*/
|
|
96
|
+
rowCount(region: DataModel.RowRegion): number;
|
|
97
|
+
/**
|
|
98
|
+
* Get the column count for a particular region in the data grid.
|
|
99
|
+
*
|
|
100
|
+
* @param region The datagrid region.
|
|
101
|
+
*/
|
|
102
|
+
columnCount(region: DataModel.ColumnRegion): number;
|
|
103
|
+
/**
|
|
104
|
+
* Get the data count for a particular region, row and column in the data grid.
|
|
105
|
+
*
|
|
106
|
+
* @param region The datagrid region.
|
|
107
|
+
* @param row The datagrid row
|
|
108
|
+
* @param column The datagrid column
|
|
109
|
+
*/
|
|
110
|
+
data(region: DataModel.CellRegion, row: number, column: number): any;
|
|
111
|
+
/**
|
|
112
|
+
* Get the variable reference for a given row
|
|
113
|
+
*
|
|
114
|
+
* @param row The row in the datagrid.
|
|
115
|
+
*/
|
|
116
|
+
getVariableReference(row: number): number;
|
|
117
|
+
/**
|
|
118
|
+
* Get the variable name for a given row
|
|
119
|
+
*
|
|
120
|
+
* @param row The row in the datagrid.
|
|
121
|
+
*/
|
|
122
|
+
getVariableName(row: number): string;
|
|
123
|
+
/**
|
|
124
|
+
* Set the datagrid model data from the list of variables.
|
|
125
|
+
*
|
|
126
|
+
* @param scopes The list of variables.
|
|
127
|
+
*/
|
|
128
|
+
setData(scopes: IDebugger.IScope[]): void;
|
|
129
|
+
/**
|
|
130
|
+
* Clear all the data in the datagrid.
|
|
131
|
+
*/
|
|
132
|
+
private _clearData;
|
|
133
|
+
private _filter;
|
|
134
|
+
private _scope;
|
|
135
|
+
private _trans;
|
|
136
|
+
private _data;
|
|
137
|
+
}
|
|
138
|
+
export {};
|