@jupyterlab/codeeditor 3.4.3 → 4.0.0-alpha.11

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/editor.d.ts CHANGED
@@ -44,7 +44,7 @@ export declare namespace CodeEditor {
44
44
  /**
45
45
  * An interface describing editor state coordinates.
46
46
  */
47
- interface ICoordinate extends JSONObject, ClientRect {
47
+ interface ICoordinate extends DOMRectReadOnly {
48
48
  }
49
49
  /**
50
50
  * A range.
package/lib/index.d.ts CHANGED
@@ -3,8 +3,10 @@
3
3
  * @module codeeditor
4
4
  */
5
5
  export * from './editor';
6
- export * from './jsoneditor';
7
- export * from './widget';
8
6
  export * from './factory';
7
+ export * from './jsoneditor';
8
+ export * from './lineCol';
9
9
  export * from './mimetype';
10
10
  export * from './tokens';
11
+ export * from './viewer';
12
+ export * from './widget';
package/lib/index.js CHANGED
@@ -5,9 +5,11 @@
5
5
  * @module codeeditor
6
6
  */
7
7
  export * from './editor';
8
- export * from './jsoneditor';
9
- export * from './widget';
10
8
  export * from './factory';
9
+ export * from './jsoneditor';
10
+ export * from './lineCol';
11
11
  export * from './mimetype';
12
12
  export * from './tokens';
13
+ export * from './viewer';
14
+ export * from './widget';
13
15
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { ITranslator } from '@jupyterlab/translation';
2
+ import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
3
+ import React from 'react';
4
+ import { CodeEditor } from './editor';
5
+ /**
6
+ * A namespace for LineColComponent.
7
+ */
8
+ declare namespace LineColComponent {
9
+ /**
10
+ * Props for LineColComponent.
11
+ */
12
+ interface IProps {
13
+ /**
14
+ * The current line number.
15
+ */
16
+ line: number;
17
+ /**
18
+ * The current column number.
19
+ */
20
+ column: number;
21
+ /**
22
+ * The application language translator.
23
+ */
24
+ translator?: ITranslator;
25
+ /**
26
+ * A click handler for the LineColComponent, which
27
+ * we use to launch the LineFormComponent.
28
+ */
29
+ handleClick: () => void;
30
+ }
31
+ }
32
+ /**
33
+ * A pure functional component for rendering a line/column
34
+ * status item.
35
+ */
36
+ declare function LineColComponent(props: LineColComponent.IProps): React.ReactElement<LineColComponent.IProps>;
37
+ /**
38
+ * A widget implementing a line/column status item.
39
+ */
40
+ export declare class LineCol extends VDomRenderer<LineCol.Model> {
41
+ /**
42
+ * Construct a new LineCol status item.
43
+ */
44
+ constructor(translator?: ITranslator);
45
+ /**
46
+ * Render the status item.
47
+ */
48
+ render(): React.ReactElement<LineColComponent.IProps> | null;
49
+ /**
50
+ * A click handler for the widget.
51
+ */
52
+ private _handleClick;
53
+ /**
54
+ * Handle submission for the widget.
55
+ */
56
+ private _handleSubmit;
57
+ protected translator: ITranslator;
58
+ private _popup;
59
+ }
60
+ /**
61
+ * A namespace for LineCol statics.
62
+ */
63
+ export declare namespace LineCol {
64
+ /**
65
+ * A VDom model for a status item tracking the line/column of an editor.
66
+ */
67
+ class Model extends VDomModel {
68
+ /**
69
+ * The current editor of the model.
70
+ */
71
+ get editor(): CodeEditor.IEditor | null;
72
+ set editor(editor: CodeEditor.IEditor | null);
73
+ /**
74
+ * The current line of the model.
75
+ */
76
+ get line(): number;
77
+ /**
78
+ * The current column of the model.
79
+ */
80
+ get column(): number;
81
+ /**
82
+ * React to a change in the cursors of the current editor.
83
+ */
84
+ private _onSelectionChanged;
85
+ private _getAllState;
86
+ private _triggerChange;
87
+ private _line;
88
+ private _column;
89
+ private _editor;
90
+ }
91
+ }
92
+ export {};
package/lib/lineCol.js ADDED
@@ -0,0 +1,206 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { interactiveItem, showPopup, TextItem } from '@jupyterlab/statusbar';
4
+ import { nullTranslator } from '@jupyterlab/translation';
5
+ import { classes, lineFormIcon, ReactWidget, VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
6
+ import React from 'react';
7
+ /**
8
+ * A component for rendering a "go-to-line" form.
9
+ */
10
+ class LineFormComponent extends React.Component {
11
+ /**
12
+ * Construct a new LineFormComponent.
13
+ */
14
+ constructor(props) {
15
+ super(props);
16
+ /**
17
+ * Handle a change to the value in the input field.
18
+ */
19
+ this._handleChange = (event) => {
20
+ this.setState({ value: event.currentTarget.value });
21
+ };
22
+ /**
23
+ * Handle submission of the input field.
24
+ */
25
+ this._handleSubmit = (event) => {
26
+ event.preventDefault();
27
+ const value = parseInt(this._textInput.value, 10);
28
+ if (!isNaN(value) &&
29
+ isFinite(value) &&
30
+ 1 <= value &&
31
+ value <= this.props.maxLine) {
32
+ this.props.handleSubmit(value);
33
+ }
34
+ return false;
35
+ };
36
+ /**
37
+ * Handle focusing of the input field.
38
+ */
39
+ this._handleFocus = () => {
40
+ this.setState({ hasFocus: true });
41
+ };
42
+ /**
43
+ * Handle blurring of the input field.
44
+ */
45
+ this._handleBlur = () => {
46
+ this.setState({ hasFocus: false });
47
+ };
48
+ this._textInput = null;
49
+ this.translator = props.translator || nullTranslator;
50
+ this._trans = this.translator.load('jupyterlab');
51
+ this.state = {
52
+ value: '',
53
+ hasFocus: false
54
+ };
55
+ }
56
+ /**
57
+ * Focus the element on mount.
58
+ */
59
+ componentDidMount() {
60
+ this._textInput.focus();
61
+ }
62
+ /**
63
+ * Render the LineFormComponent.
64
+ */
65
+ render() {
66
+ return (React.createElement("div", { className: "jp-lineFormSearch" },
67
+ React.createElement("form", { name: "lineColumnForm", onSubmit: this._handleSubmit, noValidate: true },
68
+ React.createElement("div", { className: classes('jp-lineFormWrapper', 'lm-lineForm-wrapper', this.state.hasFocus ? 'jp-lineFormWrapperFocusWithin' : undefined) },
69
+ React.createElement("input", { type: "text", className: "jp-lineFormInput", onChange: this._handleChange, onFocus: this._handleFocus, onBlur: this._handleBlur, value: this.state.value, ref: input => {
70
+ this._textInput = input;
71
+ } }),
72
+ React.createElement("div", { className: "jp-baseLineForm jp-lineFormButtonContainer" },
73
+ React.createElement(lineFormIcon.react, { className: "jp-baseLineForm jp-lineFormButtonIcon", elementPosition: "center" }),
74
+ React.createElement("input", { type: "submit", className: "jp-baseLineForm jp-lineFormButton", value: "" }))),
75
+ React.createElement("label", { className: "jp-lineFormCaption" }, this._trans.__('Go to line number between 1 and %1', this.props.maxLine)))));
76
+ }
77
+ }
78
+ /**
79
+ * A pure functional component for rendering a line/column
80
+ * status item.
81
+ */
82
+ function LineColComponent(props) {
83
+ const translator = props.translator || nullTranslator;
84
+ const trans = translator.load('jupyterlab');
85
+ return (React.createElement(TextItem, { onClick: props.handleClick, source: trans.__('Ln %1, Col %2', props.line, props.column), title: trans.__('Go to line number…') }));
86
+ }
87
+ /**
88
+ * A widget implementing a line/column status item.
89
+ */
90
+ export class LineCol extends VDomRenderer {
91
+ /**
92
+ * Construct a new LineCol status item.
93
+ */
94
+ constructor(translator) {
95
+ super(new LineCol.Model());
96
+ this._popup = null;
97
+ this.addClass(interactiveItem);
98
+ this.translator = translator || nullTranslator;
99
+ }
100
+ /**
101
+ * Render the status item.
102
+ */
103
+ render() {
104
+ if (this.model === null) {
105
+ return null;
106
+ }
107
+ else {
108
+ return (React.createElement(LineColComponent, { line: this.model.line, column: this.model.column, translator: this.translator, handleClick: () => this._handleClick() }));
109
+ }
110
+ }
111
+ /**
112
+ * A click handler for the widget.
113
+ */
114
+ _handleClick() {
115
+ if (this._popup) {
116
+ this._popup.dispose();
117
+ }
118
+ const body = ReactWidget.create(React.createElement(LineFormComponent, { handleSubmit: val => this._handleSubmit(val), currentLine: this.model.line, maxLine: this.model.editor.lineCount, translator: this.translator }));
119
+ this._popup = showPopup({
120
+ body: body,
121
+ anchor: this,
122
+ align: 'right'
123
+ });
124
+ }
125
+ /**
126
+ * Handle submission for the widget.
127
+ */
128
+ _handleSubmit(value) {
129
+ this.model.editor.setCursorPosition({ line: value - 1, column: 0 });
130
+ this._popup.dispose();
131
+ this.model.editor.focus();
132
+ }
133
+ }
134
+ /**
135
+ * A namespace for LineCol statics.
136
+ */
137
+ (function (LineCol) {
138
+ /**
139
+ * A VDom model for a status item tracking the line/column of an editor.
140
+ */
141
+ class Model extends VDomModel {
142
+ constructor() {
143
+ super(...arguments);
144
+ /**
145
+ * React to a change in the cursors of the current editor.
146
+ */
147
+ this._onSelectionChanged = () => {
148
+ const oldState = this._getAllState();
149
+ const pos = this.editor.getCursorPosition();
150
+ this._line = pos.line + 1;
151
+ this._column = pos.column + 1;
152
+ this._triggerChange(oldState, this._getAllState());
153
+ };
154
+ this._line = 1;
155
+ this._column = 1;
156
+ this._editor = null;
157
+ }
158
+ /**
159
+ * The current editor of the model.
160
+ */
161
+ get editor() {
162
+ return this._editor;
163
+ }
164
+ set editor(editor) {
165
+ const oldEditor = this._editor;
166
+ if (oldEditor) {
167
+ oldEditor.model.selections.changed.disconnect(this._onSelectionChanged);
168
+ }
169
+ const oldState = this._getAllState();
170
+ this._editor = editor;
171
+ if (!this._editor) {
172
+ this._column = 1;
173
+ this._line = 1;
174
+ }
175
+ else {
176
+ this._editor.model.selections.changed.connect(this._onSelectionChanged);
177
+ const pos = this._editor.getCursorPosition();
178
+ this._column = pos.column + 1;
179
+ this._line = pos.line + 1;
180
+ }
181
+ this._triggerChange(oldState, this._getAllState());
182
+ }
183
+ /**
184
+ * The current line of the model.
185
+ */
186
+ get line() {
187
+ return this._line;
188
+ }
189
+ /**
190
+ * The current column of the model.
191
+ */
192
+ get column() {
193
+ return this._column;
194
+ }
195
+ _getAllState() {
196
+ return [this._line, this._column];
197
+ }
198
+ _triggerChange(oldState, newState) {
199
+ if (oldState[0] !== newState[0] || oldState[1] !== newState[1]) {
200
+ this.stateChanged.emit(void 0);
201
+ }
202
+ }
203
+ }
204
+ LineCol.Model = Model;
205
+ })(LineCol || (LineCol = {}));
206
+ //# sourceMappingURL=lineCol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineCol.js","sourceRoot":"","sources":["../src/lineCol.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EACL,eAAe,EAEf,SAAS,EACT,QAAQ,EACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAiD1B;;GAEG;AACH,MAAM,iBAAkB,SAAQ,KAAK,CAAC,SAGrC;IACC;;OAEG;IACH,YAAY,KAA+B;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAgEf;;WAEG;QACK,kBAAa,GAAG,CAAC,KAA0C,EAAE,EAAE;YACrE,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF;;WAEG;QACK,kBAAa,GAAG,CAAC,KAAuC,EAAE,EAAE;YAClE,KAAK,CAAC,cAAc,EAAE,CAAC;YAEvB,MAAM,KAAK,GAAG,QA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from './editor';
2
4
  import { IEditorFactoryService } from './factory';
3
5
  import { IEditorMimeTypeService } from './mimetype';
4
6
  /**
@@ -18,3 +20,23 @@ export interface IEditorServices {
18
20
  */
19
21
  readonly mimeTypeService: IEditorMimeTypeService;
20
22
  }
23
+ /**
24
+ * Code editor cursor position token.
25
+ */
26
+ export declare const IPositionModel: Token<IPositionModel>;
27
+ /**
28
+ * Code editor cursor position model.
29
+ */
30
+ export interface IPositionModel {
31
+ /**
32
+ * Add a editor provider.
33
+ *
34
+ * A provider will receive the currently active widget and must return the
35
+ * associated editor if it can or null otherwise.
36
+ */
37
+ addEditorProvider: (provider: (widget: Widget | null) => CodeEditor.IEditor | null) => void;
38
+ /**
39
+ * Callback to force updating the provider
40
+ */
41
+ update(): void;
42
+ }
package/lib/tokens.js CHANGED
@@ -1,9 +1,12 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { Token } from '@lumino/coreutils';
4
- /* tslint:disable */
5
4
  /**
6
5
  * Code editor services token.
7
6
  */
8
7
  export const IEditorServices = new Token('@jupyterlab/codeeditor:IEditorServices');
8
+ /**
9
+ * Code editor cursor position token.
10
+ */
11
+ export const IPositionModel = new Token('@jupyterlab/codeeditor:IPositionModel');
9
12
  //# sourceMappingURL=tokens.js.map
package/lib/tokens.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,oBAAoB;AACpB;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,KAAK,CACtC,wCAAwC,CACzC,CAAC"}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,KAAK,CACtC,wCAAwC,CACzC,CAAC;AAiBF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,KAAK,CACrC,uCAAuC,CACxC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { Widget } from '@lumino/widgets';
2
+ import { CodeEditor } from './editor';
3
+ export declare class CodeViewerWidget extends Widget {
4
+ /**
5
+ * Construct a new code viewer widget.
6
+ */
7
+ constructor(options: CodeViewerWidget.IOptions);
8
+ static createCodeViewer(options: CodeViewerWidget.INoModelOptions): CodeViewerWidget;
9
+ get content(): string;
10
+ get mimeType(): string;
11
+ model: CodeEditor.IModel;
12
+ editor: CodeEditor.IEditor;
13
+ }
14
+ /**
15
+ * The namespace for code viewer widget.
16
+ */
17
+ export declare namespace CodeViewerWidget {
18
+ /**
19
+ * The options used to create an code viewer widget.
20
+ */
21
+ interface IOptions {
22
+ /**
23
+ * A code editor factory.
24
+ */
25
+ factory: CodeEditor.Factory;
26
+ /**
27
+ * The content model for the viewer.
28
+ */
29
+ model: CodeEditor.Model;
30
+ }
31
+ /**
32
+ * The options used to create an code viewer widget without a model.
33
+ */
34
+ interface INoModelOptions {
35
+ /**
36
+ * A code editor factory.
37
+ */
38
+ factory: CodeEditor.Factory;
39
+ /**
40
+ * The content to display in the viewer.
41
+ */
42
+ content: string;
43
+ /**
44
+ * The mime type for the content.
45
+ */
46
+ mimeType?: string;
47
+ }
48
+ }
package/lib/viewer.js ADDED
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
3
+ import { StackedLayout, Widget } from '@lumino/widgets';
4
+ import { CodeEditor } from './editor';
5
+ import { CodeEditorWrapper } from './widget';
6
+ export class CodeViewerWidget extends Widget {
7
+ /**
8
+ * Construct a new code viewer widget.
9
+ */
10
+ constructor(options) {
11
+ super();
12
+ this.model = options.model;
13
+ const editorWidget = new CodeEditorWrapper({
14
+ factory: options.factory,
15
+ model: options.model
16
+ });
17
+ this.editor = editorWidget.editor;
18
+ this.editor.setOption('readOnly', true);
19
+ const layout = (this.layout = new StackedLayout());
20
+ layout.addWidget(editorWidget);
21
+ }
22
+ static createCodeViewer(options) {
23
+ const model = new CodeEditor.Model({
24
+ value: options.content,
25
+ mimeType: options.mimeType
26
+ });
27
+ return new CodeViewerWidget({ factory: options.factory, model });
28
+ }
29
+ get content() {
30
+ return this.model.value.text;
31
+ }
32
+ get mimeType() {
33
+ return this.model.mimeType;
34
+ }
35
+ }
36
+ //# sourceMappingURL=viewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewer.js","sourceRoot":"","sources":["../src/viewer.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IAC1C;;OAEG;IACH,YAAY,OAAkC;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE3B,MAAM,YAAY,GAAG,IAAI,iBAAiB,CAAC;YACzC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACjC,C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IAAI,KAAK,CAAC,cAAc,KAAK,MAAM,EAAE;YACnC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;YAC1B,OAAO;SACR;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;CAIF;AA8CD;;GAEG;AACH,IAAU,OAAO,CAYhB;AAZD,WAAU,OAAO;IACf;;OAEG;IACH,SAAgB,YAAY,CAAC,IAAc;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAW,CAAC;IAC1C,CAAC;IAPe,oBAAY,eAO3B,CAAA;AACH,CAAC,EAZS,OAAO,KAAP,OAAO,QAYhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/codeeditor",
3
- "version": "3.4.3",
3
+ "version": "4.0.0-alpha.11",
4
4
  "description": "JupyterLab - Abstract Code Editor",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -41,27 +41,29 @@
41
41
  "watch": "tsc -b --watch"
42
42
  },
43
43
  "dependencies": {
44
- "@jupyterlab/coreutils": "^5.4.3",
45
- "@jupyterlab/nbformat": "^3.4.3",
46
- "@jupyterlab/observables": "^4.4.3",
47
- "@jupyterlab/shared-models": "^3.4.3",
48
- "@jupyterlab/translation": "^3.4.3",
49
- "@jupyterlab/ui-components": "^3.4.3",
50
- "@lumino/coreutils": "^1.11.0",
51
- "@lumino/disposable": "^1.10.0",
52
- "@lumino/dragdrop": "^1.13.0",
53
- "@lumino/messaging": "^1.10.0",
54
- "@lumino/signaling": "^1.10.0",
55
- "@lumino/widgets": "^1.30.0"
44
+ "@jupyterlab/coreutils": "^6.0.0-alpha.11",
45
+ "@jupyterlab/nbformat": "^4.0.0-alpha.11",
46
+ "@jupyterlab/observables": "^5.0.0-alpha.11",
47
+ "@jupyterlab/shared-models": "^4.0.0-alpha.11",
48
+ "@jupyterlab/statusbar": "^4.0.0-alpha.11",
49
+ "@jupyterlab/translation": "^4.0.0-alpha.11",
50
+ "@jupyterlab/ui-components": "^4.0.0-alpha.26",
51
+ "@lumino/coreutils": "^1.12.0",
52
+ "@lumino/disposable": "^1.10.1",
53
+ "@lumino/dragdrop": "^1.14.0",
54
+ "@lumino/messaging": "^1.10.1",
55
+ "@lumino/signaling": "^1.10.1",
56
+ "@lumino/widgets": "^1.32.0",
57
+ "react": "^17.0.1"
56
58
  },
57
59
  "devDependencies": {
58
- "@jupyterlab/testutils": "^3.4.3",
60
+ "@jupyterlab/testutils": "^4.0.0-alpha.11",
59
61
  "@types/jest": "^26.0.10",
60
62
  "jest": "^26.4.2",
61
63
  "rimraf": "~3.0.0",
62
64
  "ts-jest": "^26.3.0",
63
- "typedoc": "~0.21.2",
64
- "typescript": "~4.1.3"
65
+ "typedoc": "~0.22.10",
66
+ "typescript": "~4.6.3"
65
67
  },
66
68
  "publishConfig": {
67
69
  "access": "public"
package/style/base.css CHANGED
@@ -3,6 +3,7 @@
3
3
  |
4
4
  | Distributed under the terms of the Modified BSD License.
5
5
  |----------------------------------------------------------------------------*/
6
+ @import url('./linecol.css');
6
7
 
7
8
  .jp-JSONEditor {
8
9
  display: flex;
@@ -13,7 +14,7 @@
13
14
  .jp-JSONEditor-host {
14
15
  flex: 1 1 auto;
15
16
  border: var(--jp-border-width) solid var(--jp-input-border-color);
16
- border-radius: 0px;
17
+ border-radius: 0;
17
18
  background: var(--jp-layout-color0);
18
19
  min-height: 50px;
19
20
  padding: 1px;
package/style/index.css CHANGED
@@ -6,6 +6,7 @@
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
7
  @import url('~@lumino/widgets/style/index.css');
8
8
  @import url('~@jupyterlab/ui-components/style/index.css');
9
+ @import url('~@jupyterlab/statusbar/style/index.css');
9
10
  @import url('~@lumino/dragdrop/style/index.css');
10
11
 
11
12
  @import url('./base.css');
package/style/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
7
  import '@lumino/widgets/style/index.js';
8
8
  import '@jupyterlab/ui-components/style/index.js';
9
+ import '@jupyterlab/statusbar/style/index.js';
9
10
  import '@lumino/dragdrop/style/index.js';
10
11
 
11
12
  import './base.css';
@@ -0,0 +1,74 @@
1
+ .jp-lineFormSearch {
2
+ padding: 4px 12px;
3
+ background-color: var(--jp-layout-color2);
4
+ box-shadow: var(--jp-toolbar-box-shadow);
5
+ z-index: 2;
6
+ font-size: var(--jp-ui-font-size1);
7
+ }
8
+
9
+ .jp-lineFormCaption {
10
+ font-size: var(--jp-ui-font-size0);
11
+ line-height: var(--jp-ui-font-size1);
12
+ margin-top: 4px;
13
+ color: var(--jp-ui-font-color0);
14
+ }
15
+
16
+ .jp-baseLineForm {
17
+ border: none;
18
+ border-radius: 0;
19
+ position: absolute;
20
+ background-size: 16px;
21
+ background-repeat: no-repeat;
22
+ background-position: center;
23
+ outline: none;
24
+ }
25
+
26
+ .jp-lineFormButtonContainer {
27
+ top: 4px;
28
+ right: 8px;
29
+ height: 24px;
30
+ padding: 0 12px;
31
+ width: 12px;
32
+ }
33
+
34
+ .jp-lineFormButtonIcon {
35
+ top: 0;
36
+ right: 0;
37
+ background-color: var(--jp-brand-color1);
38
+ height: 100%;
39
+ width: 100%;
40
+ box-sizing: border-box;
41
+ padding: 4px 6px;
42
+ }
43
+
44
+ .jp-lineFormButton {
45
+ top: 0;
46
+ right: 0;
47
+ background-color: transparent;
48
+ height: 100%;
49
+ width: 100%;
50
+ box-sizing: border-box;
51
+ }
52
+
53
+ .jp-lineFormWrapper {
54
+ overflow: hidden;
55
+ padding: 0 8px;
56
+ border: 1px solid var(--jp-border-color0);
57
+ background-color: var(--jp-input-active-background);
58
+ height: 22px;
59
+ }
60
+
61
+ .jp-lineFormWrapperFocusWithin {
62
+ border: var(--jp-border-width) solid var(--md-blue-500);
63
+ box-shadow: inset 0 0 4px var(--md-blue-300);
64
+ }
65
+
66
+ .jp-lineFormInput {
67
+ background: transparent;
68
+ width: 200px;
69
+ height: 100%;
70
+ border: none;
71
+ outline: none;
72
+ color: var(--jp-ui-font-color0);
73
+ line-height: 28px;
74
+ }