@jupyterlab/codeeditor 4.0.0-alpha.2 → 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/editor.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import type { Extension } from '@codemirror/state';
2
+ import { ISharedText } from '@jupyter/ydoc';
1
3
  import { IChangedArgs } from '@jupyterlab/coreutils';
2
- import * as nbformat from '@jupyterlab/nbformat';
3
- import { IModelDB, IObservableMap, IObservableString } from '@jupyterlab/observables';
4
- import * as models from '@jupyterlab/shared-models';
4
+ import { IObservableMap } from '@jupyterlab/observables';
5
5
  import { ITranslator } from '@jupyterlab/translation';
6
6
  import { JSONObject } from '@lumino/coreutils';
7
7
  import { IDisposable } from '@lumino/disposable';
@@ -67,27 +67,6 @@ export declare namespace CodeEditor {
67
67
  */
68
68
  readonly end: IPosition;
69
69
  }
70
- /**
71
- * A selection style.
72
- */
73
- interface ISelectionStyle extends JSONObject {
74
- /**
75
- * A class name added to a selection.
76
- */
77
- className: string;
78
- /**
79
- * A display name added to a selection.
80
- */
81
- displayName: string;
82
- /**
83
- * A color for UI elements.
84
- */
85
- color: string;
86
- }
87
- /**
88
- * The default selection style.
89
- */
90
- const defaultSelectionStyle: ISelectionStyle;
91
70
  /**
92
71
  * A text selection.
93
72
  */
@@ -96,10 +75,6 @@ export declare namespace CodeEditor {
96
75
  * The uuid of the text selection owner.
97
76
  */
98
77
  readonly uuid: string;
99
- /**
100
- * The style of this selection.
101
- */
102
- readonly style: ISelectionStyle;
103
78
  }
104
79
  /**
105
80
  * An interface for a text token, such as a word, keyword, or variable.
@@ -142,14 +117,6 @@ export declare namespace CodeEditor {
142
117
  * A signal emitted when a property changes.
143
118
  */
144
119
  mimeTypeChanged: ISignal<IModel, IChangedArgs<string>>;
145
- /**
146
- * A signal emitted when the shared model was switched.
147
- */
148
- sharedModelSwitched: ISignal<IModel, boolean>;
149
- /**
150
- * The text stored in the model.
151
- */
152
- readonly value: IObservableString;
153
120
  /**
154
121
  * A mime type of the model.
155
122
  *
@@ -161,20 +128,10 @@ export declare namespace CodeEditor {
161
128
  * The currently selected code.
162
129
  */
163
130
  readonly selections: IObservableMap<ITextSelection[]>;
164
- /**
165
- * The underlying `IModelDB` instance in which model
166
- * data is stored.
167
- */
168
- readonly modelDB: IModelDB;
169
131
  /**
170
132
  * The shared model for the cell editor.
171
133
  */
172
- readonly sharedModel: models.ISharedText;
173
- /**
174
- * When we initialize a cell model, we create a standalone cell model that cannot be shared in a YNotebook.
175
- * Call this function to re-initialize the local representation based on a fresh shared model (e.g. models.YFile or models.YCodeCell).
176
- */
177
- switchSharedModel(sharedModel: models.ISharedText, reinitialize: boolean): void;
134
+ readonly sharedModel: ISharedText;
178
135
  }
179
136
  /**
180
137
  * The default implementation of the editor model.
@@ -184,47 +141,14 @@ export declare namespace CodeEditor {
184
141
  * Construct a new Model.
185
142
  */
186
143
  constructor(options?: Model.IOptions);
187
- /**
188
- * When we initialize a cell model, we create a standalone model that cannot be shared in a YNotebook.
189
- * Call this function to re-initialize the local representation based on a fresh shared model (e.g. models.YFile or models.YCodeCell).
190
- *
191
- * @param sharedModel
192
- * @param reinitialize Whether to reinitialize the shared model.
193
- */
194
- switchSharedModel(sharedModel: models.ISharedText, reinitialize?: boolean): void;
195
- /**
196
- * We update the modeldb store when the shared model changes.
197
- * To ensure that we don't run into infinite loops, we wrap this call in a "mutex".
198
- * The "mutex" ensures that the wrapped code can only be executed by either the sharedModelChanged handler
199
- * or the modelDB change handler.
200
- */
201
- protected _onSharedModelChanged(sender: models.ISharedBaseCell<any>, change: models.CellChange<nbformat.IBaseCellMetadata>): void;
202
- /**
203
- * Handle a change to the modelDB value.
204
- */
205
- private _onModelDBValueChanged;
206
- get type(): nbformat.CellType;
207
144
  /**
208
145
  * The shared model for the cell editor.
209
146
  */
210
- sharedModel: models.ISharedText;
211
- /**
212
- * The underlying `IModelDB` instance in which model
213
- * data is stored.
214
- */
215
- readonly modelDB: IModelDB;
147
+ readonly sharedModel: ISharedText;
216
148
  /**
217
149
  * A signal emitted when a mimetype changes.
218
150
  */
219
151
  get mimeTypeChanged(): ISignal<this, IChangedArgs<string>>;
220
- /**
221
- * A signal emitted when the shared model was switched.
222
- */
223
- get sharedModelSwitched(): ISignal<this, boolean>;
224
- /**
225
- * Get the value of the model.
226
- */
227
- get value(): IObservableString;
228
152
  /**
229
153
  * Get the selections for the model.
230
154
  */
@@ -242,10 +166,14 @@ export declare namespace CodeEditor {
242
166
  * Dispose of the resources used by the model.
243
167
  */
244
168
  dispose(): void;
245
- private _onModelDBMimeTypeChanged;
169
+ /**
170
+ * Whether the model should disposed the shared model on disposal or not.
171
+ */
172
+ protected standaloneModel: boolean;
246
173
  private _isDisposed;
174
+ private _selections;
175
+ private _mimeType;
247
176
  private _mimeTypeChanged;
248
- private _sharedModelSwitched;
249
177
  }
250
178
  /**
251
179
  * A selection owner.
@@ -311,16 +239,15 @@ export declare namespace CodeEditor {
311
239
  type EdgeLocation = 'top' | 'topLine' | 'bottom';
312
240
  /**
313
241
  * A widget that provides a code editor.
242
+ *
243
+ * As of JupyterLab 4.0.0, it is not possible to provide an editor
244
+ * that is different of CodeMirror 6.
314
245
  */
315
246
  interface IEditor extends ISelectionOwner, IDisposable {
316
247
  /**
317
248
  * A signal emitted when either the top or bottom edge is requested.
318
249
  */
319
250
  readonly edgeRequested: ISignal<IEditor, EdgeLocation>;
320
- /**
321
- * The default selection style for the editor.
322
- */
323
- selectionStyle: CodeEditor.ISelectionStyle;
324
251
  /**
325
252
  * The DOM node that hosts the editor.
326
253
  */
@@ -344,15 +271,23 @@ export declare namespace CodeEditor {
344
271
  /**
345
272
  * Get a config option for the editor.
346
273
  */
347
- getOption<K extends keyof IConfig>(option: K): IConfig[K];
274
+ getOption(option: string): unknown;
348
275
  /**
349
276
  * Set a config option for the editor.
350
277
  */
351
- setOption<K extends keyof IConfig>(option: K, value: IConfig[K]): void;
278
+ setOption(option: string, value: unknown): void;
352
279
  /**
353
280
  * Set config options for the editor.
354
281
  */
355
- setOptions<K extends keyof IConfig>(options: IConfigOptions<K>[]): void;
282
+ setOptions(options: Record<string, any>): void;
283
+ /**
284
+ * Inject an extension into the editor
285
+ *
286
+ * @alpha
287
+ * @experimental
288
+ * @param ext Editor extension
289
+ */
290
+ injectExtension(ext: Extension): void;
356
291
  /**
357
292
  * Returns the content for the given line number.
358
293
  *
@@ -407,34 +342,6 @@ export declare namespace CodeEditor {
407
342
  * Explicitly blur the editor.
408
343
  */
409
344
  blur(): void;
410
- /**
411
- * Repaint the editor.
412
- *
413
- * #### Notes
414
- * A repainted editor should fit to its host node.
415
- */
416
- refresh(): void;
417
- /**
418
- * Resize the editor to fit its host node.
419
- */
420
- resizeToFit(): void;
421
- /**
422
- * Add a keydown handler to the editor.
423
- *
424
- * @param handler - A keydown handler.
425
- *
426
- * @returns A disposable that can be used to remove the handler.
427
- */
428
- addKeydownHandler(handler: KeydownHandler): IDisposable;
429
- /**
430
- * Set the size of the editor.
431
- *
432
- * @param size - The desired size.
433
- *
434
- * #### Notes
435
- * Use `null` if the size is unknown.
436
- */
437
- setSize(size: IDimension | null): void;
438
345
  /**
439
346
  * Reveals the given position in the editor.
440
347
  *
@@ -444,7 +351,7 @@ export declare namespace CodeEditor {
444
351
  /**
445
352
  * Reveals the given selection in the editor.
446
353
  *
447
- * @param position - The desired selection to reveal.
354
+ * @param selection - The desired selection to reveal.
448
355
  */
449
356
  revealSelection(selection: IRange): void;
450
357
  /**
@@ -465,17 +372,21 @@ export declare namespace CodeEditor {
465
372
  */
466
373
  getPositionForCoordinate(coordinate: ICoordinate): IPosition | null;
467
374
  /**
468
- * Inserts a new line at the cursor position and indents it.
375
+ * Get a list of tokens for the current editor text content.
469
376
  */
470
- newIndentedLine(): void;
377
+ getTokens(): CodeEditor.IToken[];
471
378
  /**
472
- * Gets the token at a given position.
379
+ * Get the token at a given editor position.
473
380
  */
474
- getTokenForPosition(position: IPosition): IToken;
381
+ getTokenAt(offset: number): CodeEditor.IToken;
475
382
  /**
476
- * Gets the list of tokens for the editor model.
383
+ * Get the token a the cursor position.
477
384
  */
478
- getTokens(): IToken[];
385
+ getTokenAtCursor(): CodeEditor.IToken;
386
+ /**
387
+ * Inserts a new line at the cursor position and indents it.
388
+ */
389
+ newIndentedLine(): void;
479
390
  /**
480
391
  * Replaces selection with the given text.
481
392
  */
@@ -485,91 +396,6 @@ export declare namespace CodeEditor {
485
396
  * A factory used to create a code editor.
486
397
  */
487
398
  type Factory = (options: IOptions) => CodeEditor.IEditor;
488
- /**
489
- * The configuration options for an editor.
490
- */
491
- interface IConfig {
492
- /**
493
- * Half-period in milliseconds used for cursor blinking.
494
- * By setting this to zero, blinking can be disabled.
495
- * A negative value hides the cursor entirely.
496
- */
497
- cursorBlinkRate: number;
498
- /**
499
- * User preferred font family for text editors.
500
- */
501
- fontFamily: string | null;
502
- /**
503
- * User preferred size in pixel of the font used in text editors.
504
- */
505
- fontSize: number | null;
506
- /**
507
- * User preferred text line height, as a multiplier of font size.
508
- */
509
- lineHeight: number | null;
510
- /**
511
- * Whether line numbers should be displayed.
512
- */
513
- lineNumbers: boolean;
514
- /**
515
- * Control the line wrapping of the editor. Possible values are:
516
- * - "off", lines will never wrap.
517
- * - "on", lines will wrap at the viewport border.
518
- * - "wordWrapColumn", lines will wrap at `wordWrapColumn`.
519
- * - "bounded", lines will wrap at minimum between viewport width and wordWrapColumn.
520
- */
521
- lineWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
522
- /**
523
- * Whether the editor is read-only.
524
- */
525
- readOnly: boolean;
526
- /**
527
- * The number of spaces a tab is equal to.
528
- */
529
- tabSize: number;
530
- /**
531
- * Whether to insert spaces when pressing Tab.
532
- */
533
- insertSpaces: boolean;
534
- /**
535
- * Whether to highlight matching brackets when one of them is selected.
536
- */
537
- matchBrackets: boolean;
538
- /**
539
- * Whether to automatically close brackets after opening them.
540
- */
541
- autoClosingBrackets: boolean;
542
- /**
543
- * Whether the editor should handle paste events.
544
- */
545
- handlePaste?: boolean;
546
- /**
547
- * The column where to break text line.
548
- */
549
- wordWrapColumn: number;
550
- /**
551
- * Column index at which rulers should be added.
552
- */
553
- rulers: Array<number>;
554
- /**
555
- * Whether to allow code folding
556
- */
557
- codeFolding: boolean;
558
- /**
559
- * Whether to highlight trailing whitespace
560
- */
561
- showTrailingSpace: boolean;
562
- }
563
- /**
564
- * The default configuration options for an editor.
565
- */
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
399
  /**
574
400
  * The options used to initialize an editor.
575
401
  */
@@ -583,37 +409,40 @@ export declare namespace CodeEditor {
583
409
  */
584
410
  model: IModel;
585
411
  /**
586
- * The desired uuid for the editor.
412
+ * The configuration options for the editor.
587
413
  */
588
- uuid?: string;
414
+ config?: Record<string, any>;
589
415
  /**
590
- * The default selection style for the editor.
416
+ * List of editor extensions to be added.
591
417
  */
592
- selectionStyle?: Partial<CodeEditor.ISelectionStyle>;
418
+ extensions?: Extension[];
593
419
  /**
594
- * The configuration options for the editor.
420
+ * Whether the editor will be inline or not.
595
421
  */
596
- config?: Partial<IConfig>;
422
+ inline?: boolean;
597
423
  /**
598
424
  * The configuration options for the editor.
599
425
  */
600
426
  translator?: ITranslator;
427
+ /**
428
+ * The desired uuid for the editor.
429
+ */
430
+ uuid?: string;
601
431
  }
602
432
  namespace Model {
603
433
  interface IOptions {
604
- id?: string;
605
434
  /**
606
- * The initial value of the model.
435
+ * A unique identifier for the model.
607
436
  */
608
- value?: string;
437
+ id?: string;
609
438
  /**
610
439
  * The mimetype of the model.
611
440
  */
612
441
  mimeType?: string;
613
442
  /**
614
- * An optional modelDB for storing model state.
443
+ * Shared editor text.
615
444
  */
616
- modelDB?: IModelDB;
445
+ sharedModel?: ISharedText;
617
446
  }
618
447
  }
619
448
  }
package/lib/editor.js CHANGED
@@ -1,9 +1,8 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { ModelDB } from '@jupyterlab/observables';
4
- import * as models from '@jupyterlab/shared-models';
3
+ import { YFile } from '@jupyter/ydoc';
4
+ import { ObservableMap } from '@jupyterlab/observables';
5
5
  import { Signal } from '@lumino/signaling';
6
- const globalModelDBMutex = models.createMutex();
7
6
  /**
8
7
  * A namespace for code editors.
9
8
  *
@@ -14,14 +13,6 @@ const globalModelDBMutex = models.createMutex();
14
13
  */
15
14
  export var CodeEditor;
16
15
  (function (CodeEditor) {
17
- /**
18
- * The default selection style.
19
- */
20
- CodeEditor.defaultSelectionStyle = {
21
- className: '',
22
- displayName: '',
23
- color: 'black'
24
- };
25
16
  /**
26
17
  * The default implementation of the editor model.
27
18
  */
@@ -29,94 +20,20 @@ export var CodeEditor;
29
20
  /**
30
21
  * Construct a new Model.
31
22
  */
32
- constructor(options) {
23
+ constructor(options = {}) {
24
+ var _a, _b;
25
+ /**
26
+ * Whether the model should disposed the shared model on disposal or not.
27
+ */
28
+ this.standaloneModel = false;
33
29
  this._isDisposed = false;
30
+ this._selections = new ObservableMap();
31
+ this._mimeType = 'text/plain';
34
32
  this._mimeTypeChanged = new Signal(this);
35
- this._sharedModelSwitched = new Signal(this);
36
- options = options || {};
37
- if (options.modelDB) {
38
- this.modelDB = options.modelDB;
39
- }
40
- else {
41
- this.modelDB = new ModelDB();
42
- }
43
- this.sharedModel = models.createStandaloneCell(this.type, options.id);
44
- this.sharedModel.changed.connect(this._onSharedModelChanged, this);
45
- const value = this.modelDB.createString('value');
46
- value.changed.connect(this._onModelDBValueChanged, this);
47
- value.text = value.text || options.value || '';
48
- const mimeType = this.modelDB.createValue('mimeType');
49
- mimeType.changed.connect(this._onModelDBMimeTypeChanged, this);
50
- mimeType.set(options.mimeType || 'text/plain');
51
- this.modelDB.createMap('selections');
52
- }
53
- /**
54
- * When we initialize a cell model, we create a standalone model that cannot be shared in a YNotebook.
55
- * Call this function to re-initialize the local representation based on a fresh shared model (e.g. models.YFile or models.YCodeCell).
56
- *
57
- * @param sharedModel
58
- * @param reinitialize Whether to reinitialize the shared model.
59
- */
60
- switchSharedModel(sharedModel, reinitialize) {
61
- if (reinitialize) {
62
- // update local modeldb
63
- // @todo also change metadata
64
- this.value.text = sharedModel.getSource();
65
- }
66
- this.sharedModel.changed.disconnect(this._onSharedModelChanged, this);
67
- // clone model retrieve a shared (not standalone) model
68
- this.sharedModel = sharedModel;
69
- this.sharedModel.changed.connect(this._onSharedModelChanged, this);
70
- this._sharedModelSwitched.emit(true);
71
- }
72
- /**
73
- * We update the modeldb store when the shared model changes.
74
- * To ensure that we don't run into infinite loops, we wrap this call in a "mutex".
75
- * The "mutex" ensures that the wrapped code can only be executed by either the sharedModelChanged handler
76
- * or the modelDB change handler.
77
- */
78
- _onSharedModelChanged(sender, change) {
79
- globalModelDBMutex(() => {
80
- if (change.sourceChange) {
81
- const value = this.modelDB.get('value');
82
- let currpos = 0;
83
- change.sourceChange.forEach(delta => {
84
- if (delta.insert != null) {
85
- value.insert(currpos, delta.insert);
86
- currpos += delta.insert.length;
87
- }
88
- else if (delta.delete != null) {
89
- value.remove(currpos, currpos + delta.delete);
90
- }
91
- else if (delta.retain != null) {
92
- currpos += delta.retain;
93
- }
94
- });
95
- }
96
- });
97
- }
98
- /**
99
- * Handle a change to the modelDB value.
100
- */
101
- _onModelDBValueChanged(value, event) {
102
- globalModelDBMutex(() => {
103
- this.sharedModel.transact(() => {
104
- switch (event.type) {
105
- case 'insert':
106
- this.sharedModel.updateSource(event.start, event.start, event.value);
107
- break;
108
- case 'remove':
109
- this.sharedModel.updateSource(event.start, event.end);
110
- break;
111
- default:
112
- this.sharedModel.setSource(value.text);
113
- break;
114
- }
115
- });
116
- });
117
- }
118
- get type() {
119
- return 'code';
33
+ // Track if we need to dispose the model or not.
34
+ this.standaloneModel = typeof options.sharedModel === 'undefined';
35
+ this.sharedModel = (_a = options.sharedModel) !== null && _a !== void 0 ? _a : new YFile();
36
+ this._mimeType = (_b = options.mimeType) !== null && _b !== void 0 ? _b : 'text/plain';
120
37
  }
121
38
  /**
122
39
  * A signal emitted when a mimetype changes.
@@ -124,36 +41,29 @@ export var CodeEditor;
124
41
  get mimeTypeChanged() {
125
42
  return this._mimeTypeChanged;
126
43
  }
127
- /**
128
- * A signal emitted when the shared model was switched.
129
- */
130
- get sharedModelSwitched() {
131
- return this._sharedModelSwitched;
132
- }
133
- /**
134
- * Get the value of the model.
135
- */
136
- get value() {
137
- return this.modelDB.get('value');
138
- }
139
44
  /**
140
45
  * Get the selections for the model.
141
46
  */
142
47
  get selections() {
143
- return this.modelDB.get('selections');
48
+ return this._selections;
144
49
  }
145
50
  /**
146
51
  * A mime type of the model.
147
52
  */
148
53
  get mimeType() {
149
- return this.modelDB.getValue('mimeType');
54
+ return this._mimeType;
150
55
  }
151
56
  set mimeType(newValue) {
152
57
  const oldValue = this.mimeType;
153
58
  if (oldValue === newValue) {
154
59
  return;
155
60
  }
156
- this.modelDB.setValue('mimeType', newValue);
61
+ this._mimeType = newValue;
62
+ this._mimeTypeChanged.emit({
63
+ name: 'mimeType',
64
+ oldValue: oldValue,
65
+ newValue: newValue
66
+ });
157
67
  }
158
68
  /**
159
69
  * Whether the model is disposed.
@@ -169,37 +79,13 @@ export var CodeEditor;
169
79
  return;
170
80
  }
171
81
  this._isDisposed = true;
82
+ this._selections.dispose();
83
+ if (this.standaloneModel) {
84
+ this.sharedModel.dispose();
85
+ }
172
86
  Signal.clearData(this);
173
87
  }
174
- _onModelDBMimeTypeChanged(mimeType, args) {
175
- this._mimeTypeChanged.emit({
176
- name: 'mimeType',
177
- oldValue: args.oldValue,
178
- newValue: args.newValue
179
- });
180
- }
181
88
  }
182
89
  CodeEditor.Model = Model;
183
- /**
184
- * The default configuration options for an editor.
185
- */
186
- CodeEditor.defaultConfig = {
187
- cursorBlinkRate: 530,
188
- fontFamily: null,
189
- fontSize: null,
190
- lineHeight: null,
191
- lineNumbers: false,
192
- lineWrap: 'on',
193
- wordWrapColumn: 80,
194
- readOnly: false,
195
- tabSize: 4,
196
- insertSpaces: true,
197
- matchBrackets: true,
198
- autoClosingBrackets: false,
199
- handlePaste: true,
200
- rulers: [],
201
- codeFolding: false,
202
- showTrailingSpace: false
203
- };
204
90
  })(CodeEditor || (CodeEditor = {}));
205
91
  //# 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,CA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ACxB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;aAC5B;YACD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;KAWF;IAhFY,gBAAK,QAgFjB,CAAA;AAkUH,CAAC,EA3hBgB,UAAU,KAAV,UAAU,QA2hB1B"}
package/lib/factory.d.ts CHANGED
@@ -6,9 +6,9 @@ export interface IEditorFactoryService {
6
6
  /**
7
7
  * Create a new editor for inline code.
8
8
  */
9
- newInlineEditor(options: CodeEditor.IOptions): CodeEditor.IEditor;
9
+ newInlineEditor: CodeEditor.Factory;
10
10
  /**
11
11
  * Create a new editor for a full document.
12
12
  */
13
- newDocumentEditor(options: CodeEditor.IOptions): CodeEditor.IEditor;
13
+ newDocumentEditor: CodeEditor.Factory;
14
14
  }
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';