@jupyterlab/debugger 4.0.0-alpha.2 → 4.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/lib/debugger.d.ts +4 -0
  2. package/lib/debugger.js +5 -1
  3. package/lib/debugger.js.map +1 -1
  4. package/lib/dialogs/evaluate.d.ts +5 -0
  5. package/lib/dialogs/evaluate.js +16 -6
  6. package/lib/dialogs/evaluate.js.map +1 -1
  7. package/lib/factory.d.ts +1 -1
  8. package/lib/factory.js +15 -9
  9. package/lib/factory.js.map +1 -1
  10. package/lib/handler.js +24 -9
  11. package/lib/handler.js.map +1 -1
  12. package/lib/handlers/console.js +9 -3
  13. package/lib/handlers/console.js.map +1 -1
  14. package/lib/handlers/editor.d.ts +33 -11
  15. package/lib/handlers/editor.js +177 -88
  16. package/lib/handlers/editor.js.map +1 -1
  17. package/lib/handlers/file.d.ts +1 -0
  18. package/lib/handlers/file.js +11 -2
  19. package/lib/handlers/file.js.map +1 -1
  20. package/lib/handlers/notebook.d.ts +0 -7
  21. package/lib/handlers/notebook.js +22 -18
  22. package/lib/handlers/notebook.js.map +1 -1
  23. package/lib/icons.d.ts +3 -0
  24. package/lib/icons.js +15 -0
  25. package/lib/icons.js.map +1 -1
  26. package/lib/model.d.ts +5 -0
  27. package/lib/model.js +4 -0
  28. package/lib/model.js.map +1 -1
  29. package/lib/panels/breakpoints/index.d.ts +18 -0
  30. package/lib/panels/breakpoints/index.js +10 -3
  31. package/lib/panels/breakpoints/index.js.map +1 -1
  32. package/lib/panels/breakpoints/pauseonexceptions.d.ts +53 -0
  33. package/lib/panels/breakpoints/pauseonexceptions.js +98 -0
  34. package/lib/panels/breakpoints/pauseonexceptions.js.map +1 -0
  35. package/lib/panels/callstack/index.d.ts +1 -1
  36. package/lib/panels/kernelSources/body.d.ts +45 -0
  37. package/lib/panels/kernelSources/body.js +76 -0
  38. package/lib/panels/kernelSources/body.js.map +1 -0
  39. package/lib/panels/kernelSources/filter.d.ts +11 -0
  40. package/lib/panels/kernelSources/filter.js +18 -0
  41. package/lib/panels/kernelSources/filter.js.map +1 -0
  42. package/lib/panels/kernelSources/index.d.ts +39 -0
  43. package/lib/panels/kernelSources/index.js +54 -0
  44. package/lib/panels/kernelSources/index.js.map +1 -0
  45. package/lib/panels/kernelSources/model.d.ts +73 -0
  46. package/lib/panels/kernelSources/model.js +120 -0
  47. package/lib/panels/kernelSources/model.js.map +1 -0
  48. package/lib/panels/sources/body.js +5 -3
  49. package/lib/panels/sources/body.js.map +1 -1
  50. package/lib/panels/variables/grid.d.ts +8 -2
  51. package/lib/panels/variables/grid.js +29 -364
  52. package/lib/panels/variables/grid.js.map +1 -1
  53. package/lib/panels/variables/gridpanel.d.ts +140 -0
  54. package/lib/panels/variables/gridpanel.js +363 -0
  55. package/lib/panels/variables/gridpanel.js.map +1 -0
  56. package/lib/panels/variables/index.d.ts +1 -9
  57. package/lib/panels/variables/index.js +1 -15
  58. package/lib/panels/variables/index.js.map +1 -1
  59. package/lib/panels/variables/mimerenderer.d.ts +15 -2
  60. package/lib/panels/variables/mimerenderer.js +56 -17
  61. package/lib/panels/variables/mimerenderer.js.map +1 -1
  62. package/lib/panels/variables/model.d.ts +3 -0
  63. package/lib/panels/variables/model.js +7 -0
  64. package/lib/panels/variables/model.js.map +1 -1
  65. package/lib/panels/variables/scope.js +4 -0
  66. package/lib/panels/variables/scope.js.map +1 -1
  67. package/lib/panels/variables/tree.d.ts +2 -5
  68. package/lib/panels/variables/tree.js +137 -47
  69. package/lib/panels/variables/tree.js.map +1 -1
  70. package/lib/service.d.ts +32 -2
  71. package/lib/service.js +122 -9
  72. package/lib/service.js.map +1 -1
  73. package/lib/session.d.ts +37 -1
  74. package/lib/session.js +89 -6
  75. package/lib/session.js.map +1 -1
  76. package/lib/sidebar.d.ts +7 -1
  77. package/lib/sidebar.js +10 -2
  78. package/lib/sidebar.js.map +1 -1
  79. package/lib/sources.d.ts +2 -2
  80. package/lib/sources.js +32 -17
  81. package/lib/sources.js.map +1 -1
  82. package/lib/tokens.d.ts +139 -24
  83. package/lib/tokens.js.map +1 -1
  84. package/package.json +39 -47
  85. package/src/config.ts +78 -0
  86. package/src/debugger.ts +154 -0
  87. package/src/dialogs/evaluate.ts +144 -0
  88. package/src/factory.ts +72 -0
  89. package/src/handler.ts +528 -0
  90. package/src/handlers/console.ts +118 -0
  91. package/src/handlers/editor.ts +469 -0
  92. package/src/handlers/file.ts +86 -0
  93. package/src/handlers/notebook.ts +128 -0
  94. package/src/hash.ts +69 -0
  95. package/src/icons.ts +64 -0
  96. package/src/index.ts +16 -0
  97. package/src/model.ts +155 -0
  98. package/src/panels/breakpoints/body.tsx +145 -0
  99. package/src/panels/breakpoints/index.ts +116 -0
  100. package/src/panels/breakpoints/model.ts +74 -0
  101. package/src/panels/breakpoints/pauseonexceptions.tsx +141 -0
  102. package/src/panels/callstack/body.tsx +96 -0
  103. package/src/panels/callstack/index.ts +152 -0
  104. package/src/panels/callstack/model.ts +86 -0
  105. package/src/panels/kernelSources/body.tsx +139 -0
  106. package/src/panels/kernelSources/filter.tsx +44 -0
  107. package/src/panels/kernelSources/index.tsx +106 -0
  108. package/src/panels/kernelSources/model.ts +160 -0
  109. package/src/panels/sources/body.ts +161 -0
  110. package/src/panels/sources/index.tsx +85 -0
  111. package/src/panels/sources/model.ts +94 -0
  112. package/src/panels/sources/sourcepath.tsx +28 -0
  113. package/src/panels/variables/grid.ts +144 -0
  114. package/src/panels/variables/gridpanel.ts +455 -0
  115. package/src/panels/variables/index.ts +199 -0
  116. package/src/panels/variables/mimerenderer.ts +125 -0
  117. package/src/panels/variables/model.ts +61 -0
  118. package/src/panels/variables/scope.tsx +132 -0
  119. package/src/panels/variables/tree.tsx +521 -0
  120. package/src/service.ts +1009 -0
  121. package/src/session.ts +342 -0
  122. package/src/sidebar.ts +194 -0
  123. package/src/sources.ts +327 -0
  124. package/src/svg.d.ts +9 -0
  125. package/src/tokens.ts +1071 -0
  126. package/style/base.css +2 -1
  127. package/style/breakpoints.css +21 -12
  128. package/style/icons/arrow-collapse.svg +1 -1
  129. package/style/icons/arrow-expand.svg +1 -1
  130. package/style/icons/exceptions.svg +10 -0
  131. package/style/icons/open-kernel-source.svg +6 -0
  132. package/style/icons/pause.svg +6 -0
  133. package/style/icons.css +9 -8
  134. package/style/index.css +1 -1
  135. package/style/index.js +1 -1
  136. package/style/kernelSources.css +45 -0
  137. package/style/sidebar.css +1 -1
  138. package/style/variables.css +82 -21
@@ -0,0 +1,73 @@
1
+ import { ISignal } from '@lumino/signaling';
2
+ import { IDebugger } from '../../tokens';
3
+ /**
4
+ * The model to keep track of the current source being displayed.
5
+ */
6
+ export declare class KernelSourcesModel implements IDebugger.Model.IKernelSources {
7
+ constructor();
8
+ /**
9
+ * Get the filter.
10
+ */
11
+ get filter(): string;
12
+ /**
13
+ * Set the filter.
14
+ * The update
15
+ */
16
+ set filter(filter: string);
17
+ /**
18
+ * Whether the kernel sources model is disposed or not.
19
+ */
20
+ get isDisposed(): boolean;
21
+ /**
22
+ * Get the kernel sources.
23
+ */
24
+ get kernelSources(): IDebugger.KernelSource[] | null;
25
+ /**
26
+ * Set the kernel sources and emit a changed signal.
27
+ */
28
+ set kernelSources(kernelSources: IDebugger.KernelSource[] | null);
29
+ /**
30
+ * Signal emitted when the current source changes.
31
+ */
32
+ get changed(): ISignal<this, IDebugger.KernelSource[] | null>;
33
+ /**
34
+ * Signal emitted when the current source changes.
35
+ */
36
+ get filterChanged(): ISignal<this, string>;
37
+ /**
38
+ * Signal emitted when a kernel source should be open in the main area.
39
+ */
40
+ get kernelSourceOpened(): ISignal<this, IDebugger.Source | null>;
41
+ /**
42
+ * Dispose the kernel sources model
43
+ */
44
+ dispose(): void;
45
+ /**
46
+ * Open a source in the main area.
47
+ */
48
+ open(kernelSource: IDebugger.Source): void;
49
+ private getFilteredKernelSources;
50
+ private refresh;
51
+ private _filteredKernelSources;
52
+ private _filter;
53
+ private _isDisposed;
54
+ private _kernelSources;
55
+ private _refreshDebouncer;
56
+ private _changed;
57
+ private _filterChanged;
58
+ private _kernelSourceOpened;
59
+ }
60
+ /**
61
+ * A namespace for SourcesModel `statics`.
62
+ */
63
+ export declare namespace KernelSourcesModel {
64
+ /**
65
+ * The options used to initialize a SourcesModel object.
66
+ */
67
+ interface IOptions {
68
+ /**
69
+ * Signal emitted when the current frame changes.
70
+ */
71
+ currentFrameChanged: ISignal<IDebugger.Model.ICallstack, IDebugger.IStackFrame | null>;
72
+ }
73
+ }
@@ -0,0 +1,120 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { Signal } from '@lumino/signaling';
4
+ import { Debouncer } from '@lumino/polling';
5
+ /**
6
+ * The rate limit for the filter debouncer
7
+ */
8
+ const DEBOUNCER_RATE_LIMIT_MS = 500;
9
+ const compare = (a, b) => {
10
+ if (a.name < b.name) {
11
+ return -1;
12
+ }
13
+ if (a.name > b.name) {
14
+ return 1;
15
+ }
16
+ return 0;
17
+ };
18
+ /**
19
+ * The model to keep track of the current source being displayed.
20
+ */
21
+ export class KernelSourcesModel {
22
+ constructor() {
23
+ this._filteredKernelSources = null;
24
+ this._filter = '';
25
+ this._isDisposed = false;
26
+ this._kernelSources = null;
27
+ this._changed = new Signal(this);
28
+ this._filterChanged = new Signal(this);
29
+ this._kernelSourceOpened = new Signal(this);
30
+ this.refresh = this.refresh.bind(this);
31
+ this._refreshDebouncer = new Debouncer(this.refresh, DEBOUNCER_RATE_LIMIT_MS);
32
+ }
33
+ /**
34
+ * Get the filter.
35
+ */
36
+ get filter() {
37
+ return this._filter;
38
+ }
39
+ /**
40
+ * Set the filter.
41
+ * The update
42
+ */
43
+ set filter(filter) {
44
+ this._filter = filter;
45
+ this._filterChanged.emit(filter);
46
+ void this._refreshDebouncer.invoke();
47
+ }
48
+ /**
49
+ * Whether the kernel sources model is disposed or not.
50
+ */
51
+ get isDisposed() {
52
+ return this._isDisposed;
53
+ }
54
+ /**
55
+ * Get the kernel sources.
56
+ */
57
+ get kernelSources() {
58
+ return this._kernelSources;
59
+ }
60
+ /**
61
+ * Set the kernel sources and emit a changed signal.
62
+ */
63
+ set kernelSources(kernelSources) {
64
+ this._kernelSources = kernelSources;
65
+ this.refresh();
66
+ }
67
+ /**
68
+ * Signal emitted when the current source changes.
69
+ */
70
+ get changed() {
71
+ return this._changed;
72
+ }
73
+ /**
74
+ * Signal emitted when the current source changes.
75
+ */
76
+ get filterChanged() {
77
+ return this._filterChanged;
78
+ }
79
+ /**
80
+ * Signal emitted when a kernel source should be open in the main area.
81
+ */
82
+ get kernelSourceOpened() {
83
+ return this._kernelSourceOpened;
84
+ }
85
+ /**
86
+ * Dispose the kernel sources model
87
+ */
88
+ dispose() {
89
+ if (this._isDisposed) {
90
+ return;
91
+ }
92
+ this._isDisposed = true;
93
+ this._refreshDebouncer.dispose();
94
+ Signal.clearData(this);
95
+ }
96
+ /**
97
+ * Open a source in the main area.
98
+ */
99
+ open(kernelSource) {
100
+ this._kernelSourceOpened.emit(kernelSource);
101
+ }
102
+ getFilteredKernelSources() {
103
+ const regexp = new RegExp(this._filter);
104
+ return this._kernelSources.filter(module => regexp.test(module.name));
105
+ }
106
+ refresh() {
107
+ if (this._kernelSources) {
108
+ this._filteredKernelSources = this._filter
109
+ ? this.getFilteredKernelSources()
110
+ : this._kernelSources;
111
+ this._filteredKernelSources.sort(compare);
112
+ }
113
+ else {
114
+ this._kernelSources = new Array();
115
+ this._filteredKernelSources = new Array();
116
+ }
117
+ this._changed.emit(this._filteredKernelSources);
118
+ }
119
+ }
120
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/panels/kernelSources/model.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,i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xB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC3C;aAAM;YACL,IAAI,CAAC,cAAc,GAAG,IAAI,KAAK,EAA0B,CAAC;YAC1D,IAAI,CAAC,sBAAsB,GAAG,IAAI,KAAK,EAA0B,CAAC;SACnE;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAClD,CAAC;CAUF"}
@@ -79,12 +79,14 @@ export class SourcesBody extends Widget {
79
79
  }
80
80
  const { content, mimeType } = source;
81
81
  const editorMimeType = mimeType || this._mimeTypeService.getMimeTypeByFilePath(path !== null && path !== void 0 ? path : '');
82
- this._editor.model.value.text = content;
82
+ this._editor.model.sharedModel.setSource(content);
83
83
  this._editor.model.mimeType = editorMimeType;
84
84
  this._editorHandler = new EditorHandler({
85
85
  debuggerService: this._debuggerService,
86
- editor: this._editor.editor,
87
- path
86
+ editorReady: () => Promise.resolve(this._editor.editor),
87
+ getEditor: () => this._editor.editor,
88
+ path,
89
+ src: this._editor.model.sharedModel
88
90
  });
89
91
  this._model.currentSource = {
90
92
  content,
@@ -1 +1 @@
1
- {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/panels/sources/body.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAQ3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,MAAM;IACrC;;;;OAIG;IACH,YAAY,OAA6B;QACvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,gBAAgB,GAA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qBAAqB,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC;QAEtE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,cAAc,CAAC;QAE7C,IAAI,CAAC,cAAc,GAAG,IAAI,aAAa,CAAC;YACtC,eAAe,EAAE,IAAI,CAAC,gBAAgB;YACtC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACvD,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM;YACpC,IAAI;YACJ,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW;SACpC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG;YAC1B,OAAO;YACP,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE;SACjB,CAAC;QAEF,qBAAqB,CAAC,GAAG,EAAE;YACzB,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CAOF"}
@@ -3,6 +3,7 @@ import { CommandRegistry } from '@lumino/commands';
3
3
  import { Panel } from '@lumino/widgets';
4
4
  import { IDebugger } from '../../tokens';
5
5
  import { ITranslator } from '@jupyterlab/translation';
6
+ import { Message } from '@lumino/messaging';
6
7
  /**
7
8
  * A data grid that displays variables in a debugger session.
8
9
  */
@@ -14,9 +15,13 @@ export declare class VariablesBodyGrid extends Panel {
14
15
  */
15
16
  constructor(options: VariablesBodyGrid.IOptions);
16
17
  /**
17
- * Get the latest hit variable
18
+ * Wait until actually displaying the grid to trigger initialization.
18
19
  */
19
- get latestSelection(): IDebugger.IVariableSelection | null;
20
+ protected onBeforeShow(msg: Message): void;
21
+ /**
22
+ * Load the grid panel implementation.
23
+ */
24
+ protected initialize(): Promise<void>;
20
25
  /**
21
26
  * Set the variable filter list.
22
27
  *
@@ -35,6 +40,7 @@ export declare class VariablesBodyGrid extends Panel {
35
40
  private _update;
36
41
  private _grid;
37
42
  private _model;
43
+ private _options;
38
44
  }
39
45
  /**
40
46
  * A namespace for `VariablesBodyGrid` statics.
@@ -1,10 +1,7 @@
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';
4
+ import { PromiseDelegate } from '@lumino/coreutils';
8
5
  /**
9
6
  * A data grid that displays variables in a debugger session.
10
7
  */
@@ -16,22 +13,31 @@ export class VariablesBodyGrid extends Panel {
16
13
  */
17
14
  constructor(options) {
18
15
  super();
19
- const { model, commands, themeManager, scopes, translator } = options;
20
- this._grid = new Grid({ commands, themeManager, translator });
16
+ this._model = options.model;
17
+ this._options = options;
18
+ this.addClass('jp-DebuggerVariables-body');
19
+ }
20
+ /**
21
+ * Wait until actually displaying the grid to trigger initialization.
22
+ */
23
+ onBeforeShow(msg) {
24
+ if (!this._grid) {
25
+ void this.initialize();
26
+ }
27
+ }
28
+ /**
29
+ * Load the grid panel implementation.
30
+ */
31
+ async initialize() {
32
+ const { model, commands, themeManager, scopes, translator } = this._options;
33
+ const { Grid } = await Private.ensureGridPanel();
34
+ this._grid = new Grid({ commands, model, themeManager, translator });
21
35
  this._grid.addClass('jp-DebuggerVariables-grid');
22
- this._model = model;
23
36
  this._model.changed.connect((model) => {
24
37
  this._update();
25
38
  }, this);
26
39
  this._grid.dataModel.setData(scopes !== null && scopes !== void 0 ? scopes : []);
27
40
  this.addWidget(this._grid);
28
- this.addClass('jp-DebuggerVariables-body');
29
- }
30
- /**
31
- * Get the latest hit variable
32
- */
33
- get latestSelection() {
34
- return this._grid.latestSelection;
35
41
  }
36
42
  /**
37
43
  * Set the variable filter list.
@@ -60,362 +66,21 @@ export class VariablesBodyGrid extends Panel {
60
66
  }
61
67
  }
62
68
  /**
63
- * A class wrapping the underlying variables datagrid.
64
- */
65
- class Grid extends Panel {
66
- /**
67
- * Instantiate a new VariablesGrid.
68
- *
69
- * @param options The instantiation options for a VariablesGrid.
70
- */
71
- constructor(options) {
72
- super();
73
- this._latestSelection = null;
74
- const { commands, themeManager } = options;
75
- const dataModel = new GridModel(options.translator);
76
- const grid = new DataGrid();
77
- const mouseHandler = new Private.MouseHandler();
78
- mouseHandler.doubleClicked.connect((_, hit) => commands.execute(Debugger.CommandIDs.inspectVariable, {
79
- variableReference: dataModel.getVariableReference(hit.row),
80
- name: dataModel.getVariableName(hit.row)
81
- }));
82
- mouseHandler.selected.connect((_, hit) => {
83
- const { row } = hit;
84
- this._latestSelection = {
85
- name: dataModel.getVariableName(row),
86
- value: dataModel.data('body', row, 1),
87
- type: dataModel.data('body', row, 2),
88
- variablesReference: dataModel.getVariableReference(row)
89
- };
90
- });
91
- grid.dataModel = dataModel;
92
- grid.keyHandler = new BasicKeyHandler();
93
- grid.mouseHandler = mouseHandler;
94
- grid.selectionModel = new BasicSelectionModel({
95
- dataModel
96
- });
97
- grid.stretchLastColumn = true;
98
- grid.node.style.height = '100%';
99
- this._grid = grid;
100
- // Compute the grid's styles based on the current theme.
101
- if (themeManager) {
102
- themeManager.themeChanged.connect(this._updateStyles, this);
103
- }
104
- this.addWidget(grid);
105
- }
106
- /**
107
- * Set the variable filter list.
108
- *
109
- * @param filter The variable filter to apply.
110
- */
111
- set filter(filter) {
112
- this._grid.dataModel.filter = filter;
113
- this.update();
114
- }
115
- /**
116
- * Set the scope for the variables data model.
117
- *
118
- * @param scope The scopes for the variables
119
- */
120
- set scope(scope) {
121
- this._grid.dataModel.scope = scope;
122
- this.update();
123
- }
124
- /**
125
- * Get the data model for the data grid.
126
- */
127
- get dataModel() {
128
- return this._grid.dataModel;
129
- }
130
- /**
131
- * Get the latest hit variable
132
- */
133
- get latestSelection() {
134
- return this._latestSelection;
135
- }
136
- /**
137
- * Handle `after-attach` messages.
138
- *
139
- * @param message - The `after-attach` message.
140
- */
141
- onAfterAttach(message) {
142
- super.onAfterAttach(message);
143
- this._updateStyles();
144
- }
145
- /**
146
- * Update the computed style for the data grid on theme change.
147
- */
148
- _updateStyles() {
149
- const { style, textRenderer } = Private.computeStyle();
150
- this._grid.cellRenderers.update({}, textRenderer);
151
- this._grid.style = style;
152
- }
153
- }
154
- /**
155
- * A data grid model for variables.
156
- */
157
- class GridModel extends DataModel {
158
- /**
159
- * Create gird model
160
- * @param translator optional translator
161
- */
162
- constructor(translator) {
163
- super();
164
- this._filter = new Set();
165
- this._scope = '';
166
- this._data = {
167
- name: [],
168
- type: [],
169
- value: [],
170
- variablesReference: []
171
- };
172
- translator = translator || nullTranslator;
173
- this._trans = translator.load('jupyterlab');
174
- }
175
- /**
176
- * Set the variable filter list.
177
- */
178
- set filter(filter) {
179
- this._filter = filter;
180
- }
181
- /**
182
- * Get the current scope for the variables.
183
- */
184
- get scope() {
185
- return this._scope;
186
- }
187
- /**
188
- * Set the variable scope
189
- */
190
- set scope(scope) {
191
- this._scope = scope;
192
- }
193
- /**
194
- * Get the row count for a particular region in the data grid.
195
- *
196
- * @param region The datagrid region.
197
- */
198
- rowCount(region) {
199
- return region === 'body' ? this._data.name.length : 1;
200
- }
201
- /**
202
- * Get the column count for a particular region in the data grid.
203
- *
204
- * @param region The datagrid region.
205
- */
206
- columnCount(region) {
207
- return region === 'body' ? 2 : 1;
208
- }
209
- /**
210
- * Get the data count for a particular region, row and column in the data grid.
211
- *
212
- * @param region The datagrid region.
213
- * @param row The datagrid row
214
- * @param column The datagrid column
215
- */
216
- data(region, row, column) {
217
- if (region === 'row-header') {
218
- return this._data.name[row];
219
- }
220
- if (region === 'column-header') {
221
- return column === 1 ? this._trans.__('Value') : this._trans.__('Type');
222
- }
223
- if (region === 'corner-header') {
224
- return this._trans.__('Name');
225
- }
226
- return column === 1 ? this._data.value[row] : this._data.type[row];
227
- }
228
- /**
229
- * Get the variable reference for a given row
230
- *
231
- * @param row The row in the datagrid.
232
- */
233
- getVariableReference(row) {
234
- return this._data.variablesReference[row];
235
- }
236
- /**
237
- * Get the variable name for a given row
238
- *
239
- * @param row The row in the datagrid.
240
- */
241
- getVariableName(row) {
242
- return this._data.name[row];
243
- }
244
- /**
245
- * Set the datagrid model data from the list of variables.
246
- *
247
- * @param scopes The list of variables.
248
- */
249
- setData(scopes) {
250
- var _a, _b;
251
- this._clearData();
252
- this.emitChanged({
253
- type: 'model-reset',
254
- region: 'body'
255
- });
256
- const scope = (_a = scopes.find(scope => scope.name === this._scope)) !== null && _a !== void 0 ? _a : scopes[0];
257
- const variables = (_b = scope === null || scope === void 0 ? void 0 : scope.variables) !== null && _b !== void 0 ? _b : [];
258
- const filtered = variables.filter(variable => variable.name && !this._filter.has(variable.name));
259
- filtered.forEach((variable, index) => {
260
- var _a;
261
- this._data.name[index] = variable.name;
262
- this._data.type[index] = (_a = variable.type) !== null && _a !== void 0 ? _a : '';
263
- this._data.value[index] = variable.value;
264
- this._data.variablesReference[index] = variable.variablesReference;
265
- });
266
- this.emitChanged({
267
- type: 'rows-inserted',
268
- region: 'body',
269
- index: 1,
270
- span: filtered.length
271
- });
272
- }
273
- /**
274
- * Clear all the data in the datagrid.
275
- */
276
- _clearData() {
277
- this._data = {
278
- name: [],
279
- type: [],
280
- value: [],
281
- variablesReference: []
282
- };
283
- }
284
- }
285
- /**
286
- * A namespace for private data.
69
+ * A private namespace for managing lazy loading of the underlying grid panel.
287
70
  */
288
71
  var Private;
289
72
  (function (Private) {
73
+ let gridPanelLoaded = null;
290
74
  /**
291
- * Create a color palette element.
292
- */
293
- function createPalette() {
294
- const div = document.createElement('div');
295
- div.className = 'jp-DebuggerVariables-colorPalette';
296
- div.innerHTML = `
297
- <div class="jp-mod-void"></div>
298
- <div class="jp-mod-background"></div>
299
- <div class="jp-mod-header-background"></div>
300
- <div class="jp-mod-grid-line"></div>
301
- <div class="jp-mod-header-grid-line"></div>
302
- <div class="jp-mod-selection"></div>
303
- <div class="jp-mod-text"></div>
304
- `;
305
- return div;
306
- }
307
- /**
308
- * Compute the style and renderer for a data grid.
309
- */
310
- function computeStyle() {
311
- const palette = createPalette();
312
- document.body.appendChild(palette);
313
- let node;
314
- node = palette.querySelector('.jp-mod-void');
315
- const voidColor = getComputedStyle(node).color;
316
- node = palette.querySelector('.jp-mod-background');
317
- const backgroundColor = getComputedStyle(node).color;
318
- node = palette.querySelector('.jp-mod-header-background');
319
- const headerBackgroundColor = getComputedStyle(node).color;
320
- node = palette.querySelector('.jp-mod-grid-line');
321
- const gridLineColor = getComputedStyle(node).color;
322
- node = palette.querySelector('.jp-mod-header-grid-line');
323
- const headerGridLineColor = getComputedStyle(node).color;
324
- node = palette.querySelector('.jp-mod-selection');
325
- const selectionFillColor = getComputedStyle(node).color;
326
- node = palette.querySelector('.jp-mod-text');
327
- const textColor = getComputedStyle(node).color;
328
- document.body.removeChild(palette);
329
- return {
330
- style: {
331
- voidColor,
332
- backgroundColor,
333
- headerBackgroundColor,
334
- gridLineColor,
335
- headerGridLineColor,
336
- rowBackgroundColor: (i) => i % 2 === 0 ? voidColor : backgroundColor,
337
- selectionFillColor
338
- },
339
- textRenderer: new TextRenderer({
340
- font: '12px sans-serif',
341
- textColor,
342
- backgroundColor: '',
343
- verticalAlignment: 'center',
344
- horizontalAlignment: 'left'
345
- })
346
- };
347
- }
348
- Private.computeStyle = computeStyle;
349
- /**
350
- * A custom click handler to handle clicks on the variables grid.
75
+ * Lazily load the datagrid module when the first grid is requested.
351
76
  */
352
- class MouseHandler extends BasicMouseHandler {
353
- constructor() {
354
- super(...arguments);
355
- this._doubleClicked = new Signal(this);
356
- this._selected = new Signal(this);
357
- }
358
- /**
359
- * A signal emitted when the variables grid is double clicked.
360
- */
361
- get doubleClicked() {
362
- return this._doubleClicked;
363
- }
364
- /**
365
- * A signal emitted when the variables grid received mouse down or context menu event.
366
- */
367
- get selected() {
368
- return this._selected;
369
- }
370
- /**
371
- * Dispose of the resources held by the mouse handler.
372
- */
373
- dispose() {
374
- if (this.isDisposed) {
375
- return;
376
- }
377
- Signal.disconnectSender(this);
378
- super.dispose();
379
- }
380
- /**
381
- * Handle a mouse double-click event.
382
- *
383
- * @param grid The datagrid clicked.
384
- * @param event The mouse event.
385
- */
386
- onMouseDoubleClick(grid, event) {
387
- const hit = grid.hitTest(event.clientX, event.clientY);
388
- this._doubleClicked.emit(hit);
389
- }
390
- /**
391
- * Handle the mouse down event for the data grid.
392
- *
393
- * @param grid - The data grid of interest.
394
- *
395
- * @param event - The mouse down event of interest.
396
- */
397
- onMouseDown(grid, event) {
398
- // Unpack the event.
399
- let { clientX, clientY } = event;
400
- // Hit test the grid.
401
- let hit = grid.hitTest(clientX, clientY);
402
- this._selected.emit(hit);
403
- }
404
- /**
405
- * Handle the context menu event for the data grid.
406
- *
407
- * @param grid - The data grid of interest.
408
- *
409
- * @param event - The context menu event of interest.
410
- */
411
- onContextMenu(grid, event) {
412
- // Unpack the event.
413
- let { clientX, clientY } = event;
414
- // Hit test the grid.
415
- let hit = grid.hitTest(clientX, clientY);
416
- this._selected.emit(hit);
77
+ async function ensureGridPanel() {
78
+ if (gridPanelLoaded == null) {
79
+ gridPanelLoaded = new PromiseDelegate();
80
+ gridPanelLoaded.resolve(await import('./gridpanel'));
417
81
  }
82
+ return gridPanelLoaded.promise;
418
83
  }
419
- Private.MouseHandler = MouseHandler;
84
+ Private.ensureGridPanel = ensureGridPanel;
420
85
  })(Private || (Private = {}));
421
86
  //# sourceMappingURL=grid.js.map