@jupyterlab/codemirror 4.0.0-alpha.19 → 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.
- package/lib/codemirror-ipythongfm.d.ts +0 -1
- package/lib/codemirror-ipythongfm.js +0 -8
- package/lib/codemirror-ipythongfm.js.map +1 -1
- package/lib/commands.d.ts +13 -0
- package/lib/commands.js +32 -0
- package/lib/commands.js.map +1 -0
- package/lib/editor.d.ts +29 -68
- package/lib/editor.js +66 -212
- package/lib/editor.js.map +1 -1
- package/lib/extension.d.ts +236 -0
- package/lib/extension.js +687 -0
- package/lib/extension.js.map +1 -0
- package/lib/extensions/customStyle.d.ts +25 -0
- package/lib/extensions/customStyle.js +51 -0
- package/lib/extensions/customStyle.js.map +1 -0
- package/lib/extensions/index.d.ts +3 -0
- package/lib/extensions/index.js +8 -0
- package/lib/extensions/index.js.map +1 -0
- package/lib/extensions/rulers.d.ts +8 -0
- package/lib/extensions/rulers.js +85 -0
- package/lib/extensions/rulers.js.map +1 -0
- package/lib/extensions/ybinding.d.ts +125 -0
- package/lib/extensions/ybinding.js +213 -0
- package/lib/extensions/ybinding.js.map +1 -0
- package/lib/factory.d.ts +15 -5
- package/lib/factory.js +45 -37
- package/lib/factory.js.map +1 -1
- package/lib/index.d.ts +7 -20
- package/lib/index.js +7 -24
- package/lib/index.js.map +1 -1
- package/lib/language.d.ts +96 -0
- package/lib/language.js +1690 -0
- package/lib/language.js.map +1 -0
- package/lib/mimetype.d.ts +3 -0
- package/lib/mimetype.js +9 -4
- package/lib/mimetype.js.map +1 -1
- package/lib/searchprovider.d.ts +90 -80
- package/lib/searchprovider.js +221 -352
- package/lib/searchprovider.js.map +1 -1
- package/lib/theme.d.ts +57 -0
- package/lib/{editortheme.js → theme.js} +57 -30
- package/lib/theme.js.map +1 -0
- package/lib/token.d.ts +375 -0
- package/lib/token.js +18 -0
- package/lib/token.js.map +1 -0
- package/package.json +28 -36
- package/src/codemirror-ipythongfm.ts +109 -0
- package/src/commands.ts +34 -0
- package/src/editor.ts +783 -0
- package/src/extension.ts +878 -0
- package/src/extensions/customStyle.ts +79 -0
- package/src/extensions/index.ts +8 -0
- package/src/extensions/rulers.ts +112 -0
- package/src/extensions/ybinding.ts +267 -0
- package/src/factory.ts +100 -0
- package/src/index.ts +17 -0
- package/src/language.ts +1729 -0
- package/src/mimetype.ts +54 -0
- package/src/searchprovider.ts +700 -0
- package/src/theme.ts +219 -0
- package/src/token.ts +436 -0
- package/src/typings.d.ts +13 -0
- package/style/index.css +0 -3
- package/style/index.js +0 -3
- package/lib/codemirror-ipython.d.ts +0 -1
- package/lib/codemirror-ipython.js +0 -12
- package/lib/codemirror-ipython.js.map +0 -1
- package/lib/editorconfiguration.d.ts +0 -149
- package/lib/editorconfiguration.js +0 -289
- package/lib/editorconfiguration.js.map +0 -1
- package/lib/editortheme.d.ts +0 -41
- package/lib/editortheme.js.map +0 -1
- package/lib/mode.d.ts +0 -88
- package/lib/mode.js +0 -1518
- package/lib/mode.js.map +0 -1
- package/lib/syntaxstatus.d.ts +0 -67
- package/lib/syntaxstatus.js +0 -146
- package/lib/syntaxstatus.js.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { CodeEditor } from '@jupyterlab/codeeditor';
|
|
2
|
-
import { Extension } from '@codemirror/state';
|
|
3
|
-
import { EditorView, KeyBinding } from '@codemirror/view';
|
|
4
|
-
export declare namespace Configuration {
|
|
5
|
-
/**
|
|
6
|
-
* The configuration options for a codemirror editor.
|
|
7
|
-
*/
|
|
8
|
-
interface IConfig extends CodeEditor.IConfig {
|
|
9
|
-
/**
|
|
10
|
-
* The mode to use.
|
|
11
|
-
*/
|
|
12
|
-
mode?: string;
|
|
13
|
-
/**
|
|
14
|
-
* The theme to style the editor with. see editortheme.ts for an example
|
|
15
|
-
* of how to design a theme for CodeMirror 6.
|
|
16
|
-
*/
|
|
17
|
-
theme?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to use the context-sensitive indentation that the mode provides
|
|
20
|
-
* (or just indent the same as the line before).
|
|
21
|
-
*/
|
|
22
|
-
smartIndent?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Configures whether the editor should re-indent the current line when a
|
|
25
|
-
* character is typed that might change its proper indentation
|
|
26
|
-
* (only works if the mode supports indentation).
|
|
27
|
-
*/
|
|
28
|
-
electricChars?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Configures the keymap to use. The default is "default", which is the
|
|
31
|
-
* only keymap defined in codemirror.js itself.
|
|
32
|
-
* Extra keymaps are found in the CodeMirror keymap directory.
|
|
33
|
-
*/
|
|
34
|
-
keyMap?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Can be used to specify extra keybindings for the editor, alongside the
|
|
37
|
-
* ones defined by keyMap. Should be either null, or a valid keymap value.
|
|
38
|
-
*/
|
|
39
|
-
extraKeys?: KeyBinding[] | null;
|
|
40
|
-
/**
|
|
41
|
-
* Can be used to add extra gutters (beyond or instead of the line number
|
|
42
|
-
* gutter).
|
|
43
|
-
* Should be an array of CSS class names, each of which defines a width
|
|
44
|
-
* (and optionally a background),
|
|
45
|
-
* and which will be used to draw the background of the gutters.
|
|
46
|
-
* May include the CodeMirror-linenumbers class, in order to explicitly
|
|
47
|
-
* set the position of the line number gutter
|
|
48
|
-
* (it will default to be to the right of all other gutters).
|
|
49
|
-
* These class names are the keys passed to setGutterMarker.
|
|
50
|
-
*/
|
|
51
|
-
gutters?: string[];
|
|
52
|
-
/**
|
|
53
|
-
* Determines whether the gutter scrolls along with the content
|
|
54
|
-
* horizontally (false)
|
|
55
|
-
* or whether it stays fixed during horizontal scrolling (true,
|
|
56
|
-
* the default).
|
|
57
|
-
*/
|
|
58
|
-
fixedGutter?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the cursor should be drawn when a selection is active.
|
|
61
|
-
*/
|
|
62
|
-
showCursorWhenSelecting?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* When fixedGutter is on, and there is a horizontal scrollbar, by default
|
|
65
|
-
* the gutter will be visible to the left of this scrollbar. If this
|
|
66
|
-
* option is set to true, it will be covered by an element with class
|
|
67
|
-
* CodeMirror-gutter-filler.
|
|
68
|
-
*/
|
|
69
|
-
coverGutterNextToScrollbar?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Controls whether drag-and-drop is enabled.
|
|
72
|
-
*/
|
|
73
|
-
dragDrop?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Explicitly set the line separator for the editor.
|
|
76
|
-
* By default (value null), the document will be split on CRLFs as well as
|
|
77
|
-
* lone CRs and LFs, and a single LF will be used as line separator in all
|
|
78
|
-
* output (such as getValue). When a specific string is given, lines will
|
|
79
|
-
* only be split on that string, and output will, by default, use that
|
|
80
|
-
* same separator.
|
|
81
|
-
*/
|
|
82
|
-
lineSeparator?: string | null;
|
|
83
|
-
/**
|
|
84
|
-
* Chooses a scrollbar implementation. The default is "native", showing
|
|
85
|
-
* native scrollbars. The core library also provides the "null" style,
|
|
86
|
-
* which completely hides the scrollbars. Addons can implement additional
|
|
87
|
-
* scrollbar models.
|
|
88
|
-
*/
|
|
89
|
-
scrollbarStyle?: string;
|
|
90
|
-
/**
|
|
91
|
-
* When enabled, which is the default, doing copy or cut when there is no
|
|
92
|
-
* selection will copy or cut the whole lines that have cursors on them.
|
|
93
|
-
*/
|
|
94
|
-
lineWiseCopyCut?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Whether to scroll past the end of the buffer.
|
|
97
|
-
*/
|
|
98
|
-
scrollPastEnd?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Whether to give the wrapper of the line that contains the cursor the class
|
|
101
|
-
* cm-activeLine.
|
|
102
|
-
*/
|
|
103
|
-
styleActiveLine: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Whether to causes the selected text to be marked with the CSS class
|
|
106
|
-
* CodeMirror-selectedtext. Useful to change the colour of the selection
|
|
107
|
-
* (in addition to the background).
|
|
108
|
-
*/
|
|
109
|
-
styleSelectedText: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Defines the mouse cursor appearance when hovering over the selection.
|
|
112
|
-
* It can be set to a string, like "pointer", or to true,
|
|
113
|
-
* in which case the "default" (arrow) cursor will be used.
|
|
114
|
-
*/
|
|
115
|
-
selectionPointer: boolean | string;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Editor configuration: provides APIs to get and reconfigure CodeMirror 6
|
|
119
|
-
* extensions from option names. Also allows to register new themes and
|
|
120
|
-
* inject ne extensions in already configured editor instances.
|
|
121
|
-
*/
|
|
122
|
-
class EditorConfiguration {
|
|
123
|
-
constructor();
|
|
124
|
-
/**
|
|
125
|
-
* Reconfigures the extension mapped with key with the provided value.
|
|
126
|
-
*/
|
|
127
|
-
reconfigureExtension<T>(view: EditorView, key: string, value: T): void;
|
|
128
|
-
/**
|
|
129
|
-
* Reconfigures all the extensions mapped with the options from the
|
|
130
|
-
* provided partial configuration.
|
|
131
|
-
*/
|
|
132
|
-
reconfigureExtensions(view: EditorView, config: Partial<IConfig>): void;
|
|
133
|
-
/**
|
|
134
|
-
* Appends extensions to the top-level configuration of the
|
|
135
|
-
* editor.
|
|
136
|
-
*/
|
|
137
|
-
injectExtension(view: EditorView, ext: Extension): void;
|
|
138
|
-
/**
|
|
139
|
-
* Returns the list of initial extensions of an editor
|
|
140
|
-
* based on the provided configuration.
|
|
141
|
-
*/
|
|
142
|
-
getInitialExtensions(config: IConfig): Extension[];
|
|
143
|
-
private updateThemeOverload;
|
|
144
|
-
private get;
|
|
145
|
-
private _configurableBuilderMap;
|
|
146
|
-
private _themeOverloaderSpec;
|
|
147
|
-
private _themeOverloader;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { closeBrackets } from '@codemirror/autocomplete';
|
|
4
|
-
import { defaultKeymap } from '@codemirror/commands';
|
|
5
|
-
import { bracketMatching, foldGutter, indentOnInput, indentUnit } from '@codemirror/language';
|
|
6
|
-
import { Compartment, EditorState, StateEffect } from '@codemirror/state';
|
|
7
|
-
import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view';
|
|
8
|
-
import { Mode } from './mode';
|
|
9
|
-
import { Theme } from './editortheme';
|
|
10
|
-
export var Configuration;
|
|
11
|
-
(function (Configuration) {
|
|
12
|
-
/**
|
|
13
|
-
* Builder for extensions from value of type T
|
|
14
|
-
*/
|
|
15
|
-
class ExtensionBuilder {
|
|
16
|
-
get extensionBuilder() {
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Extension builder that simply forwards a value as an extension.
|
|
22
|
-
*/
|
|
23
|
-
class ExtensionForwarder extends ExtensionBuilder {
|
|
24
|
-
constructor() {
|
|
25
|
-
super();
|
|
26
|
-
}
|
|
27
|
-
of(value) {
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Extension builder that builds an extension from a facet.
|
|
33
|
-
*/
|
|
34
|
-
class FacetWrapper extends ExtensionBuilder {
|
|
35
|
-
constructor(facet) {
|
|
36
|
-
super();
|
|
37
|
-
this._facet = facet;
|
|
38
|
-
}
|
|
39
|
-
of(value) {
|
|
40
|
-
return this._facet.of(value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extension builder that provides an extension depending
|
|
45
|
-
* on a boolean value.
|
|
46
|
-
*/
|
|
47
|
-
class ConditionalExtension extends ExtensionBuilder {
|
|
48
|
-
constructor(truthy, falsy = []) {
|
|
49
|
-
super();
|
|
50
|
-
this._truthy = truthy;
|
|
51
|
-
this._falsy = falsy;
|
|
52
|
-
}
|
|
53
|
-
of(value) {
|
|
54
|
-
return value ? this._truthy : this._falsy;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Extension builds that provides an extension depending on
|
|
59
|
-
* conditional function operating on a value.
|
|
60
|
-
*/
|
|
61
|
-
class GenConditionalExtension extends ExtensionBuilder {
|
|
62
|
-
constructor(fn, truthy, falsy = []) {
|
|
63
|
-
super();
|
|
64
|
-
this._fn = fn;
|
|
65
|
-
this._builder = new ConditionalExtension(truthy, falsy);
|
|
66
|
-
}
|
|
67
|
-
of(value) {
|
|
68
|
-
return this._builder.of(this._fn(value));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* IConfigurableBuilder implementation *
|
|
73
|
-
*/
|
|
74
|
-
class ConfigurableBuilder {
|
|
75
|
-
constructor(builder) {
|
|
76
|
-
this._compartment = new Compartment();
|
|
77
|
-
this._builder = builder;
|
|
78
|
-
}
|
|
79
|
-
of(value) {
|
|
80
|
-
return this._compartment.of(this._builder.of(value));
|
|
81
|
-
}
|
|
82
|
-
reconfigure(value) {
|
|
83
|
-
return this._compartment.reconfigure(this._builder.of(value));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/*
|
|
87
|
-
* Specific builder for themes. Provide a default theme and
|
|
88
|
-
* allows to register new themes.
|
|
89
|
-
*/
|
|
90
|
-
class ThemeBuilder {
|
|
91
|
-
constructor() {
|
|
92
|
-
this._compartment = new Compartment();
|
|
93
|
-
}
|
|
94
|
-
of(value) {
|
|
95
|
-
const v = value;
|
|
96
|
-
return this._compartment.of(Theme.getTheme(v));
|
|
97
|
-
}
|
|
98
|
-
reconfigure(value) {
|
|
99
|
-
const v = value;
|
|
100
|
-
return this._compartment.reconfigure(Theme.getTheme(v));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Creates a ConfigurableBuilder based on an ExtensionForwarder.
|
|
105
|
-
*/
|
|
106
|
-
function createForwarderBuilder() {
|
|
107
|
-
return new ConfigurableBuilder(new ExtensionForwarder());
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Creates a ConfigurableBuilder based on a Facet.
|
|
111
|
-
*/
|
|
112
|
-
function createConfigurableBuilder(facet) {
|
|
113
|
-
return new ConfigurableBuilder(new FacetWrapper(facet));
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Creates a ConditionalBuilder from two extensions.
|
|
117
|
-
*/
|
|
118
|
-
function createConditionalBuilder(truthy, falsy = []) {
|
|
119
|
-
return new ConfigurableBuilder(new ConditionalExtension(truthy, falsy));
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Creates a ConditionalBuilder based on two extensions and a
|
|
123
|
-
* conditional function.
|
|
124
|
-
*/
|
|
125
|
-
function createGenConditionalBuilder(fn, truthy, falsy = []) {
|
|
126
|
-
return new ConfigurableBuilder(new GenConditionalExtension(fn, truthy, falsy));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Creates a theme builder.
|
|
130
|
-
*/
|
|
131
|
-
function createThemeBuilder() {
|
|
132
|
-
return new ThemeBuilder();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Editor configuration: provides APIs to get and reconfigure CodeMirror 6
|
|
136
|
-
* extensions from option names. Also allows to register new themes and
|
|
137
|
-
* inject ne extensions in already configured editor instances.
|
|
138
|
-
*/
|
|
139
|
-
class EditorConfiguration {
|
|
140
|
-
constructor() {
|
|
141
|
-
// Order does not matter
|
|
142
|
-
this._configurableBuilderMap = new Map([
|
|
143
|
-
['tabSize', createConfigurableBuilder(EditorState.tabSize)],
|
|
144
|
-
['readOnly', createConfigurableBuilder(EditorState.readOnly)],
|
|
145
|
-
['keymap', createConfigurableBuilder(keymap)],
|
|
146
|
-
['indentUnit', createConfigurableBuilder(indentUnit)],
|
|
147
|
-
['smartIndent', createConditionalBuilder(indentOnInput())],
|
|
148
|
-
['autoClosingBrackets', createConditionalBuilder(closeBrackets())],
|
|
149
|
-
['matchBrackets', createConditionalBuilder(bracketMatching())],
|
|
150
|
-
['codeFolding', createConditionalBuilder(foldGutter())],
|
|
151
|
-
['styleActiveLine', createConditionalBuilder(highlightActiveLine())],
|
|
152
|
-
['lineNumbers', createConditionalBuilder(lineNumbers())],
|
|
153
|
-
[
|
|
154
|
-
'lineWrap',
|
|
155
|
-
createGenConditionalBuilder((a) => a !== 'off', EditorView.lineWrapping)
|
|
156
|
-
],
|
|
157
|
-
['language', createForwarderBuilder()],
|
|
158
|
-
['theme', createThemeBuilder()]
|
|
159
|
-
]);
|
|
160
|
-
this._themeOverloaderSpec = { '&': {}, '.cm-line': {} };
|
|
161
|
-
this._themeOverloader = new Compartment();
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Reconfigures the extension mapped with key with the provided value.
|
|
165
|
-
*/
|
|
166
|
-
reconfigureExtension(view, key, value) {
|
|
167
|
-
const builder = this.get(key);
|
|
168
|
-
if (builder) {
|
|
169
|
-
view.dispatch({
|
|
170
|
-
effects: builder.reconfigure(value)
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
const config = {};
|
|
175
|
-
config[key] = value;
|
|
176
|
-
const themeOverload = this.updateThemeOverload(config);
|
|
177
|
-
view.dispatch({
|
|
178
|
-
effects: this._themeOverloader.reconfigure(themeOverload)
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Reconfigures all the extensions mapped with the options from the
|
|
184
|
-
* provided partial configuration.
|
|
185
|
-
*/
|
|
186
|
-
reconfigureExtensions(view, config) {
|
|
187
|
-
const eff = [];
|
|
188
|
-
for (const [key, value] of Object.entries(config)) {
|
|
189
|
-
const builder = this.get(key);
|
|
190
|
-
if (builder) {
|
|
191
|
-
eff.push(builder.reconfigure(value));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const themeOverload = this.updateThemeOverload(config);
|
|
195
|
-
eff.push(this._themeOverloader.reconfigure(themeOverload));
|
|
196
|
-
view.dispatch({
|
|
197
|
-
effects: eff
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Appends extensions to the top-level configuration of the
|
|
202
|
-
* editor.
|
|
203
|
-
*/
|
|
204
|
-
injectExtension(view, ext) {
|
|
205
|
-
view.dispatch({
|
|
206
|
-
effects: StateEffect.appendConfig.of(ext)
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Returns the list of initial extensions of an editor
|
|
211
|
-
* based on the provided configuration.
|
|
212
|
-
*/
|
|
213
|
-
getInitialExtensions(config) {
|
|
214
|
-
const keys = Object.keys(config).filter(v => v !== 'insertSpaces' && v !== 'extraKeys');
|
|
215
|
-
const extensions = [];
|
|
216
|
-
for (const k of keys) {
|
|
217
|
-
const builder = this.get(k);
|
|
218
|
-
if (builder) {
|
|
219
|
-
const value = config[k];
|
|
220
|
-
extensions.push(builder.of(value));
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
if (!config.theme) {
|
|
224
|
-
extensions.push(Theme.defaultTheme());
|
|
225
|
-
}
|
|
226
|
-
const builder = this.get('keymap');
|
|
227
|
-
const keymapExt = builder.of(config.extraKeys
|
|
228
|
-
? [...defaultKeymap, ...config.extraKeys]
|
|
229
|
-
: [...defaultKeymap]);
|
|
230
|
-
const indentBuilder = this.get('indentUnit');
|
|
231
|
-
const insertExt = indentBuilder.of(config.insertSpaces ? ' '.repeat(config.tabSize) : '\t');
|
|
232
|
-
let themeOverload = this.updateThemeOverload(config);
|
|
233
|
-
extensions.push(this._themeOverloader.of(themeOverload), insertExt, keymapExt);
|
|
234
|
-
Mode.ensure('text/x-python')
|
|
235
|
-
.then(spec => {
|
|
236
|
-
if (spec) {
|
|
237
|
-
extensions.push(this.get('language').of(spec.support));
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
.catch(error => {
|
|
241
|
-
console.error('Could not load language parser:');
|
|
242
|
-
console.error(error);
|
|
243
|
-
});
|
|
244
|
-
return extensions;
|
|
245
|
-
}
|
|
246
|
-
updateThemeOverload(config) {
|
|
247
|
-
const { fontFamily, fontSize, lineHeight, lineWrap, wordWrapColumn } = config;
|
|
248
|
-
let needUpdate = false;
|
|
249
|
-
const parentStyle = {};
|
|
250
|
-
if (fontSize) {
|
|
251
|
-
parentStyle.fontSize = fontSize + 'px';
|
|
252
|
-
needUpdate = true;
|
|
253
|
-
}
|
|
254
|
-
if (fontFamily) {
|
|
255
|
-
parentStyle.fontFamily = fontFamily;
|
|
256
|
-
needUpdate = true;
|
|
257
|
-
}
|
|
258
|
-
if (lineHeight) {
|
|
259
|
-
parentStyle.lineHeight = lineHeight.toString();
|
|
260
|
-
needUpdate = true;
|
|
261
|
-
}
|
|
262
|
-
const lineStyle = {};
|
|
263
|
-
if (lineWrap === 'wordWrapColumn') {
|
|
264
|
-
lineStyle.width = wordWrapColumn + 'ch';
|
|
265
|
-
needUpdate = true;
|
|
266
|
-
}
|
|
267
|
-
else if (lineWrap === 'bounded') {
|
|
268
|
-
lineStyle.maxWidth = wordWrapColumn + 'ch';
|
|
269
|
-
needUpdate = true;
|
|
270
|
-
}
|
|
271
|
-
if (needUpdate) {
|
|
272
|
-
const newThemeSpec = {
|
|
273
|
-
'&': parentStyle,
|
|
274
|
-
'.cm-line': lineStyle
|
|
275
|
-
};
|
|
276
|
-
this._themeOverloaderSpec = {
|
|
277
|
-
...this._themeOverloaderSpec,
|
|
278
|
-
...newThemeSpec
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return EditorView.theme(this._themeOverloaderSpec);
|
|
282
|
-
}
|
|
283
|
-
get(key) {
|
|
284
|
-
return this._configurableBuilderMap.get(key);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
Configuration.EditorConfiguration = EditorConfiguration;
|
|
288
|
-
})(Configuration || (Configuration = {}));
|
|
289
|
-
//# sourceMappingURL=editorconfiguration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editorconfiguration.js","sourceRoot":"","sources":["../src/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AC;gBACF,IAAI,CAAC,oBAAoB,GAAG;oBAC1B,GAAG,IAAI,CAAC,oBAAoB;oBAC5B,GAAG,YAAY;iBAChB,CAAC;aACH;YAED,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACrD,CAAC;QAEO,GAAG,CAAC,GAAW;YACrB,OAAO,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC;KAKF;IAvLY,iCAAmB,sBAuL/B,CAAA;AACH,CAAC,EApgBgB,aAAa,KAAb,aAAa,QAogB7B"}
|
package/lib/editortheme.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { HighlightStyle } from '@codemirror/language';
|
|
2
|
-
import { Extension } from '@codemirror/state';
|
|
3
|
-
export declare const jupyterEditorTheme: Extension;
|
|
4
|
-
export declare const jupyterHighlightStyle: HighlightStyle;
|
|
5
|
-
/**
|
|
6
|
-
* JupyterLab CodeMirror 6 theme
|
|
7
|
-
*/
|
|
8
|
-
export declare const jupyterTheme: Extension;
|
|
9
|
-
/**
|
|
10
|
-
* A namespace to handle CodeMirror 6 theme
|
|
11
|
-
*
|
|
12
|
-
* @alpha
|
|
13
|
-
*/
|
|
14
|
-
export declare namespace Theme {
|
|
15
|
-
/**
|
|
16
|
-
* Get the default CodeMirror 6 theme for JupyterLab
|
|
17
|
-
*
|
|
18
|
-
* @alpha
|
|
19
|
-
* @returns Default theme
|
|
20
|
-
*/
|
|
21
|
-
function defaultTheme(): Extension;
|
|
22
|
-
/**
|
|
23
|
-
* Register a new theme.
|
|
24
|
-
*
|
|
25
|
-
* @alpha
|
|
26
|
-
* @param name Theme name
|
|
27
|
-
* @param theme Codemirror 6 theme extension
|
|
28
|
-
*/
|
|
29
|
-
function registerTheme(name: string, theme: Extension): void;
|
|
30
|
-
/**
|
|
31
|
-
* Get a theme.
|
|
32
|
-
*
|
|
33
|
-
* #### Notes
|
|
34
|
-
* It falls back to the default theme
|
|
35
|
-
*
|
|
36
|
-
* @alpha
|
|
37
|
-
* @param name Theme name
|
|
38
|
-
* @returns Theme extension
|
|
39
|
-
*/
|
|
40
|
-
function getTheme(name: string): Extension;
|
|
41
|
-
}
|
package/lib/editortheme.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editortheme.js","sourceRoot":"","sources":["../src/editortheme.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC,KAAK,CAAC;IACjD;;;;OAIG;IACH,GAAG,EAAE;QACH,UAAU,EAAE,yBAAyB;QACrC,KAAK,EAAE,+BAA+B;KACvC;IAED,0EAA0E;IAC1E,mCAAmC,EAAE;QACnC,UAAU,EAAE,aAAa;KAC1B;IAED,aAAa,EAAE;QACb,UAAU,EAAE,+BAA+B;KAC5C;IAED,4BAA4B,EAAE;QAC5B,UAAU,EACR,kEAAkE;KACrE;IAED,kDAAkD,EAAE;QAClD,eAAe,EAAE,sCAAsC;KACxD;IAED,sCAAsC,EAAE;QACtC,eAAe,EAAE,8CAA8C;KAChE;IAED,aAAa,EAAE;QACb,WAAW,EAAE,mCAAmC;QAChD,eAAe,EAAE,yBAAyB;KAC3C;IAED,4BAA4B,EAAE;QAC5B,eAAe,EAAE,yBAAyB;KAC3C;IAED,iBAAiB,EAAE;QACjB,eAAe,EAAE,oDAAoD;QACrE,KAAK,EAAE,yCAAyC;KACjD;IAED,yCAAyC,EAAE;QACzC,eAAe,EACb,6DAA6D;QAC/D,KAAK,EAAE,kDAAkD;KAC1D;CACF,CAAC,CAAC;AAEH,q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H,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,kBAAkB;IAClB,kBAAkB,CAAC,qBAAqB,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,KAAW,KAAK,CAgDrB;AAhDD,WAAiB,KAAK;IACpB;;OAEG;IACH,MAAM,QAAQ,GAA2B,IAAI,GAAG,CAAC;QAC/C;YACE,YAAY;YACZ,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;SACtE;QACD,CAAC,SAAS,EAAE,YAAY,CAAC;KAC1B,CAAC,CAAC;IAEH;;;;;OAKG;IACH,SAAgB,YAAY;QAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;IAClC,CAAC;IAFe,kBAAY,eAE3B,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,IAAY,EAAE,KAAgB;QAC1D,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAFe,mBAAa,gBAE5B,CAAA;IAED;;;;;;;;;OASG;IACH,SAAgB,QAAQ,CAAC,IAAY;QACnC,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE7B,OAAO,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,IAAI,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IAJe,cAAQ,WAIvB,CAAA;AACH,CAAC,EAhDgB,KAAK,KAAL,KAAK,QAgDrB"}
|
package/lib/mode.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { LanguageSupport, StreamParser } from '@codemirror/language';
|
|
2
|
-
export declare namespace Mode {
|
|
3
|
-
/**
|
|
4
|
-
* The interface of a codemirror language spec.
|
|
5
|
-
*/
|
|
6
|
-
interface ISpec {
|
|
7
|
-
name: string;
|
|
8
|
-
alias?: readonly string[];
|
|
9
|
-
mime: string | readonly string[];
|
|
10
|
-
load?: () => Promise<LanguageSupport>;
|
|
11
|
-
extensions?: readonly string[];
|
|
12
|
-
filename?: RegExp;
|
|
13
|
-
support?: LanguageSupport;
|
|
14
|
-
}
|
|
15
|
-
function legacy(parser: StreamParser<unknown>): LanguageSupport;
|
|
16
|
-
/**
|
|
17
|
-
* Get the raw list of available modes specs.
|
|
18
|
-
*
|
|
19
|
-
* @alpha
|
|
20
|
-
* @returns The available modes
|
|
21
|
-
*/
|
|
22
|
-
function getModeInfo(): ISpec[];
|
|
23
|
-
/**
|
|
24
|
-
* Find a codemirror mode by MIME.
|
|
25
|
-
*
|
|
26
|
-
* @alpha
|
|
27
|
-
* @param mime Mime type to look for
|
|
28
|
-
* @returns The mode or null
|
|
29
|
-
*/
|
|
30
|
-
function findByMIME(mime: string | readonly string[]): ISpec | null;
|
|
31
|
-
/**
|
|
32
|
-
* Find a codemirror mode by name.
|
|
33
|
-
*
|
|
34
|
-
* @alpha
|
|
35
|
-
* @param name The mode name
|
|
36
|
-
* @returns The mode or null
|
|
37
|
-
*/
|
|
38
|
-
function findByName(name: string): ISpec | null;
|
|
39
|
-
/**
|
|
40
|
-
* Find a codemirror mode by extension.
|
|
41
|
-
*
|
|
42
|
-
* @alpha
|
|
43
|
-
* @param ext The extension name
|
|
44
|
-
* @returns The mode or null
|
|
45
|
-
*/
|
|
46
|
-
function findByExtension(ext: string | readonly string[]): ISpec | null;
|
|
47
|
-
/**
|
|
48
|
-
* Find a codemirror mode by filename.
|
|
49
|
-
*
|
|
50
|
-
* @param name File name
|
|
51
|
-
* @returns The mode or null
|
|
52
|
-
*/
|
|
53
|
-
function findByFileName(name: string): ISpec | null;
|
|
54
|
-
/**
|
|
55
|
-
* Find a codemirror mode by name or CodeMirror spec.
|
|
56
|
-
*
|
|
57
|
-
* @alpha
|
|
58
|
-
* @param mode The CodeMirror mode
|
|
59
|
-
* @param fallback Whether to fallback to default mimetype spec or not
|
|
60
|
-
* @returns The mode or null
|
|
61
|
-
*/
|
|
62
|
-
function findBest(mode: string | ISpec, fallback?: boolean): ISpec | null;
|
|
63
|
-
/**
|
|
64
|
-
* Ensure a codemirror mode is available by name or Codemirror spec.
|
|
65
|
-
*
|
|
66
|
-
* @param mode - The mode to ensure. If it is a string, uses [findBest]
|
|
67
|
-
* to get the appropriate spec.
|
|
68
|
-
*
|
|
69
|
-
* @returns A promise that resolves when the mode is available.
|
|
70
|
-
*/
|
|
71
|
-
function ensure(mode: string | ISpec): Promise<ISpec | null>;
|
|
72
|
-
/**
|
|
73
|
-
* Register a new mode for CodeMirror
|
|
74
|
-
*
|
|
75
|
-
* @alpha
|
|
76
|
-
* @param mode Mode to register
|
|
77
|
-
*/
|
|
78
|
-
function registerModeInfo(mode: ISpec): void;
|
|
79
|
-
/**
|
|
80
|
-
* Parse and style a string.
|
|
81
|
-
*
|
|
82
|
-
* @alpha
|
|
83
|
-
* @param code Code to highlight
|
|
84
|
-
* @param mode Code mode
|
|
85
|
-
* @param el HTML element into which the highlighted code will be inserted
|
|
86
|
-
*/
|
|
87
|
-
function run(code: string, mode: ISpec | null, el: HTMLElement): void;
|
|
88
|
-
}
|