@jupyterlab/codeeditor 4.0.0-alpha.4 → 4.0.0-alpha.7

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
@@ -352,7 +352,7 @@ export declare namespace CodeEditor {
352
352
  /**
353
353
  * Set config options for the editor.
354
354
  */
355
- setOptions<K extends keyof IConfig>(options: IConfigOptions<K>[]): void;
355
+ setOptions(options: Partial<IConfig>): void;
356
356
  /**
357
357
  * Returns the content for the given line number.
358
358
  *
@@ -564,12 +564,6 @@ export declare namespace CodeEditor {
564
564
  * The default configuration options for an editor.
565
565
  */
566
566
  const defaultConfig: IConfig;
567
- /**
568
- * The options used to set several options at once with setOptions.
569
- */
570
- interface IConfigOptions<K extends keyof IConfig> {
571
- K: IConfig[K];
572
- }
573
567
  /**
574
568
  * The options used to initialize an editor.
575
569
  */
@@ -601,6 +595,9 @@ export declare namespace CodeEditor {
601
595
  }
602
596
  namespace Model {
603
597
  interface IOptions {
598
+ /**
599
+ * A unique identifier for the model.
600
+ */
604
601
  id?: string;
605
602
  /**
606
603
  * The initial value of the model.
package/lib/editor.js CHANGED
@@ -184,22 +184,22 @@ export var CodeEditor;
184
184
  * The default configuration options for an editor.
185
185
  */
186
186
  CodeEditor.defaultConfig = {
187
+ autoClosingBrackets: false,
188
+ codeFolding: false,
187
189
  cursorBlinkRate: 530,
188
190
  fontFamily: null,
189
191
  fontSize: null,
192
+ handlePaste: true,
193
+ insertSpaces: true,
190
194
  lineHeight: null,
191
195
  lineNumbers: false,
192
196
  lineWrap: 'on',
193
- wordWrapColumn: 80,
197
+ matchBrackets: true,
194
198
  readOnly: false,
195
199
  tabSize: 4,
196
- insertSpaces: true,
197
- matchBrackets: true,
198
- autoClosingBrackets: false,
199
- handlePaste: true,
200
200
  rulers: [],
201
- codeFolding: false,
202
- showTrailingSpace: false
201
+ showTrailingSpace: false,
202
+ wordWrapColumn: 80
203
203
  };
204
204
  })(CodeEditor || (CodeEditor = {}));
205
205
  //# sourceMappingURL=editor.js.map
package/lib/editor.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAI3D,OAAO,EAKL,OAAO,EAER,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,KAAW,UAAU,CAm1B1B;AAn1BD,WAAiB,UAAU;IA+EzB;;OAEG;IACU,gCAAqB,GAAoB;QACpD,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,OAAO;KACf,CAAC;IA2GF;;OAEG;IACH,MAAa,KAAK;QAChB;;WAEG;QACH,YAAY,OAAwB;YA8L5B,gBAAW,GAAG,KAAK,CAAC;YACpB,qBAAgB,GAAG,IAAI,MAAM,CAA6B,IAAI,CAAC,CAAC;YAChE,yBAAoB,GAAG,IAAI,MAAM,CAAgB,IAAI,CAAC,CAAC;YA/L7D,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;YAExB,IAAI,OAAO,CAAC,OAAO,EAAE;gBACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;aAChC;iBAAM;gBACL,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;aAC9B;YACD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,oBAAoB,CAC5C,IAAI,CAAC,IAAI,EACT,OAAO,CAAC,EAAE,CACW,CAAC;YACxB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;YAEnE,MAAM,KAAK,GAAG,IAAI,CA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AQ,CAAC,CAAC;QAC9C,CAAC;QAED;;WAEG;QACH,IAAI,UAAU;YACZ,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED;;WAEG;QACH,OAAO;YACL,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,OAAO;aACR;YACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAEO,yBAAyB,CAC/B,QAA0B,EAC1B,IAAkC;YAElC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBACzB,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI,CAAC,QAAkB;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAkB;aAClC,CAAC,CAAC;QACL,CAAC;KAKF;IArMY,gBAAK,QAqMjB,CAAA;IAuXD;;OAEG;IACU,wBAAa,GAAY;QACpC,mBAAmB,EAAE,KAAK;QAC1B,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,GAAG;QACpB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,EAAE;KACnB,CAAC;AA4DJ,CAAC,EAh1BgB,UAAU,KAAV,UAAU,QAg1B1B"}
package/lib/index.d.ts CHANGED
@@ -3,8 +3,9 @@
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 './widget';
package/lib/index.js CHANGED
@@ -5,9 +5,10 @@
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 './widget';
13
14
  //# 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"}
@@ -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,e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C,KAAK,CAAC;QACpB,CAAC;QAED;;WAEG;QACH,IAAI,MAAM;YACR,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAcO,YAAY;YAClB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QAEO,cAAc,CACpB,QAA0B,EAC1B,QAA0B;YAE1B,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE;gBAC9D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aAChC;QACH,CAAC;KAKF;IAvEY,aAAK,QAuEjB,CAAA;AACH,CAAC,EA5EgB,OAAO,KAAP,OAAO,QA4EvB"}
package/lib/tokens.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { Token } from '@lumino/coreutils';
2
+ import { Widget } from '@lumino/widgets';
3
+ import { CodeEditor } 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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/codeeditor",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.7",
4
4
  "description": "JupyterLab - Abstract Code Editor",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -41,21 +41,23 @@
41
41
  "watch": "tsc -b --watch"
42
42
  },
43
43
  "dependencies": {
44
- "@jupyterlab/coreutils": "^6.0.0-alpha.4",
45
- "@jupyterlab/nbformat": "^4.0.0-alpha.4",
46
- "@jupyterlab/observables": "^5.0.0-alpha.4",
47
- "@jupyterlab/shared-models": "^4.0.0-alpha.4",
48
- "@jupyterlab/translation": "^4.0.0-alpha.4",
49
- "@jupyterlab/ui-components": "^4.0.0-alpha.19",
50
- "@lumino/coreutils": "^1.11.1",
44
+ "@jupyterlab/coreutils": "^6.0.0-alpha.7",
45
+ "@jupyterlab/nbformat": "^4.0.0-alpha.7",
46
+ "@jupyterlab/observables": "^5.0.0-alpha.7",
47
+ "@jupyterlab/shared-models": "^4.0.0-alpha.7",
48
+ "@jupyterlab/statusbar": "^4.0.0-alpha.7",
49
+ "@jupyterlab/translation": "^4.0.0-alpha.7",
50
+ "@jupyterlab/ui-components": "^4.0.0-alpha.22",
51
+ "@lumino/coreutils": "^1.12.0",
51
52
  "@lumino/disposable": "^1.10.1",
52
- "@lumino/dragdrop": "^1.13.1",
53
+ "@lumino/dragdrop": "^1.14.0",
53
54
  "@lumino/messaging": "^1.10.1",
54
55
  "@lumino/signaling": "^1.10.1",
55
- "@lumino/widgets": "^1.30.0"
56
+ "@lumino/widgets": "^1.31.1",
57
+ "react": "^17.0.1"
56
58
  },
57
59
  "devDependencies": {
58
- "@jupyterlab/testutils": "^4.0.0-alpha.4",
60
+ "@jupyterlab/testutils": "^4.0.0-alpha.7",
59
61
  "@types/jest": "^26.0.10",
60
62
  "jest": "^26.4.2",
61
63
  "rimraf": "~3.0.0",
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
+ }