@covalent/code-editor 6.4.0 → 6.4.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.
@@ -0,0 +1,393 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, PLATFORM_ID, forwardRef, Component, Inject, ViewChild, Output, Input, NgModule } from '@angular/core';
3
+ import { isPlatformServer, CommonModule } from '@angular/common';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { of, Subject, merge, fromEvent, timer } from 'rxjs';
6
+ import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
7
+ import { editor, languages } from 'monaco-editor';
8
+ import { mixinControlValueAccessor, mixinDisabled } from '@covalent/core/common';
9
+
10
+ const noop = () => {
11
+ // empty method
12
+ };
13
+ // counter for ids to allow for multiple editors on one page
14
+ let uniqueCounter = 0;
15
+ class TdCodeEditorBase {
16
+ constructor(_changeDetectorRef) {
17
+ this._changeDetectorRef = _changeDetectorRef;
18
+ }
19
+ }
20
+ const _TdCodeEditorMixinBase = mixinControlValueAccessor(mixinDisabled(TdCodeEditorBase), []);
21
+ class TdCodeEditorComponent extends _TdCodeEditorMixinBase {
22
+ /**
23
+ * value?: string
24
+ */
25
+ set value(value) {
26
+ this._value = value;
27
+ if (this._componentInitialized) {
28
+ this.applyValue();
29
+ }
30
+ }
31
+ get value() {
32
+ return this._value;
33
+ }
34
+ applyValue() {
35
+ if (!this._fromEditor) {
36
+ this._editor.setValue(this._value);
37
+ }
38
+ this._fromEditor = false;
39
+ this.propagateChange(this._value);
40
+ this.editorValueChange.emit();
41
+ }
42
+ registerOnChange(fn) {
43
+ this.propagateChange = fn;
44
+ }
45
+ registerOnTouched(fn) {
46
+ this.onTouched = fn;
47
+ }
48
+ /**
49
+ * getEditorContent?: function
50
+ * Returns the content within the editor
51
+ */
52
+ getValue() {
53
+ if (!this._componentInitialized) {
54
+ return of('');
55
+ }
56
+ setTimeout(() => {
57
+ this._subject.next(this._value);
58
+ this._subject.complete();
59
+ this._subject = new Subject();
60
+ });
61
+ return this._subject.asObservable();
62
+ }
63
+ /**
64
+ * language?: string
65
+ * language used in editor
66
+ */
67
+ set language(language) {
68
+ this._language = language;
69
+ if (this._componentInitialized) {
70
+ this.applyLanguage();
71
+ }
72
+ }
73
+ get language() {
74
+ return this._language;
75
+ }
76
+ applyLanguage() {
77
+ if (this._language) {
78
+ editor.setModelLanguage(this._editor.getModel(), this._language);
79
+ this.editorLanguageChanged.emit();
80
+ }
81
+ }
82
+ /**
83
+ * registerLanguage?: function
84
+ * Registers a custom Language within the editor
85
+ */
86
+ registerLanguage(language) {
87
+ if (this._componentInitialized) {
88
+ languages.register({ id: language.id });
89
+ this._disposables.push(languages.setMonarchTokensProvider(language.id, {
90
+ tokenizer: {
91
+ root: language.monarchTokensProvider,
92
+ },
93
+ }));
94
+ // Define a new theme that constains only rules that match this language
95
+ editor.defineTheme(language.customTheme.id, language.customTheme.theme);
96
+ this._theme = language.customTheme.id;
97
+ this._disposables.push(languages.registerCompletionItemProvider(language.id, {
98
+ provideCompletionItems: () => {
99
+ return language.completionItemProvider;
100
+ },
101
+ }));
102
+ const css = document.createElement('style');
103
+ css.type = 'text/css';
104
+ css.innerHTML = language.monarchTokensProviderCSS;
105
+ document.body.appendChild(css);
106
+ this.editorConfigurationChanged.emit();
107
+ this._registeredLanguagesStyles = [
108
+ ...this._registeredLanguagesStyles,
109
+ css,
110
+ ];
111
+ }
112
+ }
113
+ /**
114
+ * style?: string
115
+ * css style of the editor on the page
116
+ */
117
+ set editorStyle(editorStyle) {
118
+ this._editorStyle = editorStyle;
119
+ if (this._componentInitialized) {
120
+ this.applyStyle();
121
+ }
122
+ }
123
+ get editorStyle() {
124
+ return this._editorStyle;
125
+ }
126
+ applyStyle() {
127
+ if (this._editorStyle) {
128
+ const containerDiv = this._editorContainer.nativeElement;
129
+ containerDiv.setAttribute('style', this._editorStyle);
130
+ }
131
+ }
132
+ /**
133
+ * theme?: string
134
+ * Theme to be applied to editor
135
+ */
136
+ set theme(theme) {
137
+ this._theme = theme;
138
+ if (this._componentInitialized) {
139
+ this._editor.updateOptions({ theme });
140
+ this.editorConfigurationChanged.emit();
141
+ }
142
+ }
143
+ get theme() {
144
+ return this._theme;
145
+ }
146
+ /**
147
+ * fullScreenKeyBinding?: number
148
+ * See here for key bindings https://microsoft.github.io/monaco-editor/api/enums/keycode.html
149
+ * Sets the KeyCode for shortcutting to Fullscreen mode
150
+ */
151
+ set fullScreenKeyBinding(keycode) {
152
+ this._keycode = keycode;
153
+ }
154
+ get fullScreenKeyBinding() {
155
+ return this._keycode;
156
+ }
157
+ /**
158
+ * editorOptions?: object
159
+ * Options used on editor instantiation. Available options listed here:
160
+ * https://microsoft.github.io/monaco-editor/api/interfaces/editor.ieditoroptions.html
161
+ */
162
+ set editorOptions(editorOptions) {
163
+ this._editorOptions = editorOptions;
164
+ if (this._componentInitialized) {
165
+ this._editor.updateOptions(editorOptions);
166
+ this.editorConfigurationChanged.emit();
167
+ }
168
+ }
169
+ get editorOptions() {
170
+ return this._editorOptions;
171
+ }
172
+ /**
173
+ * layout method that calls layout method of editor and instructs the editor to remeasure its container
174
+ */
175
+ layout() {
176
+ if (this._componentInitialized) {
177
+ this._editor.layout();
178
+ }
179
+ }
180
+ /**
181
+ * Returns if in Full Screen Mode or not
182
+ */
183
+ get isFullScreen() {
184
+ return this._isFullScreen;
185
+ }
186
+ // tslint:disable-next-line:member-ordering
187
+ constructor(_changeDetectorRef, _elementRef, _ngZone, platformId) {
188
+ super(_changeDetectorRef);
189
+ this._elementRef = _elementRef;
190
+ this._ngZone = _ngZone;
191
+ this.platformId = platformId;
192
+ this._destroy = new Subject();
193
+ this._widthSubject = new Subject();
194
+ this._heightSubject = new Subject();
195
+ this._editorStyle = 'width:100%;height:100%;';
196
+ this._value = '';
197
+ this._theme = 'vs';
198
+ this._language = 'javascript';
199
+ this._subject = new Subject();
200
+ this._editorInnerContainer = 'editorInnerContainer' + uniqueCounter++;
201
+ this._fromEditor = false;
202
+ this._componentInitialized = false;
203
+ this._editorOptions = {};
204
+ this._isFullScreen = false;
205
+ this._registeredLanguagesStyles = [];
206
+ this._disposables = [];
207
+ /**
208
+ * editorInitialized: function($event)
209
+ * Event emitted when editor is first initialized
210
+ */
211
+ this.editorInitialized = new EventEmitter();
212
+ /**
213
+ * editorConfigurationChanged: function($event)
214
+ * Event emitted when editor's configuration changes
215
+ */
216
+ this.editorConfigurationChanged = new EventEmitter();
217
+ /**
218
+ * editorLanguageChanged: function($event)
219
+ * Event emitted when editor's Language changes
220
+ */
221
+ this.editorLanguageChanged = new EventEmitter();
222
+ /**
223
+ * editorValueChange: function($event)
224
+ * Event emitted any time something changes the editor value
225
+ */
226
+ this.editorValueChange = new EventEmitter();
227
+ this.propagateChange = (_) => noop;
228
+ }
229
+ ngOnInit() {
230
+ if (isPlatformServer(this.platformId)) {
231
+ return;
232
+ }
233
+ const containerDiv = this._editorContainer.nativeElement;
234
+ containerDiv.id = this._editorInnerContainer;
235
+ this._editor = editor.create(containerDiv, Object.assign({
236
+ value: this._value,
237
+ language: this.language,
238
+ theme: this._theme,
239
+ }, this.editorOptions));
240
+ this._componentInitialized = true;
241
+ setTimeout(() => {
242
+ this.applyLanguage();
243
+ this._fromEditor = true;
244
+ this.applyValue();
245
+ this.applyStyle();
246
+ this.editorInitialized.emit(this._editor);
247
+ this.editorConfigurationChanged.emit();
248
+ });
249
+ // The `onDidChangeContent` returns a disposable object (an object with `dispose()` method) which will cleanup
250
+ // the listener. The callback, that we pass to `onDidChangeContent`, captures `this`. This leads to a circular reference
251
+ // (`td-code-editor -> monaco -> td-code-editor`) and prevents the `td-code-editor` from being GC'd.
252
+ this._disposables.push(this._editor.getModel().onDidChangeContent(() => {
253
+ this._fromEditor = true;
254
+ this.writeValue(this._editor.getValue());
255
+ this.layout();
256
+ }));
257
+ this.addFullScreenModeCommand();
258
+ this._ngZone.runOutsideAngular(() => merge(fromEvent(window, 'resize').pipe(debounceTime(100)), this._widthSubject.asObservable().pipe(distinctUntilChanged()), this._heightSubject.asObservable().pipe(distinctUntilChanged()))
259
+ .pipe(debounceTime(100), takeUntil(this._destroy))
260
+ .subscribe(() => {
261
+ // Note: this is being called outside of the Angular zone since we don't have to
262
+ // run change detection whenever the editor resizes itself.
263
+ this.layout();
264
+ }));
265
+ this._ngZone.runOutsideAngular(() => timer(500, 250)
266
+ .pipe(takeUntil(this._destroy))
267
+ .subscribe(() => {
268
+ const { width, height } = this._elementRef.nativeElement.getBoundingClientRect();
269
+ this._widthSubject.next(width);
270
+ this._heightSubject.next(height);
271
+ }));
272
+ }
273
+ ngOnDestroy() {
274
+ var _a;
275
+ this._changeDetectorRef.detach();
276
+ this._registeredLanguagesStyles.forEach((style) => style.remove());
277
+ while (this._disposables.length) {
278
+ (_a = this._disposables.pop()) === null || _a === void 0 ? void 0 : _a.dispose();
279
+ }
280
+ if (this._editor) {
281
+ this._editor.dispose();
282
+ }
283
+ this._destroy.next(true);
284
+ this._destroy.unsubscribe();
285
+ }
286
+ /**
287
+ * showFullScreenEditor request for full screen of Code Editor based on its browser type.
288
+ */
289
+ showFullScreenEditor() {
290
+ if (this._componentInitialized) {
291
+ const codeEditorElement = this._editorContainer
292
+ .nativeElement;
293
+ codeEditorElement.requestFullscreen();
294
+ }
295
+ this._isFullScreen = true;
296
+ }
297
+ /**
298
+ * exitFullScreenEditor request to exit full screen of Code Editor based on its browser type.
299
+ */
300
+ exitFullScreenEditor() {
301
+ if (this._componentInitialized) {
302
+ document.exitFullscreen();
303
+ }
304
+ this._isFullScreen = false;
305
+ }
306
+ /**
307
+ * addFullScreenModeCommand used to add the fullscreen option to the context menu
308
+ */
309
+ addFullScreenModeCommand() {
310
+ this._disposables.push(this._editor.addAction({
311
+ // An unique identifier of the contributed action.
312
+ id: 'fullScreen',
313
+ // A label of the action that will be presented to the user.
314
+ label: 'Full Screen',
315
+ // An optional array of keybindings for the action.
316
+ contextMenuGroupId: 'navigation',
317
+ keybindings: this._keycode,
318
+ contextMenuOrder: 1.5,
319
+ // Method that will be executed when the action is triggered.
320
+ run: () => {
321
+ this.showFullScreenEditor();
322
+ },
323
+ }));
324
+ }
325
+ }
326
+ TdCodeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdCodeEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
327
+ TdCodeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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 }], usesInheritance: true, ngImport: i0, template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;inset:0}::ng-deep .monaco-aria-container{display:none}\n"] });
334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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;inset:0}::ng-deep .monaco-aria-container{display:none}\n"] }]
343
+ }], ctorParameters: function () {
344
+ return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
345
+ type: Inject,
346
+ args: [PLATFORM_ID]
347
+ }] }];
348
+ }, propDecorators: { _editorContainer: [{
349
+ type: ViewChild,
350
+ args: ['editorContainer', { static: true }]
351
+ }], editorInitialized: [{
352
+ type: Output
353
+ }], editorConfigurationChanged: [{
354
+ type: Output
355
+ }], editorLanguageChanged: [{
356
+ type: Output
357
+ }], editorValueChange: [{
358
+ type: Output
359
+ }], value: [{
360
+ type: Input
361
+ }], language: [{
362
+ type: Input
363
+ }], editorStyle: [{
364
+ type: Input
365
+ }], theme: [{
366
+ type: Input
367
+ }], fullScreenKeyBinding: [{
368
+ type: Input
369
+ }], editorOptions: [{
370
+ type: Input
371
+ }] } });
372
+
373
+ class CovalentCodeEditorModule {
374
+ }
375
+ CovalentCodeEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
376
+ CovalentCodeEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, bootstrap: [TdCodeEditorComponent], declarations: [TdCodeEditorComponent], imports: [CommonModule], exports: [TdCodeEditorComponent] });
377
+ CovalentCodeEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, imports: [CommonModule] });
378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, decorators: [{
379
+ type: NgModule,
380
+ args: [{
381
+ imports: [CommonModule],
382
+ declarations: [TdCodeEditorComponent],
383
+ exports: [TdCodeEditorComponent],
384
+ bootstrap: [TdCodeEditorComponent],
385
+ }]
386
+ }] });
387
+
388
+ /**
389
+ * Generated bundle index. Do not edit.
390
+ */
391
+
392
+ export { CovalentCodeEditorModule, TdCodeEditorComponent };
393
+ //# sourceMappingURL=covalent-code-editor.mjs.map
@@ -0,0 +1 @@
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 ChangeDetectorRef,\n OnDestroy,\n NgZone,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\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 { editor, languages, IDisposable } from 'monaco-editor';\n\nimport {\n mixinControlValueAccessor,\n mixinDisabled,\n} from '@covalent/core/common';\n\nconst noop = () => {\n // empty method\n};\n\n// counter for ids to allow for multiple editors on one page\nlet uniqueCounter = 0;\n\nexport class TdCodeEditorBase {\n constructor(public _changeDetectorRef: ChangeDetectorRef) {}\n}\n\nexport const _TdCodeEditorMixinBase = mixinControlValueAccessor(\n mixinDisabled(TdCodeEditorBase),\n []\n);\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 extends _TdCodeEditorMixinBase\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%;';\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!: 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 _disposables: 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<editor.IStandaloneCodeEditor> =\n new EventEmitter<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 = (_: any) => noop;\n\n /**\n * value?: string\n */\n @Input()\n override set value(value: string) {\n this._value = value;\n\n if (this._componentInitialized) {\n this.applyValue();\n }\n }\n override 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.editorValueChange.emit();\n }\n\n override registerOnChange(fn: any): void {\n this.propagateChange = fn;\n }\n override 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 editor.setModelLanguage(\n this._editor.getModel() as 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 languages.register({ id: language.id });\n\n this._disposables.push(\n languages.setMonarchTokensProvider(language.id, {\n tokenizer: {\n root: language.monarchTokensProvider,\n },\n })\n );\n\n // Define a new theme that constains only rules that match this language\n editor.defineTheme(language.customTheme.id, language.customTheme.theme);\n this._theme = language.customTheme.id;\n\n this._disposables.push(\n languages.registerCompletionItemProvider(language.id, {\n provideCompletionItems: () => {\n return language.completionItemProvider;\n },\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/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 _changeDetectorRef: ChangeDetectorRef,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone,\n @Inject(PLATFORM_ID) private platformId: string\n ) {\n super(_changeDetectorRef);\n }\n\n ngOnInit(): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n const containerDiv: HTMLDivElement = this._editorContainer.nativeElement;\n containerDiv.id = this._editorInnerContainer;\n\n this._editor = 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._disposables.push(\n (this._editor.getModel() as editor.ITextModel).onDidChangeContent(() => {\n this._fromEditor = true;\n this.writeValue(this._editor.getValue());\n this.layout();\n })\n );\n this.addFullScreenModeCommand();\n\n this._ngZone.runOutsideAngular(() =>\n merge(\n fromEvent(window, 'resize').pipe(debounceTime(100)),\n this._widthSubject.asObservable().pipe(distinctUntilChanged()),\n this._heightSubject.asObservable().pipe(distinctUntilChanged())\n )\n .pipe(debounceTime(100), takeUntil(this._destroy))\n .subscribe(() => {\n // Note: this is being called outside of the Angular zone since we don't have to\n // run change detection whenever the editor resizes itself.\n this.layout();\n })\n );\n this._ngZone.runOutsideAngular(() =>\n timer(500, 250)\n .pipe(takeUntil(this._destroy))\n .subscribe(() => {\n const { width, height } =\n this._elementRef.nativeElement.getBoundingClientRect();\n this._widthSubject.next(width);\n this._heightSubject.next(height);\n })\n );\n }\n\n ngOnDestroy(): void {\n this._changeDetectorRef.detach();\n this._registeredLanguagesStyles.forEach((style: HTMLStyleElement) =>\n style.remove()\n );\n while (this._disposables.length) {\n this._disposables.pop()?.dispose();\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._disposables.push(\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}\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":";;;;;;;;;AA6BA,MAAM,IAAI,GAAG,MAAK;;AAElB,CAAC,CAAC;AAEF;AACA,IAAI,aAAa,GAAG,CAAC,CAAC;MAET,gBAAgB,CAAA;AAC3B,IAAA,WAAA,CAAmB,kBAAqC,EAAA;AAArC,QAAA,IAAkB,CAAA,kBAAA,GAAlB,kBAAkB,CAAmB;KAAI;AAC7D,CAAA;AAEM,MAAM,sBAAsB,GAAG,yBAAyB,CAC7D,aAAa,CAAC,gBAAgB,CAAC,EAC/B,EAAE,CACH,CAAC;AAcI,MAAO,qBACX,SAAQ,sBAAsB,CAAA;AAuD9B;;AAEG;IACH,IACa,KAAK,CAAC,KAAa,EAAA;AAC9B,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;AACnB,SAAA;KACF;AACD,IAAA,IAAa,KAAK,GAAA;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;IAED,UAAU,GAAA;AACR,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpC,SAAA;AACD,QAAA,IAAI,CAAC,WAAW,G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d,KAAK;gBAwBF,KAAK,EAAA,CAAA;sBADR,KAAK;gBAkBF,oBAAoB,EAAA,CAAA;sBADvB,KAAK;gBAcF,aAAa,EAAA,CAAA;sBADhB,KAAK;;;ME/QK,wBAAwB,CAAA;;sHAAxB,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAxB,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cAFvB,qBAAqB,CAAA,EAAA,YAAA,EAAA,CAFlB,qBAAqB,CAD1B,EAAA,OAAA,EAAA,CAAA,YAAY,aAEZ,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAGpB,wBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,YALzB,YAAY,CAAA,EAAA,CAAA,CAAA;4FAKX,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBANpC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;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,CAAA;;;ACXD;;AAEG;;;;"}
@@ -2,9 +2,9 @@ import * as i0 from '@angular/core';
2
2
  import { EventEmitter, PLATFORM_ID, forwardRef, Component, Inject, ViewChild, Output, Input, NgModule } from '@angular/core';
3
3
  import { isPlatformServer, CommonModule } from '@angular/common';
4
4
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
- import { Subject, of, merge, fromEvent, timer } from 'rxjs';
5
+ import { of, Subject, merge, fromEvent, timer } from 'rxjs';
6
6
  import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
7
- import { editor, languages } from 'monaco-editor/esm/vs/editor/editor.api';
7
+ import { editor, languages } from 'monaco-editor';
8
8
  import { mixinControlValueAccessor, mixinDisabled } from '@covalent/core/common';
9
9
 
10
10
  const noop = () => {
@@ -13,55 +13,12 @@ const noop = () => {
13
13
  // counter for ids to allow for multiple editors on one page
14
14
  let uniqueCounter = 0;
15
15
  class TdCodeEditorBase {
16
- _changeDetectorRef;
17
16
  constructor(_changeDetectorRef) {
18
17
  this._changeDetectorRef = _changeDetectorRef;
19
18
  }
20
19
  }
21
20
  const _TdCodeEditorMixinBase = mixinControlValueAccessor(mixinDisabled(TdCodeEditorBase), []);
22
21
  class TdCodeEditorComponent extends _TdCodeEditorMixinBase {
23
- _elementRef;
24
- _ngZone;
25
- platformId;
26
- _destroy = new Subject();
27
- _widthSubject = new Subject();
28
- _heightSubject = new Subject();
29
- _editorStyle = 'width:100%;height:100%;';
30
- _value = '';
31
- _theme = 'vs';
32
- _language = 'javascript';
33
- _subject = new Subject();
34
- _editorInnerContainer = 'editorInnerContainer' + uniqueCounter++;
35
- _editor;
36
- _fromEditor = false;
37
- _componentInitialized = false;
38
- _editorOptions = {};
39
- _isFullScreen = false;
40
- _keycode;
41
- _registeredLanguagesStyles = [];
42
- _disposables = [];
43
- _editorContainer;
44
- /**
45
- * editorInitialized: function($event)
46
- * Event emitted when editor is first initialized
47
- */
48
- editorInitialized = new EventEmitter();
49
- /**
50
- * editorConfigurationChanged: function($event)
51
- * Event emitted when editor's configuration changes
52
- */
53
- editorConfigurationChanged = new EventEmitter();
54
- /**
55
- * editorLanguageChanged: function($event)
56
- * Event emitted when editor's Language changes
57
- */
58
- editorLanguageChanged = new EventEmitter();
59
- /**
60
- * editorValueChange: function($event)
61
- * Event emitted any time something changes the editor value
62
- */
63
- editorValueChange = new EventEmitter();
64
- propagateChange = (_) => noop;
65
22
  /**
66
23
  * value?: string
67
24
  */
@@ -232,6 +189,42 @@ class TdCodeEditorComponent extends _TdCodeEditorMixinBase {
232
189
  this._elementRef = _elementRef;
233
190
  this._ngZone = _ngZone;
234
191
  this.platformId = platformId;
192
+ this._destroy = new Subject();
193
+ this._widthSubject = new Subject();
194
+ this._heightSubject = new Subject();
195
+ this._editorStyle = 'width:100%;height:100%;';
196
+ this._value = '';
197
+ this._theme = 'vs';
198
+ this._language = 'javascript';
199
+ this._subject = new Subject();
200
+ this._editorInnerContainer = 'editorInnerContainer' + uniqueCounter++;
201
+ this._fromEditor = false;
202
+ this._componentInitialized = false;
203
+ this._editorOptions = {};
204
+ this._isFullScreen = false;
205
+ this._registeredLanguagesStyles = [];
206
+ this._disposables = [];
207
+ /**
208
+ * editorInitialized: function($event)
209
+ * Event emitted when editor is first initialized
210
+ */
211
+ this.editorInitialized = new EventEmitter();
212
+ /**
213
+ * editorConfigurationChanged: function($event)
214
+ * Event emitted when editor's configuration changes
215
+ */
216
+ this.editorConfigurationChanged = new EventEmitter();
217
+ /**
218
+ * editorLanguageChanged: function($event)
219
+ * Event emitted when editor's Language changes
220
+ */
221
+ this.editorLanguageChanged = new EventEmitter();
222
+ /**
223
+ * editorValueChange: function($event)
224
+ * Event emitted any time something changes the editor value
225
+ */
226
+ this.editorValueChange = new EventEmitter();
227
+ this.propagateChange = (_) => noop;
235
228
  }
236
229
  ngOnInit() {
237
230
  if (isPlatformServer(this.platformId)) {
@@ -328,16 +321,16 @@ class TdCodeEditorComponent extends _TdCodeEditorMixinBase {
328
321
  },
329
322
  }));
330
323
  }
331
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: TdCodeEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
332
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", 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: [
333
- {
334
- provide: NG_VALUE_ACCESSOR,
335
- useExisting: forwardRef(() => TdCodeEditorComponent),
336
- multi: true,
337
- },
338
- ], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: ["editorContainer"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;inset:0}::ng-deep .monaco-aria-container{display:none}\n"] });
339
324
  }
340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: TdCodeEditorComponent, decorators: [{
325
+ TdCodeEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdCodeEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
326
+ TdCodeEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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: [
327
+ {
328
+ provide: NG_VALUE_ACCESSOR,
329
+ useExisting: forwardRef(() => TdCodeEditorComponent),
330
+ multi: true,
331
+ },
332
+ ], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: ["editorContainer"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"editor-container\" #editorContainer></div>\n", styles: [":host{display:block;position:relative}:host .editor-container{position:absolute;inset:0}::ng-deep .monaco-aria-container{display:none}\n"] });
333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TdCodeEditorComponent, decorators: [{
341
334
  type: Component,
342
335
  args: [{ selector: 'td-code-editor', providers: [
343
336
  {
@@ -375,11 +368,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
375
368
  }] } });
376
369
 
377
370
  class CovalentCodeEditorModule {
378
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CovalentCodeEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
379
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: CovalentCodeEditorModule, bootstrap: [TdCodeEditorComponent], declarations: [TdCodeEditorComponent], imports: [CommonModule], exports: [TdCodeEditorComponent] });
380
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CovalentCodeEditorModule, imports: [CommonModule] });
381
371
  }
382
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: CovalentCodeEditorModule, decorators: [{
372
+ CovalentCodeEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
373
+ CovalentCodeEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, bootstrap: [TdCodeEditorComponent], declarations: [TdCodeEditorComponent], imports: [CommonModule], exports: [TdCodeEditorComponent] });
374
+ CovalentCodeEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, imports: [CommonModule] });
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CovalentCodeEditorModule, decorators: [{
383
376
  type: NgModule,
384
377
  args: [{
385
378
  imports: [CommonModule],