@jupyterlab/debugger
Version:
JupyterLab - Debugger Extension
44 lines • 1.91 kB
JavaScript
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
import { nullTranslator } from '@jupyterlab/translation';
import { PanelWithToolbar, ReactWidget, ToolbarButton, viewBreakpointIcon } from '@jupyterlab/ui-components';
import React from 'react';
import { SourcesBody } from './body';
import { SourcePathComponent } from './sourcepath';
/**
* A Panel that shows a preview of the source code while debugging.
*/
export class Sources extends PanelWithToolbar {
/**
* Instantiate a new Sources preview Panel.
*
* @param options The Sources instantiation options.
*/
constructor(options) {
var _a;
super();
const { model, service, editorServices } = options;
const trans = ((_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
this.title.label = trans.__('Source');
this.toolbar.addClass('jp-DebuggerSources-header');
this.toolbar.node.setAttribute('aria-label', trans.__('Sources preview panel toolbar'));
const body = new SourcesBody({
service,
model,
editorServices
});
this.toolbar.addItem('open', new ToolbarButton({
icon: viewBreakpointIcon,
onClick: () => model.open(),
tooltip: trans.__('Open in the Main Area')
}));
const sourcePath = ReactWidget.create(React.createElement(SourcePathComponent, { model: model, trans: trans }));
this.toolbar.addItem('sourcePath', sourcePath);
this.addClass('jp-DebuggerSources-header');
this.addWidget(body);
this.addClass('jp-DebuggerSources');
}
}
//# sourceMappingURL=index.js.map