@covalent/code-editor 4.0.0-beta.2 → 4.1.1-next.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.
@@ -1,12 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, forwardRef, Component, ViewChild, Output, Input, NgModule } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
- import { Subject, merge, fromEvent, timer } from 'rxjs';
4
+ import { Subject, of, merge, fromEvent, timer } from 'rxjs';
5
5
  import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
6
6
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
7
7
  import { CommonModule } from '@angular/common';
8
8
 
9
- const _c0 = ["editorContainer"];
10
9
  const noop = () => {
11
10
  // empty method
12
11
  };
@@ -52,22 +51,13 @@ class TdCodeEditorComponent {
52
51
  * Event emitted any time something changes the editor value
53
52
  */
54
53
  this.editorValueChange = new EventEmitter();
55
- /**
56
- * The change event notifies you about a change happening in an input field.
57
- * Since the component is not a native Angular component have to specifiy the event emitter ourself
58
- */
59
- this.change = new EventEmitter();
60
- /* tslint:disable-next-line */
61
- this.propagateChange = (_) => { };
54
+ this.propagateChange = () => noop;
62
55
  this.onTouched = () => noop;
63
56
  }
64
57
  /**
65
58
  * value?: string
66
59
  */
67
60
  set value(value) {
68
- if (value === this._value) {
69
- return;
70
- }
71
61
  this._value = value;
72
62
  if (this._componentInitialized) {
73
63
  this.applyValue();
@@ -81,8 +71,6 @@ class TdCodeEditorComponent {
81
71
  this._editor.setValue(this._value);
82
72
  }
83
73
  this._fromEditor = false;
84
- this.propagateChange(this._value);
85
- this.change.emit();
86
74
  this.editorValueChange.emit();
87
75
  }
88
76
  /**
@@ -106,14 +94,15 @@ class TdCodeEditorComponent {
106
94
  * Returns the content within the editor
107
95
  */
108
96
  getValue() {
109
- if (this._componentInitialized) {
110
- setTimeout(() => {
111
- this._subject.next(this._value);
112
- this._subject.complete();
113
- this._subject = new Subject();
114
- });
115
- return this._subject.asObservable();
97
+ if (!this._componentInitialized) {
98
+ return of('');
116
99
  }
100
+ setTimeout(() => {
101
+ this._subject.next(this._value);
102
+ this._subject.complete();
103
+ this._subject = new Subject();
104
+ });
105
+ return this._subject.asObservable();
117
106
  }
118
107
  /**
119
108
  * language?: string
@@ -140,14 +129,6 @@ class TdCodeEditorComponent {
140
129
  */
141
130
  registerLanguage(language) {
142
131
  if (this._componentInitialized) {
143
- for (const provider of language.completionItemProvider) {
144
- /* tslint:disable-next-line */
145
- provider.kind = eval(provider.kind);
146
- }
147
- for (const monarchTokens of language.monarchTokensProvider) {
148
- /* tslint:disable-next-line */
149
- monarchTokens[0] = eval(monarchTokens[0]);
150
- }
151
132
  monaco.languages.register({ id: language.id });
152
133
  monaco.languages.setMonarchTokensProvider(language.id, {
153
134
  tokenizer: {
@@ -167,7 +148,10 @@ class TdCodeEditorComponent {
167
148
  css.innerHTML = language.monarchTokensProviderCSS;
168
149
  document.body.appendChild(css);
169
150
  this.editorConfigurationChanged.emit();
170
- this._registeredLanguagesStyles = [...this._registeredLanguagesStyles, css];
151
+ this._registeredLanguagesStyles = [
152
+ ...this._registeredLanguagesStyles,
153
+ css,
154
+ ];
171
155
  }
172
156
  }
173
157
  /**
@@ -217,7 +201,7 @@ class TdCodeEditorComponent {
217
201
  /**
218
202
  * editorOptions?: object
219
203
  * Options used on editor instantiation. Available options listed here:
220
- * https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.ieditoroptions.html
204
+ * https://microsoft.github.io/monaco-editor/api/interfaces/editor.ieditoroptions.html
221
205
  */
222
206
  set editorOptions(editorOptions) {
223
207
  this._editorOptions = editorOptions;
@@ -263,7 +247,9 @@ class TdCodeEditorComponent {
263
247
  // The `onDidChangeContent` returns a disposable object (an object with `dispose()` method) which will cleanup
264
248
  // the listener. The callback, that we pass to `onDidChangeContent`, captures `this`. This leads to a circular reference
265
249
  // (`td-code-editor -> monaco -> td-code-editor`) and prevents the `td-code-editor` from being GC'd.
266
- this._onDidChangeContentDisposable = this._editor.getModel().onDidChangeContent((e) => {
250
+ this._onDidChangeContentDisposable = this._editor
251
+ .getModel()
252
+ ?.onDidChangeContent(() => {
267
253
  this._fromEditor = true;
268
254
  this.writeValue(this._editor.getValue());
269
255
  this.layout();
@@ -279,8 +265,8 @@ class TdCodeEditorComponent {
279
265
  .pipe(takeUntil(this._destroy))
280
266
  .subscribe(() => {
281
267
  if (this._elementRef && this._elementRef.nativeElement) {
282
- this._widthSubject.next(this._elementRef.nativeElement.getBoundingClientRect().width);
283
- this._heightSubject.next(this._elementRef.nativeElement.getBoundingClientRect().height);
268
+ this._widthSubject.next((this._elementRef.nativeElement).getBoundingClientRect().width);
269
+ this._heightSubject.next((this._elementRef.nativeElement).getBoundingClientRect().height);
284
270
  }
285
271
  });
286
272
  }
@@ -293,7 +279,6 @@ class TdCodeEditorComponent {
293
279
  }
294
280
  if (this._editor) {
295
281
  this._editor.dispose();
296
- this._editor = undefined;
297
282
  }
298
283
  this._destroy.next(true);
299
284
  this._destroy.unsubscribe();
@@ -303,22 +288,9 @@ class TdCodeEditorComponent {
303
288
  */
304
289
  showFullScreenEditor() {
305
290
  if (this._componentInitialized) {
306
- const codeEditorElement = this._editorContainer.nativeElement;
307
- const fullScreenMap = {
308
- // Chrome
309
- requestFullscreen: () => codeEditorElement.requestFullscreen(),
310
- // Safari
311
- webkitRequestFullscreen: () => codeEditorElement.webkitRequestFullscreen(),
312
- // IE
313
- msRequestFullscreen: () => codeEditorElement.msRequestFullscreen(),
314
- // Firefox
315
- mozRequestFullScreen: () => codeEditorElement.mozRequestFullScreen(),
316
- };
317
- for (const handler of Object.keys(fullScreenMap)) {
318
- if (codeEditorElement[handler]) {
319
- fullScreenMap[handler]();
320
- }
321
- }
291
+ const codeEditorElement = this._editorContainer
292
+ .nativeElement;
293
+ codeEditorElement.requestFullscreen();
322
294
  }
323
295
  this._isFullScreen = true;
324
296
  }
@@ -327,21 +299,7 @@ class TdCodeEditorComponent {
327
299
  */
328
300
  exitFullScreenEditor() {
329
301
  if (this._componentInitialized) {
330
- const exitFullScreenMap = {
331
- // Chrome
332
- exitFullscreen: () => document.exitFullscreen(),
333
- // Safari
334
- webkitExitFullscreen: () => document.webkitExitFullscreen(),
335
- // Firefox
336
- mozCancelFullScreen: () => document.mozCancelFullScreen(),
337
- // IE
338
- msExitFullscreen: () => document.msExitFullscreen(),
339
- };
340
- for (const handler of Object.keys(exitFullScreenMap)) {
341
- if (document[handler]) {
342
- exitFullScreenMap[handler]();
343
- }
344
- }
302
+ document.exitFullscreen();
345
303
  }
346
304
  this._isFullScreen = false;
347
305
  }
@@ -359,85 +317,68 @@ class TdCodeEditorComponent {
359
317
  keybindings: this._keycode,
360
318
  contextMenuOrder: 1.5,
361
319
  // Method that will be executed when the action is triggered.
362
- // @param editor The editor instance is passed in as a convinience
363
- run: (ed) => {
320
+ run: () => {
364
321
  this.showFullScreenEditor();
365
322
  },
366
323
  });
367
324
  }
368
325
  }
369
- /** @nocollapse */ /** @nocollapse */ TdCodeEditorComponent.ɵfac = function TdCodeEditorComponent_Factory(t) { return new (t || TdCodeEditorComponent)(i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.ElementRef)); };
370
- /** @nocollapse */ /** @nocollapse */ TdCodeEditorComponent.ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: TdCodeEditorComponent, selectors: [["td-code-editor"]], viewQuery: function TdCodeEditorComponent_Query(rf, ctx) { if (rf & 1) {
371
- i0.ɵɵviewQuery(_c0, 7);
372
- } if (rf & 2) {
373
- let _t;
374
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx._editorContainer = _t.first);
375
- } }, inputs: { value: "value", language: "language", editorStyle: "editorStyle", theme: "theme", fullScreenKeyBinding: "fullScreenKeyBinding", editorOptions: "editorOptions" }, outputs: { editorInitialized: "editorInitialized", editorConfigurationChanged: "editorConfigurationChanged", editorLanguageChanged: "editorLanguageChanged", editorValueChange: "editorValueChange", change: "change" }, features: [i0.ɵɵProvidersFeature([
376
- {
377
- provide: NG_VALUE_ACCESSOR,
378
- useExisting: forwardRef((() => TdCodeEditorComponent)),
379
- multi: true,
380
- },
381
- ])], decls: 2, vars: 0, consts: [[1, "editor-container"], ["editorContainer", ""]], template: function TdCodeEditorComponent_Template(rf, ctx) { if (rf & 1) {
382
- i0.ɵɵelement(0, "div", 0, 1);
383
- } }, styles: ["[_nghost-%COMP%]{display:block;position:relative}[_nghost-%COMP%] .editor-container[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:0;right:0} .monaco-aria-container{display:none}"] });
384
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdCodeEditorComponent, [{
385
- type: Component,
386
- args: [{ selector: 'td-code-editor', providers: [
387
- {
388
- provide: NG_VALUE_ACCESSOR,
389
- useExisting: forwardRef((() => TdCodeEditorComponent)),
390
- multi: true,
391
- },
392
- ], template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;top:0;bottom:0;left:0;right:0}::ng-deep .monaco-aria-container{display:none}\n"] }]
393
- }], function () { return [{ type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, { _editorContainer: [{
394
- type: ViewChild,
395
- args: ['editorContainer', { static: true }]
396
- }], editorInitialized: [{
397
- type: Output
398
- }], editorConfigurationChanged: [{
399
- type: Output
400
- }], editorLanguageChanged: [{
401
- type: Output
402
- }], editorValueChange: [{
403
- type: Output
404
- }], change: [{
405
- type: Output
406
- }], value: [{
407
- type: Input,
408
- args: ['value']
409
- }], language: [{
410
- type: Input,
411
- args: ['language']
412
- }], editorStyle: [{
413
- type: Input,
414
- args: ['editorStyle']
415
- }], theme: [{
416
- type: Input,
417
- args: ['theme']
418
- }], fullScreenKeyBinding: [{
419
- type: Input,
420
- args: ['fullScreenKeyBinding']
421
- }], editorOptions: [{
422
- type: Input,
423
- args: ['editorOptions']
424
- }] }); })();
326
+ TdCodeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdCodeEditorComponent, deps: [{ token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
327
+ TdCodeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: TdCodeEditorComponent, selector: "td-code-editor", inputs: { value: "value", language: "language", editorStyle: "editorStyle", theme: "theme", fullScreenKeyBinding: "fullScreenKeyBinding", editorOptions: "editorOptions" }, outputs: { editorInitialized: "editorInitialized", editorConfigurationChanged: "editorConfigurationChanged", editorLanguageChanged: "editorLanguageChanged", editorValueChange: "editorValueChange" }, providers: [
328
+ {
329
+ provide: NG_VALUE_ACCESSOR,
330
+ useExisting: forwardRef(() => TdCodeEditorComponent),
331
+ multi: true,
332
+ },
333
+ ], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: ["editorContainer"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;top:0;bottom:0;left:0;right:0}::ng-deep .monaco-aria-container{display:none}\n"] });
334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdCodeEditorComponent, decorators: [{
335
+ type: Component,
336
+ args: [{ selector: 'td-code-editor', providers: [
337
+ {
338
+ provide: NG_VALUE_ACCESSOR,
339
+ useExisting: forwardRef(() => TdCodeEditorComponent),
340
+ multi: true,
341
+ },
342
+ ], template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;top:0;bottom:0;left:0;right:0}::ng-deep .monaco-aria-container{display:none}\n"] }]
343
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { _editorContainer: [{
344
+ type: ViewChild,
345
+ args: ['editorContainer', { static: true }]
346
+ }], editorInitialized: [{
347
+ type: Output
348
+ }], editorConfigurationChanged: [{
349
+ type: Output
350
+ }], editorLanguageChanged: [{
351
+ type: Output
352
+ }], editorValueChange: [{
353
+ type: Output
354
+ }], value: [{
355
+ type: Input
356
+ }], language: [{
357
+ type: Input
358
+ }], editorStyle: [{
359
+ type: Input
360
+ }], theme: [{
361
+ type: Input
362
+ }], fullScreenKeyBinding: [{
363
+ type: Input
364
+ }], editorOptions: [{
365
+ type: Input
366
+ }] } });
425
367
 
426
368
  class CovalentCodeEditorModule {
427
369
  }
428
- /** @nocollapse */ /** @nocollapse */ CovalentCodeEditorModule.ɵfac = function CovalentCodeEditorModule_Factory(t) { return new (t || CovalentCodeEditorModule)(); };
429
- /** @nocollapse */ /** @nocollapse */ CovalentCodeEditorModule.ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: CovalentCodeEditorModule, bootstrap: [TdCodeEditorComponent] });
430
- /** @nocollapse */ /** @nocollapse */ CovalentCodeEditorModule.ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ imports: [[CommonModule]] });
431
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CovalentCodeEditorModule, [{
432
- type: NgModule,
433
- args: [{
434
- imports: [CommonModule],
435
- declarations: [TdCodeEditorComponent],
436
- exports: [TdCodeEditorComponent],
437
- bootstrap: [TdCodeEditorComponent],
438
- }]
439
- }], null, null); })();
440
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CovalentCodeEditorModule, { declarations: [TdCodeEditorComponent], imports: [CommonModule], exports: [TdCodeEditorComponent] }); })();
370
+ CovalentCodeEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentCodeEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
371
+ CovalentCodeEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentCodeEditorModule, bootstrap: [TdCodeEditorComponent], declarations: [TdCodeEditorComponent], imports: [CommonModule], exports: [TdCodeEditorComponent] });
372
+ CovalentCodeEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentCodeEditorModule, imports: [[CommonModule]] });
373
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentCodeEditorModule, decorators: [{
374
+ type: NgModule,
375
+ args: [{
376
+ imports: [CommonModule],
377
+ declarations: [TdCodeEditorComponent],
378
+ exports: [TdCodeEditorComponent],
379
+ bootstrap: [TdCodeEditorComponent],
380
+ }]
381
+ }] });
441
382
 
442
383
  /**
443
384
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"covalent-code-editor.mjs","sources":["../../../../src/platform/code-editor/code-editor.component.ts","../../../../src/platform/code-editor/code-editor.component.html","../../../../src/platform/code-editor/code-editor.module.ts","../../../../src/platform/code-editor/covalent-code-editor.ts"],"sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n OnInit,\n ViewChild,\n ElementRef,\n forwardRef,\n NgZone,\n ChangeDetectorRef,\n OnDestroy,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { Observable, Subject } from 'rxjs';\nimport { fromEvent, merge, timer } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\n// Use esm version to support shipping subset of languages and features\nimport * as monaco from 'monaco-editor/esm/vs/editor/editor.api';\n\nconst noop: any = () => {\n // empty method\n};\n\n// counter for ids to allow for multiple editors on one page\nlet uniqueCounter: number = 0;\n\n@Component({\n selector: 'td-code-editor',\n templateUrl: './code-editor.component.html',\n styleUrls: ['./code-editor.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdCodeEditorComponent),\n multi: true,\n },\n ],\n})\nexport class TdCodeEditorComponent implements OnInit, ControlValueAccessor, OnDestroy {\n private _destroy: Subject<boolean> = new Subject<boolean>();\n private _widthSubject: Subject<number> = new Subject<number>();\n private _heightSubject: Subject<number> = new Subject<number>();\n\n private _editorStyle: string = 'width:100%;height:100%;border:1px solid grey;';\n private _value: string = '';\n private _theme: string = 'vs';\n private _language: string = 'javascript';\n private _subject: Subject<string> = new Subject();\n private _editorInnerContainer: string = 'editorInnerContainer' + uniqueCounter++;\n private _editor: monaco.editor.IStandaloneCodeEditor;\n private _fromEditor: boolean = false;\n private _componentInitialized: boolean = false;\n private _editorOptions: any = {};\n private _isFullScreen: boolean = false;\n private _keycode: any;\n private _registeredLanguagesStyles: HTMLStyleElement[] = [];\n private _onDidChangeContentDisposable?: monaco.IDisposable;\n\n @ViewChild('editorContainer', { static: true }) _editorContainer: ElementRef;\n\n /**\n * editorInitialized: function($event)\n * Event emitted when editor is first initialized\n */\n @Output() editorInitialized: EventEmitter<monaco.editor.IStandaloneCodeEditor> =\n new EventEmitter<monaco.editor.IStandaloneCodeEditor>();\n\n /**\n * editorConfigurationChanged: function($event)\n * Event emitted when editor's configuration changes\n */\n @Output() editorConfigurationChanged: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * editorLanguageChanged: function($event)\n * Event emitted when editor's Language changes\n */\n @Output() editorLanguageChanged: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * editorValueChange: function($event)\n * Event emitted any time something changes the editor value\n */\n @Output() editorValueChange: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * The change event notifies you about a change happening in an input field.\n * Since the component is not a native Angular component have to specifiy the event emitter ourself\n */\n @Output() change: EventEmitter<void> = new EventEmitter<void>();\n /* tslint:disable-next-line */\n propagateChange = (_: any) => {};\n onTouched = () => noop;\n\n /**\n * value?: string\n */\n @Input('value')\n set value(value: string) {\n if (value === this._value) {\n return;\n }\n this._value = value;\n if (this._componentInitialized) {\n this.applyValue();\n }\n }\n\n get value(): string {\n return this._value;\n }\n\n applyValue(): void {\n if (!this._fromEditor) {\n this._editor.setValue(this._value);\n }\n this._fromEditor = false;\n this.propagateChange(this._value);\n this.change.emit();\n this.editorValueChange.emit();\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n writeValue(value: any): void {\n // do not write if null or undefined\n // tslint:disable-next-line\n if (value != undefined) {\n this.value = value;\n }\n }\n registerOnChange(fn: any): void {\n this.propagateChange = fn;\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n /**\n * getEditorContent?: function\n * Returns the content within the editor\n */\n getValue(): Observable<string> {\n if (this._componentInitialized) {\n setTimeout(() => {\n this._subject.next(this._value);\n this._subject.complete();\n this._subject = new Subject();\n });\n return this._subject.asObservable();\n }\n }\n\n /**\n * language?: string\n * language used in editor\n */\n @Input('language')\n set language(language: string) {\n this._language = language;\n if (this._componentInitialized) {\n this.applyLanguage();\n }\n }\n\n get language(): string {\n return this._language;\n }\n\n applyLanguage(): void {\n if (this._language) {\n monaco.editor.setModelLanguage(this._editor.getModel(), this._language);\n this.editorLanguageChanged.emit();\n }\n }\n\n /**\n * registerLanguage?: function\n * Registers a custom Language within the editor\n */\n registerLanguage(language: any): void {\n if (this._componentInitialized) {\n for (const provider of language.completionItemProvider) {\n /* tslint:disable-next-line */\n provider.kind = eval(provider.kind);\n }\n for (const monarchTokens of language.monarchTokensProvider) {\n /* tslint:disable-next-line */\n monarchTokens[0] = eval(monarchTokens[0]);\n }\n monaco.languages.register({ id: language.id });\n\n monaco.languages.setMonarchTokensProvider(language.id, {\n tokenizer: {\n root: language.monarchTokensProvider,\n },\n });\n\n // Define a new theme that constains only rules that match this language\n monaco.editor.defineTheme(language.customTheme.id, language.customTheme.theme);\n this._theme = language.customTheme.id;\n\n monaco.languages.registerCompletionItemProvider(language.id, {\n provideCompletionItems: () => {\n return language.completionItemProvider;\n },\n });\n\n const css: HTMLStyleElement = document.createElement('style');\n css.type = 'text/css';\n css.innerHTML = language.monarchTokensProviderCSS;\n document.body.appendChild(css);\n this.editorConfigurationChanged.emit();\n this._registeredLanguagesStyles = [...this._registeredLanguagesStyles, css];\n }\n }\n\n /**\n * style?: string\n * css style of the editor on the page\n */\n @Input('editorStyle')\n set editorStyle(editorStyle: string) {\n this._editorStyle = editorStyle;\n if (this._componentInitialized) {\n this.applyStyle();\n }\n }\n\n get editorStyle(): string {\n return this._editorStyle;\n }\n\n applyStyle(): void {\n if (this._editorStyle) {\n const containerDiv: HTMLDivElement = this._editorContainer.nativeElement;\n containerDiv.setAttribute('style', this._editorStyle);\n }\n }\n\n /**\n * theme?: string\n * Theme to be applied to editor\n */\n @Input('theme')\n set theme(theme: string) {\n this._theme = theme;\n if (this._componentInitialized) {\n this._editor.updateOptions({ theme });\n this.editorConfigurationChanged.emit();\n }\n }\n get theme(): string {\n return this._theme;\n }\n\n /**\n * fullScreenKeyBinding?: number\n * See here for key bindings https://microsoft.github.io/monaco-editor/api/enums/monaco.keycode.html\n * Sets the KeyCode for shortcutting to Fullscreen mode\n */\n @Input('fullScreenKeyBinding')\n set fullScreenKeyBinding(keycode: number[]) {\n this._keycode = keycode;\n }\n get fullScreenKeyBinding(): number[] {\n return this._keycode;\n }\n\n /**\n * editorOptions?: object\n * Options used on editor instantiation. Available options listed here:\n * https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.ieditoroptions.html\n */\n @Input('editorOptions')\n set editorOptions(editorOptions: any) {\n this._editorOptions = editorOptions;\n if (this._componentInitialized) {\n this._editor.updateOptions(editorOptions);\n this.editorConfigurationChanged.emit();\n }\n }\n get editorOptions(): any {\n return this._editorOptions;\n }\n\n /**\n * layout method that calls layout method of editor and instructs the editor to remeasure its container\n */\n layout(): void {\n if (this._componentInitialized) {\n this._editor.layout();\n }\n }\n\n /**\n * Returns if in Full Screen Mode or not\n */\n get isFullScreen(): boolean {\n return this._isFullScreen;\n }\n\n // tslint:disable-next-line:member-ordering\n constructor(private zone: NgZone, private _changeDetectorRef: ChangeDetectorRef, private _elementRef: ElementRef) {}\n\n ngOnInit(): void {\n const containerDiv: HTMLDivElement = this._editorContainer.nativeElement;\n containerDiv.id = this._editorInnerContainer;\n\n this._editor = monaco.editor.create(\n containerDiv,\n Object.assign(\n {\n value: this._value,\n language: this.language,\n theme: this._theme,\n },\n this.editorOptions,\n ),\n );\n this._componentInitialized = true;\n setTimeout(() => {\n this.applyLanguage();\n this._fromEditor = true;\n this.applyValue();\n this.applyStyle();\n this.editorInitialized.emit(this._editor);\n this.editorConfigurationChanged.emit();\n });\n // The `onDidChangeContent` returns a disposable object (an object with `dispose()` method) which will cleanup\n // the listener. The callback, that we pass to `onDidChangeContent`, captures `this`. This leads to a circular reference\n // (`td-code-editor -> monaco -> td-code-editor`) and prevents the `td-code-editor` from being GC'd.\n this._onDidChangeContentDisposable = this._editor.getModel().onDidChangeContent((e: any) => {\n this._fromEditor = true;\n this.writeValue(this._editor.getValue());\n this.layout();\n });\n this.addFullScreenModeCommand();\n\n merge(\n fromEvent(window, 'resize').pipe(debounceTime(100)),\n this._widthSubject.asObservable().pipe(distinctUntilChanged()),\n this._heightSubject.asObservable().pipe(distinctUntilChanged()),\n )\n .pipe(takeUntil(this._destroy), debounceTime(100))\n .subscribe(() => {\n this.layout();\n this._changeDetectorRef.markForCheck();\n });\n timer(500, 250)\n .pipe(takeUntil(this._destroy))\n .subscribe(() => {\n if (this._elementRef && this._elementRef.nativeElement) {\n this._widthSubject.next((<HTMLElement>this._elementRef.nativeElement).getBoundingClientRect().width);\n this._heightSubject.next((<HTMLElement>this._elementRef.nativeElement).getBoundingClientRect().height);\n }\n });\n }\n\n ngOnDestroy(): void {\n this._changeDetectorRef.detach();\n this._registeredLanguagesStyles.forEach((style: HTMLStyleElement) => style.remove());\n if (this._onDidChangeContentDisposable) {\n this._onDidChangeContentDisposable.dispose();\n this._onDidChangeContentDisposable = undefined;\n }\n if (this._editor) {\n this._editor.dispose();\n this._editor = undefined;\n }\n this._destroy.next(true);\n this._destroy.unsubscribe();\n }\n\n /**\n * showFullScreenEditor request for full screen of Code Editor based on its browser type.\n */\n public showFullScreenEditor(): void {\n if (this._componentInitialized) {\n const codeEditorElement: HTMLDivElement = this._editorContainer.nativeElement as HTMLDivElement;\n const fullScreenMap: object = {\n // Chrome\n requestFullscreen: () => codeEditorElement.requestFullscreen(),\n // Safari\n webkitRequestFullscreen: () => (<any>codeEditorElement).webkitRequestFullscreen(),\n // IE\n msRequestFullscreen: () => (<any>codeEditorElement).msRequestFullscreen(),\n // Firefox\n mozRequestFullScreen: () => (<any>codeEditorElement).mozRequestFullScreen(),\n };\n\n for (const handler of Object.keys(fullScreenMap)) {\n if (codeEditorElement[handler]) {\n fullScreenMap[handler]();\n }\n }\n }\n this._isFullScreen = true;\n }\n\n /**\n * exitFullScreenEditor request to exit full screen of Code Editor based on its browser type.\n */\n public exitFullScreenEditor(): void {\n if (this._componentInitialized) {\n const exitFullScreenMap: object = {\n // Chrome\n exitFullscreen: () => document.exitFullscreen(),\n // Safari\n webkitExitFullscreen: () => (<any>document).webkitExitFullscreen(),\n // Firefox\n mozCancelFullScreen: () => (<any>document).mozCancelFullScreen(),\n // IE\n msExitFullscreen: () => (<any>document).msExitFullscreen(),\n };\n\n for (const handler of Object.keys(exitFullScreenMap)) {\n if (document[handler]) {\n exitFullScreenMap[handler]();\n }\n }\n }\n this._isFullScreen = false;\n }\n\n /**\n * addFullScreenModeCommand used to add the fullscreen option to the context menu\n */\n private addFullScreenModeCommand(): void {\n this._editor.addAction({\n // An unique identifier of the contributed action.\n id: 'fullScreen',\n // A label of the action that will be presented to the user.\n label: 'Full Screen',\n // An optional array of keybindings for the action.\n contextMenuGroupId: 'navigation',\n keybindings: this._keycode,\n contextMenuOrder: 1.5,\n // Method that will be executed when the action is triggered.\n // @param editor The editor instance is passed in as a convinience\n run: (ed: any) => {\n this.showFullScreenEditor();\n },\n });\n }\n}\n","<div class=\"editor-container\" #editorContainer></div>\n","import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\n\nimport { TdCodeEditorComponent } from './code-editor.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [TdCodeEditorComponent],\n exports: [TdCodeEditorComponent],\n bootstrap: [TdCodeEditorComponent],\n})\nexport class CovalentCodeEditorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAqBA,MAAM,IAAI,GAAQ;;AAElB,CAAC,CAAC;AAEF;AACA,IAAI,aAAa,GAAW,CAAC,CAAC;MAcjB,qBAAqB;;IA0QhC,YAAoB,IAAY,EAAU,kBAAqC,EAAU,WAAuB;QAA5F,SAAI,GAAJ,IAAI,CAAQ;QAAU,uBAAkB,GAAlB,kBAAkB,CAAmB;QAAU,gBAAW,GAAX,WAAW,CAAY;QAzQxG,aAAQ,GAAqB,IAAI,OAAO,EAAW,CAAC;QACpD,kBAAa,GAAoB,IAAI,OAAO,EAAU,CAAC;QACvD,mBAAc,GAAoB,IAAI,OAAO,EAAU,CAAC;QAExD,iBAAY,GAAW,+CAA+C,CAAC;QACvE,WAAM,GAAW,EAAE,CAAC;QACpB,WAAM,GAAW,IAAI,CAAC;QACtB,cAAS,GAAW,YAAY,CAAC;QACjC,aAAQ,GAAoB,IAAI,OAAO,EAAE,CAAC;QAC1C,0BAAqB,GAAW,sBAAsB,GAAG,aAAa,EAAE,CAAC;QAEzE,gBAAW,GAAY,KAAK,CAAC;QAC7B,0BAAqB,GAAY,KAAK,CAAC;QACvC,mBAAc,GAAQ,EAAE,CAAC;QACzB,kBAAa,GAAY,KAAK,CAAC;QAE/B,+BAA0B,GAAuB,EAAE,CAAC;;;;;QASlD,sBAAiB,GACzB,IAAI,YAAY,EAAuC,CAAC;;;;;QAMhD,+BAA0B,GAAuB,IAAI,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qB;;ACTjC;;;;;;"}
1
+ {"version":3,"file":"covalent-code-editor.mjs","sources":["../../../../libs/angular-code-editor/src/lib/code-editor.component.ts","../../../../libs/angular-code-editor/src/lib/code-editor.component.html","../../../../libs/angular-code-editor/src/lib/code-editor.module.ts","../../../../libs/angular-code-editor/src/covalent-code-editor.ts"],"sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n OnInit,\n ViewChild,\n ElementRef,\n forwardRef,\n NgZone,\n ChangeDetectorRef,\n OnDestroy,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { Observable, of, Subject } from 'rxjs';\nimport { fromEvent, merge, timer } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';\n\n// Use esm version to support shipping subset of languages and features\nimport * as monaco from 'monaco-editor/esm/vs/editor/editor.api';\n\nconst noop = () => {\n // empty method\n};\n\n// counter for ids to allow for multiple editors on one page\nlet uniqueCounter = 0;\n\n@Component({\n selector: 'td-code-editor',\n templateUrl: './code-editor.component.html',\n styleUrls: ['./code-editor.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdCodeEditorComponent),\n multi: true,\n },\n ],\n})\nexport class TdCodeEditorComponent\n implements OnInit, ControlValueAccessor, OnDestroy\n{\n private _destroy: Subject<boolean> = new Subject<boolean>();\n private _widthSubject: Subject<number> = new Subject<number>();\n private _heightSubject: Subject<number> = new Subject<number>();\n\n private _editorStyle = 'width:100%;height:100%;border:1px solid grey;';\n private _value = '';\n private _theme = 'vs';\n private _language = 'javascript';\n private _subject: Subject<string> = new Subject();\n private _editorInnerContainer: string =\n 'editorInnerContainer' + uniqueCounter++;\n private _editor!: monaco.editor.IStandaloneCodeEditor;\n private _fromEditor = false;\n private _componentInitialized = false;\n private _editorOptions: any = {};\n private _isFullScreen = false;\n private _keycode: any;\n private _registeredLanguagesStyles: HTMLStyleElement[] = [];\n private _onDidChangeContentDisposable?: monaco.IDisposable;\n\n @ViewChild('editorContainer', { static: true }) _editorContainer!: ElementRef;\n\n /**\n * editorInitialized: function($event)\n * Event emitted when editor is first initialized\n */\n @Output()\n editorInitialized: EventEmitter<monaco.editor.IStandaloneCodeEditor> = new EventEmitter<monaco.editor.IStandaloneCodeEditor>();\n\n /**\n * editorConfigurationChanged: function($event)\n * Event emitted when editor's configuration changes\n */\n @Output() editorConfigurationChanged: EventEmitter<void> =\n new EventEmitter<void>();\n\n /**\n * editorLanguageChanged: function($event)\n * Event emitted when editor's Language changes\n */\n @Output() editorLanguageChanged: EventEmitter<void> =\n new EventEmitter<void>();\n\n /**\n * editorValueChange: function($event)\n * Event emitted any time something changes the editor value\n */\n @Output() editorValueChange: EventEmitter<void> = new EventEmitter<void>();\n\n propagateChange = () => noop;\n onTouched = () => noop;\n\n /**\n * value?: string\n */\n @Input()\n set value(value: string) {\n this._value = value;\n if (this._componentInitialized) {\n this.applyValue();\n }\n }\n get value(): string {\n return this._value;\n }\n\n applyValue(): void {\n if (!this._fromEditor) {\n this._editor.setValue(this._value);\n }\n this._fromEditor = false;\n this.editorValueChange.emit();\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n writeValue(value: any): void {\n // do not write if null or undefined\n // tslint:disable-next-line\n if (value != undefined) {\n this.value = value;\n }\n }\n registerOnChange(fn: any): void {\n this.propagateChange = fn;\n }\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n /**\n * getEditorContent?: function\n * Returns the content within the editor\n */\n getValue(): Observable<string> {\n if (!this._componentInitialized) {\n return of('');\n }\n setTimeout(() => {\n this._subject.next(this._value);\n this._subject.complete();\n this._subject = new Subject();\n });\n return this._subject.asObservable();\n }\n\n /**\n * language?: string\n * language used in editor\n */\n @Input()\n set language(language: string) {\n this._language = language;\n if (this._componentInitialized) {\n this.applyLanguage();\n }\n }\n\n get language(): string {\n return this._language;\n }\n\n applyLanguage(): void {\n if (this._language) {\n monaco.editor.setModelLanguage(\n this._editor.getModel() as monaco.editor.ITextModel,\n this._language\n );\n this.editorLanguageChanged.emit();\n }\n }\n\n /**\n * registerLanguage?: function\n * Registers a custom Language within the editor\n */\n registerLanguage(language: any): void {\n if (this._componentInitialized) {\n monaco.languages.register({ id: language.id });\n\n monaco.languages.setMonarchTokensProvider(language.id, {\n tokenizer: {\n root: language.monarchTokensProvider,\n },\n });\n\n // Define a new theme that constains only rules that match this language\n monaco.editor.defineTheme(\n language.customTheme.id,\n language.customTheme.theme\n );\n this._theme = language.customTheme.id;\n\n monaco.languages.registerCompletionItemProvider(language.id, {\n provideCompletionItems: () => {\n return language.completionItemProvider;\n },\n });\n\n const css: HTMLStyleElement = document.createElement('style');\n css.type = 'text/css';\n css.innerHTML = language.monarchTokensProviderCSS;\n document.body.appendChild(css);\n this.editorConfigurationChanged.emit();\n this._registeredLanguagesStyles = [\n ...this._registeredLanguagesStyles,\n css,\n ];\n }\n }\n\n /**\n * style?: string\n * css style of the editor on the page\n */\n @Input()\n set editorStyle(editorStyle: string) {\n this._editorStyle = editorStyle;\n if (this._componentInitialized) {\n this.applyStyle();\n }\n }\n\n get editorStyle(): string {\n return this._editorStyle;\n }\n\n applyStyle(): void {\n if (this._editorStyle) {\n const containerDiv: HTMLDivElement = this._editorContainer.nativeElement;\n containerDiv.setAttribute('style', this._editorStyle);\n }\n }\n\n /**\n * theme?: string\n * Theme to be applied to editor\n */\n @Input()\n set theme(theme: string) {\n this._theme = theme;\n if (this._componentInitialized) {\n this._editor.updateOptions({ theme });\n this.editorConfigurationChanged.emit();\n }\n }\n get theme(): string {\n return this._theme;\n }\n\n /**\n * fullScreenKeyBinding?: number\n * See here for key bindings https://microsoft.github.io/monaco-editor/api/enums/monaco.keycode.html\n * Sets the KeyCode for shortcutting to Fullscreen mode\n */\n @Input()\n set fullScreenKeyBinding(keycode: number[]) {\n this._keycode = keycode;\n }\n get fullScreenKeyBinding(): number[] {\n return this._keycode;\n }\n\n /**\n * editorOptions?: object\n * Options used on editor instantiation. Available options listed here:\n * https://microsoft.github.io/monaco-editor/api/interfaces/editor.ieditoroptions.html\n */\n @Input()\n set editorOptions(editorOptions: any) {\n this._editorOptions = editorOptions;\n if (this._componentInitialized) {\n this._editor.updateOptions(editorOptions);\n this.editorConfigurationChanged.emit();\n }\n }\n get editorOptions(): any {\n return this._editorOptions;\n }\n\n /**\n * layout method that calls layout method of editor and instructs the editor to remeasure its container\n */\n layout(): void {\n if (this._componentInitialized) {\n this._editor.layout();\n }\n }\n\n /**\n * Returns if in Full Screen Mode or not\n */\n get isFullScreen(): boolean {\n return this._isFullScreen;\n }\n\n // tslint:disable-next-line:member-ordering\n constructor(\n private zone: NgZone,\n private _changeDetectorRef: ChangeDetectorRef,\n private _elementRef: ElementRef\n ) {}\n\n ngOnInit(): void {\n const containerDiv: HTMLDivElement = this._editorContainer.nativeElement;\n containerDiv.id = this._editorInnerContainer;\n\n this._editor = monaco.editor.create(\n containerDiv,\n Object.assign(\n {\n value: this._value,\n language: this.language,\n theme: this._theme,\n },\n this.editorOptions\n )\n );\n this._componentInitialized = true;\n setTimeout(() => {\n this.applyLanguage();\n this._fromEditor = true;\n this.applyValue();\n this.applyStyle();\n this.editorInitialized.emit(this._editor);\n this.editorConfigurationChanged.emit();\n });\n // The `onDidChangeContent` returns a disposable object (an object with `dispose()` method) which will cleanup\n // the listener. The callback, that we pass to `onDidChangeContent`, captures `this`. This leads to a circular reference\n // (`td-code-editor -> monaco -> td-code-editor`) and prevents the `td-code-editor` from being GC'd.\n this._onDidChangeContentDisposable = this._editor\n .getModel()\n ?.onDidChangeContent(() => {\n this._fromEditor = true;\n this.writeValue(this._editor.getValue());\n this.layout();\n });\n this.addFullScreenModeCommand();\n\n merge(\n fromEvent(window, 'resize').pipe(debounceTime(100)),\n this._widthSubject.asObservable().pipe(distinctUntilChanged()),\n this._heightSubject.asObservable().pipe(distinctUntilChanged())\n )\n .pipe(takeUntil(this._destroy), debounceTime(100))\n .subscribe(() => {\n this.layout();\n this._changeDetectorRef.markForCheck();\n });\n timer(500, 250)\n .pipe(takeUntil(this._destroy))\n .subscribe(() => {\n if (this._elementRef && this._elementRef.nativeElement) {\n this._widthSubject.next(\n (<HTMLElement>(\n this._elementRef.nativeElement\n )).getBoundingClientRect().width\n );\n this._heightSubject.next(\n (<HTMLElement>(\n this._elementRef.nativeElement\n )).getBoundingClientRect().height\n );\n }\n });\n }\n\n ngOnDestroy(): void {\n this._changeDetectorRef.detach();\n this._registeredLanguagesStyles.forEach((style: HTMLStyleElement) =>\n style.remove()\n );\n if (this._onDidChangeContentDisposable) {\n this._onDidChangeContentDisposable.dispose();\n this._onDidChangeContentDisposable = undefined;\n }\n if (this._editor) {\n this._editor.dispose();\n }\n this._destroy.next(true);\n this._destroy.unsubscribe();\n }\n\n /**\n * showFullScreenEditor request for full screen of Code Editor based on its browser type.\n */\n public showFullScreenEditor(): void {\n if (this._componentInitialized) {\n const codeEditorElement: HTMLDivElement = this._editorContainer\n .nativeElement as HTMLDivElement;\n codeEditorElement.requestFullscreen();\n }\n this._isFullScreen = true;\n }\n\n /**\n * exitFullScreenEditor request to exit full screen of Code Editor based on its browser type.\n */\n public exitFullScreenEditor(): void {\n if (this._componentInitialized) {\n document.exitFullscreen();\n }\n this._isFullScreen = false;\n }\n\n /**\n * addFullScreenModeCommand used to add the fullscreen option to the context menu\n */\n private addFullScreenModeCommand(): void {\n this._editor.addAction({\n // An unique identifier of the contributed action.\n id: 'fullScreen',\n // A label of the action that will be presented to the user.\n label: 'Full Screen',\n // An optional array of keybindings for the action.\n contextMenuGroupId: 'navigation',\n keybindings: this._keycode,\n contextMenuOrder: 1.5,\n // Method that will be executed when the action is triggered.\n run: () => {\n this.showFullScreenEditor();\n },\n });\n }\n}\n","<div class=\"editor-container\" #editorContainer></div>\n","import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\n\nimport { TdCodeEditorComponent } from './code-editor.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [TdCodeEditorComponent],\n exports: [TdCodeEditorComponent],\n bootstrap: [TdCodeEditorComponent],\n})\nexport class CovalentCodeEditorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AAqBA,MAAM,IAAI,GAAG;;AAEb,CAAC,CAAC;AAEF;AACA,IAAI,aAAa,GAAG,CAAC,CAAC;MAcT,qBAAqB;;IAqQhC,YACU,IAAY,EACZ,kBAAqC,EACrC,WAAuB;QAFvB,SAAI,GAAJ,IAAI,CAAQ;QACZ,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,gBAAW,GAAX,WAAW,CAAY;QArQzB,aAAQ,GAAqB,IAAI,OAAO,EAAW,CAAC;QACpD,kBAAa,GAAoB,IAAI,OAAO,EAAU,CAAC;QACvD,mBAAc,GAAoB,IAAI,OAAO,EAAU,CAAC;QAExD,iBAAY,GAAG,+CAA+C,CAAC;QAC/D,WAAM,GAAG,EAAE,CAAC;QACZ,WAAM,GAAG,IAAI,CAAC;QACd,cAAS,GAAG,YAAY,CAAC;QACzB,aAAQ,GAAoB,IAAI,OAAO,EAAE,CAAC;QAC1C,0BAAqB,GAC3B,sBAAsB,GAAG,aAAa,EAAE,CAAC;QAEnC,gBAAW,GAAG,KAAK,CAAC;QACpB,0BAAqB,GAAG,KAAK,CAAC;QAC9B,mBAAc,GAAQ,EAAE,CAAC;QACzB,kBAAa,GAAG,KAAK,CAAC;QAEtB,+BAA0B,GAAuB,EAAE,CAAC;;;;;QAU5D,sBAAiB,GAAsD,IAAI,YAAY,EAAuC,CAAC;;;;;QAMrH,+BAA0B,GAClC,IAAI,YAAY,EAAQ,CAAC;;;;;QAMjB,0BAAqB,GAC7B,IAAI,YAAY,EAAQ,CAAC;;;;;QAMjB,sBAAiB,GAAuB,IAAI,YAAY,EAAQ,CAAC;QAE3E,oBAAe,GAAG,MAAM,IAAI,CAAC;QAC7B,cAAS,GAAG,MAAM,IAAI,CAAC;KAoNnB;;;;IA/MJ,IACI,KAAK,CA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,CAAC,2BAA2B,CAAC;4BACpD,KAAK,EAAE,IAAI;yBACZ;qBACF;sJAyB+C,gBAAgB;sBAA/D,SAAS;uBAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;gBAO9C,iBAAiB;sBADhB,MAAM;gBAOG,0BAA0B;sBAAnC,MAAM;gBAOG,qBAAqB;sBAA9B,MAAM;gBAOG,iBAAiB;sBAA1B,MAAM;gBASH,KAAK;sBADR,KAAK;gBAyDF,QAAQ;sBADX,KAAK;gBAkEF,WAAW;sBADd,KAAK;gBAwBF,KAAK;sBADR,KAAK;gBAkBF,oBAAoB;sBADvB,KAAK;gBAcF,aAAa;sBADhB,KAAK;;;MEpQK,wBAAwB;;qHAAxB,wBAAwB;sHAAxB,wBAAwB,cAFvB,qBAAqB,kBAFlB,qBAAqB,aAD1B,YAAY,aAEZ,qBAAqB;sHAGpB,wBAAwB,YAL1B,CAAC,YAAY,CAAC;2FAKZ,wBAAwB;kBANpC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;oBAChC,SAAS,EAAE,CAAC,qBAAqB,CAAC;iBACnC;;;ACXD;;;;;;"}
@@ -45,13 +45,8 @@ export declare class TdCodeEditorComponent implements OnInit, ControlValueAccess
45
45
  * Event emitted any time something changes the editor value
46
46
  */
47
47
  editorValueChange: EventEmitter<void>;
48
- /**
49
- * The change event notifies you about a change happening in an input field.
50
- * Since the component is not a native Angular component have to specifiy the event emitter ourself
51
- */
52
- change: EventEmitter<void>;
53
- propagateChange: (_: any) => void;
54
- onTouched: () => any;
48
+ propagateChange: () => () => void;
49
+ onTouched: () => () => void;
55
50
  /**
56
51
  * value?: string
57
52
  */
@@ -104,7 +99,7 @@ export declare class TdCodeEditorComponent implements OnInit, ControlValueAccess
104
99
  /**
105
100
  * editorOptions?: object
106
101
  * Options used on editor instantiation. Available options listed here:
107
- * https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.ieditoroptions.html
102
+ * https://microsoft.github.io/monaco-editor/api/interfaces/editor.ieditoroptions.html
108
103
  */
109
104
  set editorOptions(editorOptions: any);
110
105
  get editorOptions(): any;
@@ -132,5 +127,5 @@ export declare class TdCodeEditorComponent implements OnInit, ControlValueAccess
132
127
  */
133
128
  private addFullScreenModeCommand;
134
129
  static ɵfac: i0.ɵɵFactoryDeclaration<TdCodeEditorComponent, never>;
135
- static ɵcmp: i0.ɵɵComponentDeclaration<TdCodeEditorComponent, "td-code-editor", never, { "value": "value"; "language": "language"; "editorStyle": "editorStyle"; "theme": "theme"; "fullScreenKeyBinding": "fullScreenKeyBinding"; "editorOptions": "editorOptions"; }, { "editorInitialized": "editorInitialized"; "editorConfigurationChanged": "editorConfigurationChanged"; "editorLanguageChanged": "editorLanguageChanged"; "editorValueChange": "editorValueChange"; "change": "change"; }, never, never>;
130
+ static ɵcmp: i0.ɵɵComponentDeclaration<TdCodeEditorComponent, "td-code-editor", never, { "value": "value"; "language": "language"; "editorStyle": "editorStyle"; "theme": "theme"; "fullScreenKeyBinding": "fullScreenKeyBinding"; "editorOptions": "editorOptions"; }, { "editorInitialized": "editorInitialized"; "editorConfigurationChanged": "editorConfigurationChanged"; "editorLanguageChanged": "editorLanguageChanged"; "editorValueChange": "editorValueChange"; }, never, never>;
136
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@covalent/code-editor",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.1.1-next.1",
4
4
  "description": "Teradata UI Platform Code Editor Module",
5
5
  "keywords": [
6
6
  "angular",
@@ -12,28 +12,17 @@
12
12
  "electron",
13
13
  "reusable"
14
14
  ],
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/teradata/covalent.git"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/Teradata/covalent/issues"
21
- },
22
- "license": "MIT",
23
- "author": "Teradata UX",
24
- "contributors": [
25
- "Kyle Ledbetter <kyle.ledbetter@teradata.com>",
26
- "Richa Vyas <richa.vyas@teradata.com>",
27
- "Ed Morales <eduardo.morales@teradata.com>",
28
- "Jason Weaver <jason.weaver@teradata.com>",
29
- "Jeremy Wilken <jeremy.wilken@teradata.com>",
30
- "Jeremy Smartt <jeremy.smartt@teradata.com>",
31
- "Steven Ov <steven.ov@teradata.com>"
32
- ],
33
15
  "peerDependencies": {
34
- "monaco-editor": "^0.22.0",
35
- "@angular/common": "^12.0.0-0 || ^13.0.0-0",
36
- "@angular/core": "^12.0.0-0 || ^13.0.0-0"
16
+ "@angular/common": "^13.2.0",
17
+ "@angular/core": "^13.2.0",
18
+ "monaco-editor": "^0.32.1",
19
+ "@angular/forms": "~13.2.0",
20
+ "rxjs": "~7.4.0",
21
+ "zone.js": "~0.11.4",
22
+ "@angular/platform-browser-dynamic": "~13.2.0"
23
+ },
24
+ "dependencies": {
25
+ "tslib": "^2.3.0"
37
26
  },
38
27
  "module": "fesm2015/covalent-code-editor.mjs",
39
28
  "es2020": "fesm2020/covalent-code-editor.mjs",
@@ -54,11 +43,5 @@
54
43
  "default": "./fesm2020/covalent-code-editor.mjs"
55
44
  }
56
45
  },
57
- "sideEffects": false,
58
- "dependencies": {
59
- "tslib": "^2.3.0"
60
- },
61
- "scripts": {
62
- "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\n')\" && exit 1"
63
- }
64
- }
46
+ "sideEffects": false
47
+ }
@@ -0,0 +1,2 @@
1
+ export { TdCodeEditorComponent } from './lib/code-editor.component';
2
+ export { CovalentCodeEditorModule } from './lib/code-editor.module';
@@ -1,19 +0,0 @@
1
- :host {
2
- display: block;
3
- position: relative;
4
-
5
- .editor-container {
6
- position: absolute;
7
- top: 0;
8
- bottom: 0;
9
- left: 0;
10
- right: 0;
11
- }
12
- }
13
-
14
- ::ng-deep {
15
- // hide this part of monaco so it doesnt add height
16
- .monaco-aria-container {
17
- display: none;
18
- }
19
- }