@jupyterlab/codeeditor 0.19.1-alpha.0 → 0.19.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/mimetype.d.ts CHANGED
@@ -1,37 +1,37 @@
1
- import { nbformat } from '@jupyterlab/coreutils';
2
- /**
3
- * The mime type service of a code editor.
4
- */
5
- export interface IEditorMimeTypeService {
6
- /**
7
- * Get a mime type for the given language info.
8
- *
9
- * @param info - The language information.
10
- *
11
- * @returns A valid mimetype.
12
- *
13
- * #### Notes
14
- * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
15
- */
16
- getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;
17
- /**
18
- * Get a mime type for the given file path.
19
- *
20
- * @param filePath - The full path to the file.
21
- *
22
- * @returns A valid mimetype.
23
- *
24
- * #### Notes
25
- * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
26
- */
27
- getMimeTypeByFilePath(filePath: string): string;
28
- }
29
- /**
30
- * A namespace for `IEditorMimeTypeService`.
31
- */
32
- export declare namespace IEditorMimeTypeService {
33
- /**
34
- * The default mime type.
35
- */
36
- const defaultMimeType: string;
37
- }
1
+ import { nbformat } from '@jupyterlab/coreutils';
2
+ /**
3
+ * The mime type service of a code editor.
4
+ */
5
+ export interface IEditorMimeTypeService {
6
+ /**
7
+ * Get a mime type for the given language info.
8
+ *
9
+ * @param info - The language information.
10
+ *
11
+ * @returns A valid mimetype.
12
+ *
13
+ * #### Notes
14
+ * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
15
+ */
16
+ getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;
17
+ /**
18
+ * Get a mime type for the given file path.
19
+ *
20
+ * @param filePath - The full path to the file.
21
+ *
22
+ * @returns A valid mimetype.
23
+ *
24
+ * #### Notes
25
+ * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
26
+ */
27
+ getMimeTypeByFilePath(filePath: string): string;
28
+ }
29
+ /**
30
+ * A namespace for `IEditorMimeTypeService`.
31
+ */
32
+ export declare namespace IEditorMimeTypeService {
33
+ /**
34
+ * The default mime type.
35
+ */
36
+ const defaultMimeType: string;
37
+ }
package/lib/mimetype.js CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";
2
- // Copyright (c) Jupyter Development Team.
3
- // Distributed under the terms of the Modified BSD License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- /**
6
- * A namespace for `IEditorMimeTypeService`.
7
- */
8
- var IEditorMimeTypeService;
9
- (function (IEditorMimeTypeService) {
10
- /**
11
- * The default mime type.
12
- */
13
- IEditorMimeTypeService.defaultMimeType = 'text/plain';
14
- })(IEditorMimeTypeService = exports.IEditorMimeTypeService || (exports.IEditorMimeTypeService = {}));
1
+ "use strict";
2
+ // Copyright (c) Jupyter Development Team.
3
+ // Distributed under the terms of the Modified BSD License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ /**
6
+ * A namespace for `IEditorMimeTypeService`.
7
+ */
8
+ var IEditorMimeTypeService;
9
+ (function (IEditorMimeTypeService) {
10
+ /**
11
+ * The default mime type.
12
+ */
13
+ IEditorMimeTypeService.defaultMimeType = 'text/plain';
14
+ })(IEditorMimeTypeService = exports.IEditorMimeTypeService || (exports.IEditorMimeTypeService = {}));
package/lib/widget.d.ts CHANGED
@@ -1,82 +1,82 @@
1
- import { Message } from '@phosphor/messaging';
2
- import { Widget } from '@phosphor/widgets';
3
- import { CodeEditor } from './';
4
- /**
5
- * A widget which hosts a code editor.
6
- */
7
- export declare class CodeEditorWrapper extends Widget {
8
- /**
9
- * Construct a new code editor widget.
10
- */
11
- constructor(options: CodeEditorWrapper.IOptions);
12
- /**
13
- * Get the editor wrapped by the widget.
14
- */
15
- readonly editor: CodeEditor.IEditor;
16
- /**
17
- * Get the model used by the widget.
18
- */
19
- readonly model: CodeEditor.IModel;
20
- /**
21
- * Dispose of the resources held by the widget.
22
- */
23
- dispose(): void;
24
- /**
25
- * Handle `'activate-request'` messages.
26
- */
27
- protected onActivateRequest(msg: Message): void;
28
- /**
29
- * A message handler invoked on an `'after-attach'` message.
30
- */
31
- protected onAfterAttach(msg: Message): void;
32
- /**
33
- * A message handler invoked on an `'after-show'` message.
34
- */
35
- protected onAfterShow(msg: Message): void;
36
- /**
37
- * A message handler invoked on a `'resize'` message.
38
- */
39
- protected onResize(msg: Widget.ResizeMessage): void;
40
- /**
41
- * A message handler invoked on an `'update-request'` message.
42
- */
43
- protected onUpdateRequest(msg: Message): void;
44
- /**
45
- * Handle a change in model selections.
46
- */
47
- private _onSelectionsChanged;
48
- }
49
- /**
50
- * The namespace for the `CodeEditorWrapper` statics.
51
- */
52
- export declare namespace CodeEditorWrapper {
53
- /**
54
- * The options used to initialize a code editor widget.
55
- */
56
- interface IOptions {
57
- /**
58
- * A code editor factory.
59
- *
60
- * #### Notes
61
- * The widget needs a factory and a model instead of a `CodeEditor.IEditor`
62
- * object because it needs to provide its own node as the host.
63
- */
64
- factory: CodeEditor.Factory;
65
- /**
66
- * The model used to initialize the code editor.
67
- */
68
- model: CodeEditor.IModel;
69
- /**
70
- * The desired uuid for the editor.
71
- */
72
- uuid?: string;
73
- /**
74
- * The configuration options for the editor.
75
- */
76
- config?: Partial<CodeEditor.IConfig>;
77
- /**
78
- * The default selection style for the editor.
79
- */
80
- selectionStyle?: CodeEditor.ISelectionStyle;
81
- }
82
- }
1
+ import { Message } from '@phosphor/messaging';
2
+ import { Widget } from '@phosphor/widgets';
3
+ import { CodeEditor } from './';
4
+ /**
5
+ * A widget which hosts a code editor.
6
+ */
7
+ export declare class CodeEditorWrapper extends Widget {
8
+ /**
9
+ * Construct a new code editor widget.
10
+ */
11
+ constructor(options: CodeEditorWrapper.IOptions);
12
+ /**
13
+ * Get the editor wrapped by the widget.
14
+ */
15
+ readonly editor: CodeEditor.IEditor;
16
+ /**
17
+ * Get the model used by the widget.
18
+ */
19
+ readonly model: CodeEditor.IModel;
20
+ /**
21
+ * Dispose of the resources held by the widget.
22
+ */
23
+ dispose(): void;
24
+ /**
25
+ * Handle `'activate-request'` messages.
26
+ */
27
+ protected onActivateRequest(msg: Message): void;
28
+ /**
29
+ * A message handler invoked on an `'after-attach'` message.
30
+ */
31
+ protected onAfterAttach(msg: Message): void;
32
+ /**
33
+ * A message handler invoked on an `'after-show'` message.
34
+ */
35
+ protected onAfterShow(msg: Message): void;
36
+ /**
37
+ * A message handler invoked on a `'resize'` message.
38
+ */
39
+ protected onResize(msg: Widget.ResizeMessage): void;
40
+ /**
41
+ * A message handler invoked on an `'update-request'` message.
42
+ */
43
+ protected onUpdateRequest(msg: Message): void;
44
+ /**
45
+ * Handle a change in model selections.
46
+ */
47
+ private _onSelectionsChanged;
48
+ }
49
+ /**
50
+ * The namespace for the `CodeEditorWrapper` statics.
51
+ */
52
+ export declare namespace CodeEditorWrapper {
53
+ /**
54
+ * The options used to initialize a code editor widget.
55
+ */
56
+ interface IOptions {
57
+ /**
58
+ * A code editor factory.
59
+ *
60
+ * #### Notes
61
+ * The widget needs a factory and a model instead of a `CodeEditor.IEditor`
62
+ * object because it needs to provide its own node as the host.
63
+ */
64
+ factory: CodeEditor.Factory;
65
+ /**
66
+ * The model used to initialize the code editor.
67
+ */
68
+ model: CodeEditor.IModel;
69
+ /**
70
+ * The desired uuid for the editor.
71
+ */
72
+ uuid?: string;
73
+ /**
74
+ * The configuration options for the editor.
75
+ */
76
+ config?: Partial<CodeEditor.IConfig>;
77
+ /**
78
+ * The default selection style for the editor.
79
+ */
80
+ selectionStyle?: CodeEditor.ISelectionStyle;
81
+ }
82
+ }
package/lib/widget.js CHANGED
@@ -1,116 +1,116 @@
1
- "use strict";
2
- // Copyright (c) Jupyter Development Team.
3
- // Distributed under the terms of the Modified BSD License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const widgets_1 = require("@phosphor/widgets");
6
- /**
7
- * The class name added to an editor widget that has a primary selection.
8
- */
9
- const HAS_SELECTION_CLASS = 'jp-mod-has-primary-selection';
10
- /**
11
- * The class name added to an editor widget that has a cursor/selection
12
- * within the whitespace at the beginning of a line
13
- */
14
- const HAS_IN_LEADING_WHITESPACE_CLASS = 'jp-mod-in-leading-whitespace';
15
- /**
16
- * RegExp to test for leading whitespace
17
- */
18
- const leadingWhitespaceRe = /^\s+$/;
19
- /**
20
- * A widget which hosts a code editor.
21
- */
22
- class CodeEditorWrapper extends widgets_1.Widget {
23
- /**
24
- * Construct a new code editor widget.
25
- */
26
- constructor(options) {
27
- super();
28
- const editor = (this.editor = options.factory({
29
- host: this.node,
30
- model: options.model,
31
- uuid: options.uuid,
32
- config: options.config,
33
- selectionStyle: options.selectionStyle
34
- }));
35
- editor.model.selections.changed.connect(this._onSelectionsChanged, this);
36
- }
37
- /**
38
- * Get the model used by the widget.
39
- */
40
- get model() {
41
- return this.editor.model;
42
- }
43
- /**
44
- * Dispose of the resources held by the widget.
45
- */
46
- dispose() {
47
- if (this.isDisposed) {
48
- return;
49
- }
50
- super.dispose();
51
- this.editor.dispose();
52
- }
53
- /**
54
- * Handle `'activate-request'` messages.
55
- */
56
- onActivateRequest(msg) {
57
- this.editor.focus();
58
- }
59
- /**
60
- * A message handler invoked on an `'after-attach'` message.
61
- */
62
- onAfterAttach(msg) {
63
- super.onAfterAttach(msg);
64
- if (this.isVisible) {
65
- this.update();
66
- }
67
- }
68
- /**
69
- * A message handler invoked on an `'after-show'` message.
70
- */
71
- onAfterShow(msg) {
72
- this.update();
73
- }
74
- /**
75
- * A message handler invoked on a `'resize'` message.
76
- */
77
- onResize(msg) {
78
- if (msg.width >= 0 && msg.height >= 0) {
79
- this.editor.setSize(msg);
80
- }
81
- else if (this.isVisible) {
82
- this.editor.resizeToFit();
83
- }
84
- }
85
- /**
86
- * A message handler invoked on an `'update-request'` message.
87
- */
88
- onUpdateRequest(msg) {
89
- this.editor.refresh();
90
- }
91
- /**
92
- * Handle a change in model selections.
93
- */
94
- _onSelectionsChanged() {
95
- const { start, end } = this.editor.getSelection();
96
- if (start.column !== end.column || start.line !== end.line) {
97
- // a selection was made
98
- this.addClass(HAS_SELECTION_CLASS);
99
- this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);
100
- }
101
- else {
102
- // the cursor was placed
103
- this.removeClass(HAS_SELECTION_CLASS);
104
- if (this.editor
105
- .getLine(end.line)
106
- .slice(0, end.column)
107
- .match(leadingWhitespaceRe)) {
108
- this.addClass(HAS_IN_LEADING_WHITESPACE_CLASS);
109
- }
110
- else {
111
- this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);
112
- }
113
- }
114
- }
115
- }
116
- exports.CodeEditorWrapper = CodeEditorWrapper;
1
+ "use strict";
2
+ // Copyright (c) Jupyter Development Team.
3
+ // Distributed under the terms of the Modified BSD License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const widgets_1 = require("@phosphor/widgets");
6
+ /**
7
+ * The class name added to an editor widget that has a primary selection.
8
+ */
9
+ const HAS_SELECTION_CLASS = 'jp-mod-has-primary-selection';
10
+ /**
11
+ * The class name added to an editor widget that has a cursor/selection
12
+ * within the whitespace at the beginning of a line
13
+ */
14
+ const HAS_IN_LEADING_WHITESPACE_CLASS = 'jp-mod-in-leading-whitespace';
15
+ /**
16
+ * RegExp to test for leading whitespace
17
+ */
18
+ const leadingWhitespaceRe = /^\s+$/;
19
+ /**
20
+ * A widget which hosts a code editor.
21
+ */
22
+ class CodeEditorWrapper extends widgets_1.Widget {
23
+ /**
24
+ * Construct a new code editor widget.
25
+ */
26
+ constructor(options) {
27
+ super();
28
+ const editor = (this.editor = options.factory({
29
+ host: this.node,
30
+ model: options.model,
31
+ uuid: options.uuid,
32
+ config: options.config,
33
+ selectionStyle: options.selectionStyle
34
+ }));
35
+ editor.model.selections.changed.connect(this._onSelectionsChanged, this);
36
+ }
37
+ /**
38
+ * Get the model used by the widget.
39
+ */
40
+ get model() {
41
+ return this.editor.model;
42
+ }
43
+ /**
44
+ * Dispose of the resources held by the widget.
45
+ */
46
+ dispose() {
47
+ if (this.isDisposed) {
48
+ return;
49
+ }
50
+ super.dispose();
51
+ this.editor.dispose();
52
+ }
53
+ /**
54
+ * Handle `'activate-request'` messages.
55
+ */
56
+ onActivateRequest(msg) {
57
+ this.editor.focus();
58
+ }
59
+ /**
60
+ * A message handler invoked on an `'after-attach'` message.
61
+ */
62
+ onAfterAttach(msg) {
63
+ super.onAfterAttach(msg);
64
+ if (this.isVisible) {
65
+ this.update();
66
+ }
67
+ }
68
+ /**
69
+ * A message handler invoked on an `'after-show'` message.
70
+ */
71
+ onAfterShow(msg) {
72
+ this.update();
73
+ }
74
+ /**
75
+ * A message handler invoked on a `'resize'` message.
76
+ */
77
+ onResize(msg) {
78
+ if (msg.width >= 0 && msg.height >= 0) {
79
+ this.editor.setSize(msg);
80
+ }
81
+ else if (this.isVisible) {
82
+ this.editor.resizeToFit();
83
+ }
84
+ }
85
+ /**
86
+ * A message handler invoked on an `'update-request'` message.
87
+ */
88
+ onUpdateRequest(msg) {
89
+ this.editor.refresh();
90
+ }
91
+ /**
92
+ * Handle a change in model selections.
93
+ */
94
+ _onSelectionsChanged() {
95
+ const { start, end } = this.editor.getSelection();
96
+ if (start.column !== end.column || start.line !== end.line) {
97
+ // a selection was made
98
+ this.addClass(HAS_SELECTION_CLASS);
99
+ this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);
100
+ }
101
+ else {
102
+ // the cursor was placed
103
+ this.removeClass(HAS_SELECTION_CLASS);
104
+ if (this.editor
105
+ .getLine(end.line)
106
+ .slice(0, end.column)
107
+ .match(leadingWhitespaceRe)) {
108
+ this.addClass(HAS_IN_LEADING_WHITESPACE_CLASS);
109
+ }
110
+ else {
111
+ this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);
112
+ }
113
+ }
114
+ }
115
+ }
116
+ exports.CodeEditorWrapper = CodeEditorWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/codeeditor",
3
- "version": "0.19.1-alpha.0",
3
+ "version": "0.19.1",
4
4
  "description": "JupyterLab - Abstract Code Editor",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -24,15 +24,15 @@
24
24
  "url": "https://github.com/jupyterlab/jupyterlab.git"
25
25
  },
26
26
  "scripts": {
27
- "build": "tsc -b src",
27
+ "build": "tsc -b",
28
28
  "clean": "rimraf lib",
29
29
  "docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
30
30
  "prepublishOnly": "npm run build",
31
- "watch": "tsc -b src --watch"
31
+ "watch": "tsc -b --watch"
32
32
  },
33
33
  "dependencies": {
34
- "@jupyterlab/coreutils": "^2.2.1-alpha.0",
35
- "@jupyterlab/observables": "^2.1.1-alpha.0",
34
+ "@jupyterlab/coreutils": "^2.2.1",
35
+ "@jupyterlab/observables": "^2.1.1",
36
36
  "@phosphor/coreutils": "^1.3.0",
37
37
  "@phosphor/disposable": "^1.1.2",
38
38
  "@phosphor/messaging": "^1.2.2",
@@ -46,5 +46,8 @@
46
46
  "typedoc": "~0.12.0",
47
47
  "typescript": "~3.1.1"
48
48
  },
49
- "gitHead": "9d6193d318872a4a3600ee96fe6f3996312ffe07"
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "gitHead": "7fc900168981e58051253ecc66a18015a052cd2f"
50
53
  }