@ng-util/monaco-editor 21.1.0 → 21.2.0
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/README.md
CHANGED
|
@@ -172,7 +172,8 @@ export class DemoComponent {
|
|
|
172
172
|
|----------|-------------|------|---------|
|
|
173
173
|
| `[placeholder]` | Placeholder of monaco editor, Can change the style via defining the `.monaco-editor-placeholder` CSS. | `string` | - |
|
|
174
174
|
| `[height]` | Height of monaco editor, can be set `auto` | `string` | `200px` |
|
|
175
|
-
| `[
|
|
175
|
+
| `[minHeight]` | Min-height of monaco editor, when `height` set `auto` | `number` | - |
|
|
176
|
+
| `[maxHeight]` | Max-height of monaco editor, when `height` set `auto` | `number` | `1000` |
|
|
176
177
|
| `[disabled]` | Disabled of monaco editor | `boolean` | `false` |
|
|
177
178
|
| `[autoFormat]` | Whether to automatically format the document | `boolean` | `true` |
|
|
178
179
|
| `[options]` | Default options when creating editors | `monaco.editor.IStandaloneEditorConstructionOptions` | - |
|
|
@@ -14,8 +14,7 @@ function provideNuMonacoEditorConfig(config) {
|
|
|
14
14
|
return makeEnvironmentProviders([{ provide: NU_MONACO_EDITOR_CONFIG, useValue: config }]);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
let
|
|
18
|
-
let loadPromise;
|
|
17
|
+
let monacoLoadPromise = null;
|
|
19
18
|
class NuMonacoEditorBase {
|
|
20
19
|
el = inject(ElementRef);
|
|
21
20
|
config = inject(NU_MONACO_EDITOR_CONFIG, { optional: true });
|
|
@@ -25,6 +24,7 @@ class NuMonacoEditorBase {
|
|
|
25
24
|
_resize$ = null;
|
|
26
25
|
_config;
|
|
27
26
|
_disabled;
|
|
27
|
+
_disposables = [];
|
|
28
28
|
height = input(`200px`, ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
29
29
|
delay = input(0, ...(ngDevMode ? [{ debugName: "delay", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
30
30
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
@@ -37,7 +37,7 @@ class NuMonacoEditorBase {
|
|
|
37
37
|
});
|
|
38
38
|
effect(() => {
|
|
39
39
|
const options = this.options();
|
|
40
|
-
|
|
40
|
+
this.height();
|
|
41
41
|
this.updateOptions(options);
|
|
42
42
|
});
|
|
43
43
|
afterNextRender(() => {
|
|
@@ -54,57 +54,59 @@ class NuMonacoEditorBase {
|
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
56
|
init() {
|
|
57
|
-
if (
|
|
58
|
-
loadPromise.then(() => this.initMonaco(this.options(), true));
|
|
57
|
+
if (typeof window === 'undefined')
|
|
59
58
|
return;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
let baseUrl = `${this._config.baseUrl}/vs`;
|
|
73
|
-
// fix: https://github.com/microsoft/monaco-editor/issues/4778
|
|
74
|
-
if (!/^https?:\/\//g.test(baseUrl)) {
|
|
75
|
-
baseUrl = `${window.location.origin}/${baseUrl.startsWith('/') ? baseUrl.substring(1) : baseUrl}`;
|
|
76
|
-
}
|
|
77
|
-
const amdLoader = () => {
|
|
78
|
-
win.require.config({
|
|
79
|
-
paths: {
|
|
80
|
-
vs: baseUrl
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
if (typeof this._config.monacoPreLoad === 'function') {
|
|
84
|
-
this._config.monacoPreLoad();
|
|
59
|
+
if (!monacoLoadPromise) {
|
|
60
|
+
monacoLoadPromise = new Promise((resolve, reject) => {
|
|
61
|
+
const windowRef = window;
|
|
62
|
+
if (windowRef.monaco) {
|
|
63
|
+
resolve();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
let baseUrl = `${this._config.baseUrl}/vs`;
|
|
67
|
+
// fix: https://github.com/microsoft/monaco-editor/issues/4778
|
|
68
|
+
if (!/^https?:\/\//.test(baseUrl)) {
|
|
69
|
+
baseUrl = `${window.location.origin}/${baseUrl.startsWith('/') ? baseUrl.substring(1) : baseUrl}`;
|
|
85
70
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
const amdLoader = () => {
|
|
72
|
+
windowRef.require.config({
|
|
73
|
+
paths: {
|
|
74
|
+
vs: baseUrl
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if (typeof this._config.monacoPreLoad === 'function') {
|
|
78
|
+
this._config.monacoPreLoad();
|
|
89
79
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
80
|
+
windowRef.require(['vs/editor/editor.main'], () => {
|
|
81
|
+
if (typeof this._config.monacoLoad === 'function') {
|
|
82
|
+
this._config.monacoLoad(windowRef.monaco);
|
|
83
|
+
}
|
|
84
|
+
resolve();
|
|
85
|
+
}, () => {
|
|
86
|
+
reject(`Unable to load editor/editor.main module, please check your network environment.`);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
if (!windowRef.require) {
|
|
90
|
+
const loaderScript = this.doc.createElement('script');
|
|
91
|
+
loaderScript.type = 'text/javascript';
|
|
92
|
+
loaderScript.src = `${baseUrl}/loader.js`;
|
|
93
|
+
loaderScript.onload = amdLoader;
|
|
94
|
+
loaderScript.onerror = () => {
|
|
95
|
+
reject(`Unable to load ${loaderScript.src}, please check your network environment.`);
|
|
96
|
+
};
|
|
97
|
+
this.doc.getElementsByTagName('head')[0].appendChild(loaderScript);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
amdLoader();
|
|
101
|
+
}
|
|
102
|
+
}).catch(error => {
|
|
103
|
+
monacoLoadPromise = null;
|
|
104
|
+
throw error;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
monacoLoadPromise
|
|
108
|
+
.then(() => this.initMonaco(this.options(), true))
|
|
109
|
+
.catch(error => this.notifyEvent('load-error', { error }));
|
|
108
110
|
}
|
|
109
111
|
cleanResize() {
|
|
110
112
|
this._resize$?.unsubscribe();
|
|
@@ -115,20 +117,27 @@ class NuMonacoEditorBase {
|
|
|
115
117
|
this._resize$ = fromEvent(window, 'resize')
|
|
116
118
|
.pipe(debounceTime(100))
|
|
117
119
|
.subscribe(() => {
|
|
118
|
-
this._editor
|
|
120
|
+
this._editor?.layout();
|
|
119
121
|
this.notifyEvent('resize');
|
|
120
122
|
});
|
|
121
123
|
return this;
|
|
122
124
|
}
|
|
125
|
+
disposeEditor() {
|
|
126
|
+
this._disposables.forEach(d => d.dispose());
|
|
127
|
+
this._disposables.length = 0;
|
|
128
|
+
this._editor?.dispose();
|
|
129
|
+
this._editor = undefined;
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
123
132
|
updateOptions(v) {
|
|
124
133
|
if (!this._editor)
|
|
125
134
|
return;
|
|
126
|
-
this.
|
|
135
|
+
this.disposeEditor();
|
|
127
136
|
this.initMonaco(v, false);
|
|
128
137
|
}
|
|
129
138
|
ngOnDestroy() {
|
|
130
139
|
this.cleanResize();
|
|
131
|
-
this.
|
|
140
|
+
this.disposeEditor();
|
|
132
141
|
}
|
|
133
142
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NuMonacoEditorBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
134
143
|
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: NuMonacoEditorBase, isStandalone: true, selector: "nu-monaco-base", inputs: { height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { event: "event" }, ngImport: i0, template: ``, isInline: true });
|
|
@@ -187,7 +196,8 @@ class NuMonacoEditorComponent extends NuMonacoEditorBase {
|
|
|
187
196
|
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
|
|
188
197
|
model = input(...(ngDevMode ? [undefined, { debugName: "model" }] : []));
|
|
189
198
|
autoFormat = input(true, ...(ngDevMode ? [{ debugName: "autoFormat", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
190
|
-
maxHeight = input(
|
|
199
|
+
maxHeight = input(undefined, ...(ngDevMode ? [{ debugName: "maxHeight", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
200
|
+
minHeight = input(undefined, ...(ngDevMode ? [{ debugName: "minHeight", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
191
201
|
get editor() {
|
|
192
202
|
return this._editor;
|
|
193
203
|
}
|
|
@@ -206,16 +216,17 @@ class NuMonacoEditorComponent extends NuMonacoEditorBase {
|
|
|
206
216
|
}
|
|
207
217
|
togglePlaceholder() {
|
|
208
218
|
const text = this.placeholder();
|
|
209
|
-
if (text
|
|
219
|
+
if (typeof text !== 'string' || text.length <= 0 || this.editor == null)
|
|
210
220
|
return;
|
|
211
|
-
|
|
212
|
-
|
|
221
|
+
let widget = this._placeholderWidget;
|
|
222
|
+
if (widget == null) {
|
|
223
|
+
this._placeholderWidget = widget = new PlaceholderWidget(this.editor, text);
|
|
213
224
|
}
|
|
214
225
|
if (this._value.length > 0) {
|
|
215
|
-
this.editor.removeContentWidget(
|
|
226
|
+
this.editor.removeContentWidget(widget);
|
|
216
227
|
}
|
|
217
228
|
else {
|
|
218
|
-
this.editor.addContentWidget(
|
|
229
|
+
this.editor.addContentWidget(widget);
|
|
219
230
|
}
|
|
220
231
|
}
|
|
221
232
|
onChange = (_) => { };
|
|
@@ -246,17 +257,17 @@ class NuMonacoEditorComponent extends NuMonacoEditorBase {
|
|
|
246
257
|
if (!hasModel) {
|
|
247
258
|
editor.setValue(this._value);
|
|
248
259
|
}
|
|
249
|
-
editor.onDidChangeModelContent(() => {
|
|
260
|
+
this._disposables.push(editor.onDidChangeModelContent(() => {
|
|
250
261
|
const value = editor.getValue();
|
|
251
262
|
this._value = value;
|
|
252
263
|
this.onChange(value);
|
|
253
264
|
this.togglePlaceholder();
|
|
254
|
-
});
|
|
255
|
-
editor.onDidBlurEditorWidget(() => this.onTouched());
|
|
265
|
+
}));
|
|
266
|
+
this._disposables.push(editor.onDidBlurEditorWidget(() => this.onTouched()));
|
|
256
267
|
this.togglePlaceholder();
|
|
257
268
|
this.registerResize();
|
|
258
269
|
if (heightAuto) {
|
|
259
|
-
editor.onDidContentSizeChange(() => this.updateHeight());
|
|
270
|
+
this._disposables.push(editor.onDidContentSizeChange(() => this.updateHeight()));
|
|
260
271
|
this.updateHeight();
|
|
261
272
|
}
|
|
262
273
|
const eventName = initEvent ? 'init' : 're-init';
|
|
@@ -274,8 +285,16 @@ class NuMonacoEditorComponent extends NuMonacoEditorBase {
|
|
|
274
285
|
const editor = this.editor;
|
|
275
286
|
if (editor == null)
|
|
276
287
|
return;
|
|
277
|
-
const
|
|
278
|
-
|
|
288
|
+
const isFiniteNumber = (value) => value != null && Number.isFinite(value);
|
|
289
|
+
const contentHeight = editor.getContentHeight();
|
|
290
|
+
const minHeightLimit = this.minHeight();
|
|
291
|
+
const maxHeightInput = this.maxHeight();
|
|
292
|
+
const maxHeightLimit = isFiniteNumber(maxHeightInput) ? maxHeightInput : 1000;
|
|
293
|
+
let targetHeight = Math.min(contentHeight, maxHeightLimit);
|
|
294
|
+
if (isFiniteNumber(minHeightLimit)) {
|
|
295
|
+
targetHeight = Math.max(targetHeight, minHeightLimit);
|
|
296
|
+
}
|
|
297
|
+
editor.layout({ width: editor.getLayoutInfo().width, height: targetHeight });
|
|
279
298
|
}
|
|
280
299
|
format() {
|
|
281
300
|
const action = this.editor?.getAction('editor.action.formatDocument');
|
|
@@ -300,7 +319,7 @@ class NuMonacoEditorComponent extends NuMonacoEditorBase {
|
|
|
300
319
|
this.setDisabled(v);
|
|
301
320
|
}
|
|
302
321
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: NuMonacoEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
303
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: NuMonacoEditorComponent, isStandalone: true, selector: "nu-monaco-editor", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, autoFormat: { classPropertyName: "autoFormat", publicName: "autoFormat", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "'block'", "style.height": "height()" } }, providers: [
|
|
322
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.0", type: NuMonacoEditorComponent, isStandalone: true, selector: "nu-monaco-editor", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, autoFormat: { classPropertyName: "autoFormat", publicName: "autoFormat", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "'block'", "style.height": "height()" } }, providers: [
|
|
304
323
|
{
|
|
305
324
|
provide: NG_VALUE_ACCESSOR,
|
|
306
325
|
useExisting: forwardRef((() => NuMonacoEditorComponent)),
|
|
@@ -327,7 +346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImpor
|
|
|
327
346
|
],
|
|
328
347
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
329
348
|
}]
|
|
330
|
-
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }], autoFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFormat", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }] } });
|
|
349
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }], autoFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFormat", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }] } });
|
|
331
350
|
|
|
332
351
|
class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {
|
|
333
352
|
old = input(...(ngDevMode ? [undefined, { debugName: "old" }] : []));
|
|
@@ -352,8 +371,7 @@ class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {
|
|
|
352
371
|
original: monaco.editor.createModel(oldModel.code, oldModel.language || options.language),
|
|
353
372
|
modified: monaco.editor.createModel(newModel.code, newModel.language || options.language)
|
|
354
373
|
});
|
|
355
|
-
|
|
356
|
-
editor.onDidUpdateDiff(() => this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() }));
|
|
374
|
+
this._disposables.push(editor.onDidUpdateDiff(() => this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() })));
|
|
357
375
|
this.registerResize();
|
|
358
376
|
if (initEvent)
|
|
359
377
|
this.notifyEvent('init');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-util-monaco-editor.mjs","sources":["../../../../packages/monaco-editor/monaco-editor.types.ts","../../../../packages/monaco-editor/monaco-editor.config.ts","../../../../packages/monaco-editor/monaco-editor-base.component.ts","../../../../packages/monaco-editor/placholder.ts","../../../../packages/monaco-editor/monaco-editor.component.ts","../../../../packages/monaco-editor/monaco-editor-diff.component.ts","../../../../packages/monaco-editor/ng-util-monaco-editor.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./monaco.d.ts\" preserve=\"true\" />\n\nexport interface NuMonacoEditorModel {\n value?: string;\n language?: string;\n uri?: monaco.Uri;\n}\n\nexport interface NuMonacoEditorDiffModel {\n code: string;\n language?: string;\n}\n\nexport type NuMonacoEditorEventType = 'load-error' | 'init' | 're-init' | 'resize' | 'update-diff' | 'error';\n\nexport interface NuMonacoEditorEvent {\n type?: NuMonacoEditorEventType;\n editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n error?: string;\n /** Just only `nu-monaco-editor-diff` component */\n diffValue?: string;\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nexport const NU_MONACO_EDITOR_CONFIG = new InjectionToken<NuMonacoEditorConfig>('NU_MONACO_EDITOR_CONFIG');\n\nexport function provideNuMonacoEditorConfig(config?: NuMonacoEditorConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: NU_MONACO_EDITOR_CONFIG, useValue: config }]);\n}\n\nexport interface NuMonacoEditorConfig {\n /**\n * The base URL to monaco editor library assets via AMD (RequireJS), Default: `https://cdn.jsdelivr.net/npm/monaco-editor/min`\n * You can using local path, e.g.: `assets/monaco-editor/min`.\n */\n baseUrl?: string;\n /**\n * Default options when creating editors\n */\n defaultOptions?: monaco.editor.IStandaloneEditorConstructionOptions;\n /**\n * The event after the first loading of the monaco editor library is completed, use this function to extend monaco editor functionalities.\n * - @param `_monaco` equar to `window.monaco`\n */\n monacoLoad?: (_monaco: any) => void;\n /**\n * The event before the first preload of the monaco editor library is completed, use this function to set nls availableLanguages.\n */\n monacoPreLoad?: () => void;\n /**\n * Trigger automatic format delay time, default: `100`\n */\n autoFormatTime?: number;\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n booleanAttribute,\n Component,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n numberAttribute,\n OnDestroy,\n output\n} from '@angular/core';\nimport { fromEvent, Subscription, timer } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\nimport { NuMonacoEditorEvent, NuMonacoEditorEventType } from './monaco-editor.types';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nlet loadedMonaco = false;\nlet loadPromise: Promise<void>;\n\n@Component({\n selector: 'nu-monaco-base',\n template: ``\n})\nexport abstract class NuMonacoEditorBase implements OnDestroy {\n protected el = inject<ElementRef<HTMLElement>>(ElementRef);\n protected config = inject(NU_MONACO_EDITOR_CONFIG, { optional: true });\n protected doc = inject(DOCUMENT);\n protected destroy$ = inject(DestroyRef);\n\n protected _editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n protected _resize$: Subscription | null = null;\n protected _config: NuMonacoEditorConfig;\n protected _disabled?: boolean;\n\n height = input(`200px`);\n delay = input(0, { transform: numberAttribute });\n disabled = input(false, { transform: booleanAttribute });\n options = input<monaco.editor.IStandaloneEditorConstructionOptions>();\n readonly event = output<NuMonacoEditorEvent>();\n\n constructor() {\n this._config = { baseUrl: 'https://cdn.jsdelivr.net/npm/monaco-editor/min', autoFormatTime: 100, ...this.config };\n\n effect(() => {\n this.setDisabled(this.disabled());\n });\n\n effect(() => {\n const options = this.options();\n const _ = this.height();\n this.updateOptions(options);\n });\n\n afterNextRender(() => {\n timer(this.delay())\n .pipe(takeUntilDestroyed(this.destroy$))\n .subscribe(() => this.init());\n });\n }\n\n protected abstract initMonaco(\n _options: monaco.editor.IStandaloneEditorConstructionOptions | undefined,\n _initEvent: boolean\n ): void;\n\n protected notifyEvent(type: NuMonacoEditorEventType, other?: NuMonacoEditorEvent): void {\n this.event.emit({ type, editor: this._editor!, ...other });\n }\n\n protected setDisabled(v: boolean): this {\n (this._editor as monaco.editor.IStandaloneCodeEditor)?.updateOptions({ readOnly: v });\n return this;\n }\n\n private init(): void {\n if (loadedMonaco) {\n loadPromise.then(() => this.initMonaco(this.options(), true));\n return;\n }\n\n loadedMonaco = true;\n loadPromise = new Promise<void>((resolve: () => void, reject: (err: string) => void) => {\n const win: any = window;\n if (win == null) {\n resolve();\n return;\n }\n\n if (win.monaco) {\n resolve();\n return;\n }\n\n let baseUrl = `${this._config.baseUrl}/vs`;\n // fix: https://github.com/microsoft/monaco-editor/issues/4778\n if (!/^https?:\\/\\//g.test(baseUrl)) {\n baseUrl = `${window.location.origin}/${baseUrl.startsWith('/') ? baseUrl.substring(1) : baseUrl}`;\n }\n const amdLoader = () => {\n win.require.config({\n paths: {\n vs: baseUrl\n }\n });\n if (typeof this._config.monacoPreLoad === 'function') {\n this._config.monacoPreLoad();\n }\n win.require(\n ['vs/editor/editor.main'],\n () => {\n if (typeof this._config.monacoLoad === 'function') {\n this._config.monacoLoad(win.monaco);\n }\n this.initMonaco(this.options(), true);\n resolve();\n },\n () => {\n reject(`Unable to load editor/editor.main module, please check your network environment.`);\n }\n );\n };\n\n if (!win.require) {\n const loaderScript = this.doc.createElement('script') as HTMLScriptElement;\n loaderScript.type = 'text/javascript';\n loaderScript.src = `${baseUrl}/loader.js`;\n loaderScript.onload = amdLoader;\n loaderScript.onerror = () =>\n reject(`Unable to load ${loaderScript.src}, please check your network environment.`);\n this.doc.getElementsByTagName('head')[0].appendChild(loaderScript);\n } else {\n amdLoader();\n }\n }).catch(error => this.notifyEvent('load-error', { error }));\n }\n\n protected cleanResize(): this {\n this._resize$?.unsubscribe();\n return this;\n }\n\n protected registerResize(): this {\n this.cleanResize();\n this._resize$ = fromEvent(window, 'resize')\n .pipe(debounceTime(100))\n .subscribe(() => {\n this._editor!.layout();\n this.notifyEvent('resize');\n });\n return this;\n }\n\n updateOptions(v: monaco.editor.IStandaloneEditorConstructionOptions | undefined): void {\n if (!this._editor) return;\n this._editor!.dispose();\n this.initMonaco(v, false);\n }\n\n ngOnDestroy(): void {\n this.cleanResize();\n this._editor?.dispose();\n }\n}\n","export class PlaceholderWidget implements monaco.editor.IContentWidget {\n private readonly ID = 'editor.widget.placeholderHint';\n private placeholder?: string;\n private editor: monaco.editor.IStandaloneCodeEditor;\n private node?: HTMLElement;\n\n constructor(editor: monaco.editor.IStandaloneCodeEditor, placeholder?: string) {\n this.placeholder = placeholder;\n this.editor = editor;\n }\n\n update(text?: string | null | undefined) {\n if (this.node == null) return;\n\n this.node.innerHTML = text ?? this.placeholder ?? '';\n }\n\n getId(): string {\n return this.ID;\n }\n getDomNode(): HTMLElement {\n if (this.node == null) {\n const node = (this.node = document.createElement('div'));\n node.classList.add('monaco-editor-placeholder');\n node.style.width = 'max-content';\n node.style.color = 'gray';\n node.innerHTML = this.placeholder!;\n node.style.fontStyle = 'italic';\n this.editor.applyFontInfo(node);\n }\n return this.node;\n }\n getPosition(): monaco.editor.IContentWidgetPosition | null {\n return {\n position: { lineNumber: 1, column: 1 },\n preference: [monaco.editor.ContentWidgetPositionPreference.EXACT]\n };\n }\n\n dispose() {\n this.editor.removeContentWidget(this);\n }\n}\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n effect,\n forwardRef,\n input,\n numberAttribute,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { take, timer } from 'rxjs';\n\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorModel } from './monaco-editor.types';\nimport { PlaceholderWidget } from './placholder';\n\n@Component({\n selector: 'nu-monaco-editor',\n template: ``,\n exportAs: 'nuMonacoEditor',\n host: {\n '[style.display]': `'block'`,\n '[style.height]': 'height()'\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NuMonacoEditorComponent),\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NuMonacoEditorComponent extends NuMonacoEditorBase implements ControlValueAccessor {\n private _value = '';\n private _placeholderWidget?: PlaceholderWidget;\n placeholder = input<string>();\n model = input<NuMonacoEditorModel | null>();\n autoFormat = input(true, { transform: booleanAttribute });\n maxHeight = input(1000, { transform: numberAttribute });\n\n get editor(): monaco.editor.IStandaloneCodeEditor | null | undefined {\n return this._editor as monaco.editor.IStandaloneCodeEditor;\n }\n\n constructor() {\n super();\n effect(() => {\n const ph = this.placeholder();\n this._placeholderWidget?.update(ph);\n });\n effect(() => {\n const model = this.model();\n if (model == null) return;\n this.updateOptions(untracked(() => this.options()));\n });\n }\n\n private togglePlaceholder() {\n const text = this.placeholder();\n if (text == null || text.length <= 0 || this.editor == null) return;\n\n if (this._placeholderWidget == null) {\n this._placeholderWidget = new PlaceholderWidget(this.editor, text);\n }\n\n if (this._value.length > 0) {\n this.editor.removeContentWidget(this._placeholderWidget);\n } else {\n this.editor.addContentWidget(this._placeholderWidget);\n }\n }\n\n private onChange = (_: string) => {};\n private onTouched = () => {};\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n const hasModel = !!this.model();\n options = { ...this.config?.defaultOptions, ...options };\n const heightAuto = this.height() === 'auto';\n if (heightAuto) {\n options.scrollBeyondLastLine = false;\n options.overviewRulerLanes = 0;\n }\n\n if (hasModel) {\n const model = monaco.editor.getModel(this.model()!.uri! || '');\n if (model) {\n options.model = model;\n options.model.setValue(this._value);\n } else {\n const { value, language, uri } = this.model()!;\n options.model = monaco.editor.createModel(value || this._value, language, uri);\n }\n this._value = options.model.getValue();\n }\n\n if (this._disabled != null) options.readOnly = this._disabled;\n const editor = (this._editor = monaco.editor.create(this.el.nativeElement, options));\n\n if (!hasModel) {\n editor.setValue(this._value);\n }\n\n editor.onDidChangeModelContent(() => {\n const value = editor.getValue();\n this._value = value;\n\n this.onChange(value);\n\n this.togglePlaceholder();\n });\n editor.onDidBlurEditorWidget(() => this.onTouched());\n\n this.togglePlaceholder();\n this.registerResize();\n if (heightAuto) {\n editor.onDidContentSizeChange(() => this.updateHeight());\n this.updateHeight();\n }\n\n const eventName = initEvent ? 'init' : 're-init';\n if (this.autoFormat()) {\n timer(this._config.autoFormatTime!)\n .pipe(takeUntilDestroyed(this.destroy$), take(1))\n .subscribe(() => {\n this.format()?.then(() => this.notifyEvent(eventName));\n });\n return;\n }\n this.notifyEvent(eventName);\n }\n\n private updateHeight() {\n const editor = this.editor;\n if (editor == null) return;\n\n const contentHeight = Math.min(this.maxHeight(), editor.getContentHeight());\n editor.layout({ width: editor.getLayoutInfo().width, height: contentHeight });\n }\n\n format(): Promise<void> | undefined {\n const action = this.editor?.getAction('editor.action.formatDocument');\n if (action == null) return;\n return action.run();\n }\n\n writeValue(value: string): void {\n this._value = value || '';\n (this._editor as monaco.editor.IStandaloneCodeEditor)?.setValue(this._value);\n if (this.autoFormat()) {\n this.format();\n }\n }\n\n registerOnChange(fn: (_: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n setDisabledState(v: boolean): void {\n this.setDisabled(v);\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\n\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorDiffModel } from './monaco-editor.types';\n\n@Component({\n selector: 'nu-monaco-diff-editor',\n template: ``,\n exportAs: 'nuMonacoDiffEditor',\n host: {\n '[style.display]': `'block'`,\n '[style.height]': 'height()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {\n old = input<NuMonacoEditorDiffModel>();\n new = input<NuMonacoEditorDiffModel>();\n\n get editor(): monaco.editor.IStandaloneDiffEditor | null | undefined {\n return this._editor as monaco.editor.IStandaloneDiffEditor;\n }\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n const oldModel = this.old();\n const newModel = this.new();\n if (!oldModel || !newModel) {\n this.notifyEvent('error', { error: 'old or new not found for nu-monaco-diff-editor' });\n return;\n }\n\n options = { ...this.config?.defaultOptions, ...options };\n const theme = options.theme;\n if (this._disabled != null) options.readOnly = this._disabled;\n const editor = (this._editor = monaco.editor.createDiffEditor(this.el.nativeElement, options));\n options.theme = theme;\n editor.setModel({\n original: monaco.editor.createModel(oldModel.code, oldModel.language || options.language),\n modified: monaco.editor.createModel(newModel.code, newModel.language || options.language)\n });\n\n // this.setDisabled();\n editor.onDidUpdateDiff(() => this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() }));\n\n this.registerResize();\n if (initEvent) this.notifyEvent('init');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;;MCCa,uBAAuB,GAAG,IAAI,cAAc,CAAuB,yBAAyB;AAEnG,SAAU,2BAA2B,CAAC,MAA6B,EAAA;AACvE,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3F;;ACeA,IAAI,YAAY,GAAG,KAAK;AACxB,IAAI,WAA0B;MAMR,kBAAkB,CAAA;AAC5B,IAAA,EAAE,GAAG,MAAM,CAA0B,UAAU,CAAC;IAChD,MAAM,GAAG,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,OAAO,CAAC,QAAQ;AACzF,SAAA,CAAC;;QAGF,MAAM,CAAC,eAAe,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAEnH,IAAI,CAAC,cAAc,EAAE;AACrB,QAAA,IAAI,SAAS;AAAE,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IACzC;0HA/BW,2BAA2B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA3B,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,2BAA2B,4cAR5B,CAAA,CAAE,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAQD,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAVvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,uBAAuB;AACjC,oBAAA,QAAQ,EAAE,CAAA,CAAE;AACZ,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,IAAI,EAAE;AACJ,wBAAA,iBAAiB,EAAE,CAAA,OAAA,CAAS;AAC5B,wBAAA,gBAAgB,EAAE;AACnB,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC;AAC1C,iBAAA;;;ACdD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-util-monaco-editor.mjs","sources":["../../../../packages/monaco-editor/monaco-editor.types.ts","../../../../packages/monaco-editor/monaco-editor.config.ts","../../../../packages/monaco-editor/monaco-editor-base.component.ts","../../../../packages/monaco-editor/placeholder.ts","../../../../packages/monaco-editor/monaco-editor.component.ts","../../../../packages/monaco-editor/monaco-editor-diff.component.ts","../../../../packages/monaco-editor/ng-util-monaco-editor.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./monaco.d.ts\" preserve=\"true\" />\n\nexport interface NuMonacoEditorModel {\n value?: string;\n language?: string;\n uri?: monaco.Uri;\n}\n\nexport interface NuMonacoEditorDiffModel {\n code: string;\n language?: string;\n}\n\nexport type NuMonacoEditorEventType = 'load-error' | 'init' | 're-init' | 'resize' | 'update-diff' | 'error';\n\nexport interface NuMonacoEditorEvent {\n type?: NuMonacoEditorEventType;\n editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n error?: string;\n /** Just only `nu-monaco-editor-diff` component */\n diffValue?: string;\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nexport const NU_MONACO_EDITOR_CONFIG = new InjectionToken<NuMonacoEditorConfig>('NU_MONACO_EDITOR_CONFIG');\n\nexport function provideNuMonacoEditorConfig(config?: NuMonacoEditorConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: NU_MONACO_EDITOR_CONFIG, useValue: config }]);\n}\n\nexport interface NuMonacoEditorConfig {\n /**\n * The base URL to monaco editor library assets via AMD (RequireJS), Default: `https://cdn.jsdelivr.net/npm/monaco-editor/min`\n * You can using local path, e.g.: `assets/monaco-editor/min`.\n */\n baseUrl?: string;\n /**\n * Default options when creating editors\n */\n defaultOptions?: monaco.editor.IStandaloneEditorConstructionOptions;\n /**\n * The event after the first loading of the monaco editor library is completed, use this function to extend monaco editor functionalities.\n * - @param `_monaco` equar to `window.monaco`\n */\n monacoLoad?: (_monaco: any) => void;\n /**\n * The event before the first preload of the monaco editor library is completed, use this function to set nls availableLanguages.\n */\n monacoPreLoad?: () => void;\n /**\n * Trigger automatic format delay time, default: `100`\n */\n autoFormatTime?: number;\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n booleanAttribute,\n Component,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n numberAttribute,\n OnDestroy,\n output\n} from '@angular/core';\nimport { fromEvent, Subscription, timer } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\nimport { NuMonacoEditorEvent, NuMonacoEditorEventType } from './monaco-editor.types';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nlet monacoLoadPromise: Promise<void> | null = null;\n\n@Component({\n selector: 'nu-monaco-base',\n template: ``\n})\nexport abstract class NuMonacoEditorBase implements OnDestroy {\n protected el = inject<ElementRef<HTMLElement>>(ElementRef);\n protected config = inject(NU_MONACO_EDITOR_CONFIG, { optional: true });\n protected doc = inject(DOCUMENT);\n protected destroy$ = inject(DestroyRef);\n\n protected _editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n protected _resize$: Subscription | null = null;\n protected _config: NuMonacoEditorConfig;\n protected _disabled?: boolean;\n protected readonly _disposables: monaco.IDisposable[] = [];\n\n readonly height = input(`200px`);\n readonly delay = input(0, { transform: numberAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly options = input<monaco.editor.IStandaloneEditorConstructionOptions>();\n readonly event = output<NuMonacoEditorEvent>();\n\n constructor() {\n this._config = { baseUrl: 'https://cdn.jsdelivr.net/npm/monaco-editor/min', autoFormatTime: 100, ...this.config };\n\n effect(() => {\n this.setDisabled(this.disabled());\n });\n\n effect(() => {\n const options = this.options();\n this.height();\n this.updateOptions(options);\n });\n\n afterNextRender(() => {\n timer(this.delay())\n .pipe(takeUntilDestroyed(this.destroy$))\n .subscribe(() => this.init());\n });\n }\n\n protected abstract initMonaco(\n _options: monaco.editor.IStandaloneEditorConstructionOptions | undefined,\n _initEvent: boolean\n ): void;\n\n protected notifyEvent(type: NuMonacoEditorEventType, other?: NuMonacoEditorEvent): void {\n this.event.emit({ type, editor: this._editor!, ...other });\n }\n\n protected setDisabled(v: boolean): this {\n (this._editor as monaco.editor.IStandaloneCodeEditor)?.updateOptions({ readOnly: v });\n return this;\n }\n\n private init(): void {\n if (typeof window === 'undefined') return;\n\n if (!monacoLoadPromise) {\n monacoLoadPromise = new Promise<void>((resolve: () => void, reject: (err: string) => void) => {\n const windowRef = window as any;\n if (windowRef.monaco) {\n resolve();\n return;\n }\n\n let baseUrl = `${this._config.baseUrl}/vs`;\n // fix: https://github.com/microsoft/monaco-editor/issues/4778\n if (!/^https?:\\/\\//.test(baseUrl)) {\n baseUrl = `${window.location.origin}/${baseUrl.startsWith('/') ? baseUrl.substring(1) : baseUrl}`;\n }\n const amdLoader = () => {\n windowRef.require.config({\n paths: {\n vs: baseUrl\n }\n });\n if (typeof this._config.monacoPreLoad === 'function') {\n this._config.monacoPreLoad();\n }\n windowRef.require(\n ['vs/editor/editor.main'],\n () => {\n if (typeof this._config.monacoLoad === 'function') {\n this._config.monacoLoad(windowRef.monaco);\n }\n resolve();\n },\n () => {\n reject(`Unable to load editor/editor.main module, please check your network environment.`);\n }\n );\n };\n\n if (!windowRef.require) {\n const loaderScript = this.doc.createElement('script') as HTMLScriptElement;\n loaderScript.type = 'text/javascript';\n loaderScript.src = `${baseUrl}/loader.js`;\n loaderScript.onload = amdLoader;\n loaderScript.onerror = () => {\n reject(`Unable to load ${loaderScript.src}, please check your network environment.`);\n };\n this.doc.getElementsByTagName('head')[0].appendChild(loaderScript);\n } else {\n amdLoader();\n }\n }).catch(error => {\n monacoLoadPromise = null;\n throw error;\n });\n }\n\n monacoLoadPromise\n .then(() => this.initMonaco(this.options(), true))\n .catch(error => this.notifyEvent('load-error', { error }));\n }\n\n protected cleanResize(): this {\n this._resize$?.unsubscribe();\n return this;\n }\n\n protected registerResize(): this {\n this.cleanResize();\n this._resize$ = fromEvent(window, 'resize')\n .pipe(debounceTime(100))\n .subscribe(() => {\n this._editor?.layout();\n this.notifyEvent('resize');\n });\n return this;\n }\n\n protected disposeEditor(): this {\n this._disposables.forEach(d => d.dispose());\n this._disposables.length = 0;\n this._editor?.dispose();\n this._editor = undefined;\n return this;\n }\n\n updateOptions(v: monaco.editor.IStandaloneEditorConstructionOptions | undefined): void {\n if (!this._editor) return;\n\n this.disposeEditor();\n this.initMonaco(v, false);\n }\n\n ngOnDestroy(): void {\n this.cleanResize();\n this.disposeEditor();\n }\n}\n","export class PlaceholderWidget implements monaco.editor.IContentWidget {\n private readonly ID = 'editor.widget.placeholderHint';\n private placeholder?: string;\n private editor: monaco.editor.IStandaloneCodeEditor;\n private node?: HTMLElement;\n\n constructor(editor: monaco.editor.IStandaloneCodeEditor, placeholder?: string) {\n this.placeholder = placeholder;\n this.editor = editor;\n }\n\n update(text?: string | null | undefined) {\n if (this.node == null) return;\n\n this.node.innerHTML = text ?? this.placeholder ?? '';\n }\n\n getId(): string {\n return this.ID;\n }\n getDomNode(): HTMLElement {\n if (this.node == null) {\n const node = (this.node = document.createElement('div'));\n node.classList.add('monaco-editor-placeholder');\n node.style.width = 'max-content';\n node.style.color = 'gray';\n node.innerHTML = this.placeholder!;\n node.style.fontStyle = 'italic';\n this.editor.applyFontInfo(node);\n }\n return this.node;\n }\n getPosition(): monaco.editor.IContentWidgetPosition | null {\n return {\n position: { lineNumber: 1, column: 1 },\n preference: [monaco.editor.ContentWidgetPositionPreference.EXACT]\n };\n }\n\n dispose() {\n this.editor.removeContentWidget(this);\n }\n}\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n effect,\n forwardRef,\n input,\n numberAttribute,\n untracked\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { take, timer } from 'rxjs';\n\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorModel } from './monaco-editor.types';\nimport { PlaceholderWidget } from './placeholder';\n\n@Component({\n selector: 'nu-monaco-editor',\n template: ``,\n exportAs: 'nuMonacoEditor',\n host: {\n '[style.display]': `'block'`,\n '[style.height]': 'height()'\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NuMonacoEditorComponent),\n multi: true\n }\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NuMonacoEditorComponent extends NuMonacoEditorBase implements ControlValueAccessor {\n private _value = '';\n private _placeholderWidget?: PlaceholderWidget;\n readonly placeholder = input<string>();\n readonly model = input<NuMonacoEditorModel | null>();\n readonly autoFormat = input(true, { transform: booleanAttribute });\n readonly maxHeight = input(undefined, { transform: numberAttribute });\n readonly minHeight = input(undefined, { transform: numberAttribute });\n\n get editor(): monaco.editor.IStandaloneCodeEditor | null | undefined {\n return this._editor as monaco.editor.IStandaloneCodeEditor;\n }\n\n constructor() {\n super();\n effect(() => {\n const ph = this.placeholder();\n this._placeholderWidget?.update(ph);\n });\n effect(() => {\n const model = this.model();\n if (model == null) return;\n this.updateOptions(untracked(() => this.options()));\n });\n }\n\n private togglePlaceholder() {\n const text = this.placeholder();\n if (typeof text !== 'string' || text.length <= 0 || this.editor == null) return;\n\n let widget = this._placeholderWidget;\n if (widget == null) {\n this._placeholderWidget = widget = new PlaceholderWidget(this.editor, text);\n }\n\n if (this._value.length > 0) {\n this.editor.removeContentWidget(widget);\n } else {\n this.editor.addContentWidget(widget);\n }\n }\n\n private onChange = (_: string) => {};\n private onTouched = () => {};\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n const hasModel = !!this.model();\n options = { ...this.config?.defaultOptions, ...options };\n const heightAuto = this.height() === 'auto';\n if (heightAuto) {\n options.scrollBeyondLastLine = false;\n options.overviewRulerLanes = 0;\n }\n\n if (hasModel) {\n const model = monaco.editor.getModel(this.model()!.uri! || '');\n if (model) {\n options.model = model;\n options.model.setValue(this._value);\n } else {\n const { value, language, uri } = this.model()!;\n options.model = monaco.editor.createModel(value || this._value, language, uri);\n }\n this._value = options.model.getValue();\n }\n\n if (this._disabled != null) options.readOnly = this._disabled;\n const editor = (this._editor = monaco.editor.create(this.el.nativeElement, options));\n\n if (!hasModel) {\n editor.setValue(this._value);\n }\n\n this._disposables.push(\n editor.onDidChangeModelContent(() => {\n const value = editor.getValue();\n this._value = value;\n\n this.onChange(value);\n\n this.togglePlaceholder();\n })\n );\n this._disposables.push(editor.onDidBlurEditorWidget(() => this.onTouched()));\n\n this.togglePlaceholder();\n this.registerResize();\n if (heightAuto) {\n this._disposables.push(editor.onDidContentSizeChange(() => this.updateHeight()));\n this.updateHeight();\n }\n\n const eventName = initEvent ? 'init' : 're-init';\n if (this.autoFormat()) {\n timer(this._config.autoFormatTime!)\n .pipe(takeUntilDestroyed(this.destroy$), take(1))\n .subscribe(() => {\n this.format()?.then(() => this.notifyEvent(eventName));\n });\n return;\n }\n this.notifyEvent(eventName);\n }\n\n private updateHeight() {\n const editor = this.editor;\n if (editor == null) return;\n\n const isFiniteNumber = (value?: number): value is number => value != null && Number.isFinite(value);\n const contentHeight = editor.getContentHeight();\n const minHeightLimit = this.minHeight();\n const maxHeightInput = this.maxHeight();\n const maxHeightLimit = isFiniteNumber(maxHeightInput) ? maxHeightInput : 1000;\n\n let targetHeight = Math.min(contentHeight, maxHeightLimit);\n if (isFiniteNumber(minHeightLimit)) {\n targetHeight = Math.max(targetHeight, minHeightLimit);\n }\n\n editor.layout({ width: editor.getLayoutInfo().width, height: targetHeight });\n }\n\n format(): Promise<void> | undefined {\n const action = this.editor?.getAction('editor.action.formatDocument');\n if (action == null) return;\n return action.run();\n }\n\n writeValue(value: string): void {\n this._value = value || '';\n (this._editor as monaco.editor.IStandaloneCodeEditor)?.setValue(this._value);\n if (this.autoFormat()) {\n this.format();\n }\n }\n\n registerOnChange(fn: (_: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(v: boolean): void {\n this.setDisabled(v);\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\n\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorDiffModel } from './monaco-editor.types';\n\n@Component({\n selector: 'nu-monaco-diff-editor',\n template: ``,\n exportAs: 'nuMonacoDiffEditor',\n host: {\n '[style.display]': `'block'`,\n '[style.height]': 'height()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {\n readonly old = input<NuMonacoEditorDiffModel>();\n readonly new = input<NuMonacoEditorDiffModel>();\n\n get editor(): monaco.editor.IStandaloneDiffEditor | null | undefined {\n return this._editor as monaco.editor.IStandaloneDiffEditor;\n }\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n const oldModel = this.old();\n const newModel = this.new();\n if (!oldModel || !newModel) {\n this.notifyEvent('error', { error: 'old or new not found for nu-monaco-diff-editor' });\n return;\n }\n\n options = { ...this.config?.defaultOptions, ...options };\n const theme = options.theme;\n if (this._disabled != null) options.readOnly = this._disabled;\n const editor = (this._editor = monaco.editor.createDiffEditor(this.el.nativeElement, options));\n options.theme = theme;\n editor.setModel({\n original: monaco.editor.createModel(oldModel.code, oldModel.language || options.language),\n modified: monaco.editor.createModel(newModel.code, newModel.language || options.language)\n });\n\n this._disposables.push(\n editor.onDidUpdateDiff(() =>\n this.notifyEvent('update-diff', { diffValue: editor.getModifiedEditor().getValue() })\n )\n );\n\n this.registerResize();\n if (initEvent) this.notifyEvent('init');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;;MCCa,uBAAuB,GAAG,IAAI,cAAc,CAAuB,yBAAyB;AAEnG,SAAU,2BAA2B,CAAC,MAA6B,EAAA;AACvE,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3F;;ACeA,IAAI,iBAAiB,GAAyB,IAAI;M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5
5
|
"description": "Monaco Code Editor for Angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"default": "./fesm2022/ng-util-monaco-editor.mjs"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
+
"type": "module",
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"tslib": "^2.3.0"
|
|
37
38
|
}
|
|
@@ -58,10 +58,11 @@ declare abstract class NuMonacoEditorBase implements OnDestroy {
|
|
|
58
58
|
protected _resize$: Subscription | null;
|
|
59
59
|
protected _config: NuMonacoEditorConfig;
|
|
60
60
|
protected _disabled?: boolean;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
protected readonly _disposables: monaco.IDisposable[];
|
|
62
|
+
readonly height: _angular_core.InputSignal<string>;
|
|
63
|
+
readonly delay: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
64
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
65
|
+
readonly options: _angular_core.InputSignal<monaco.editor.IStandaloneEditorConstructionOptions | undefined>;
|
|
65
66
|
readonly event: _angular_core.OutputEmitterRef<NuMonacoEditorEvent>;
|
|
66
67
|
constructor();
|
|
67
68
|
protected abstract initMonaco(_options: monaco.editor.IStandaloneEditorConstructionOptions | undefined, _initEvent: boolean): void;
|
|
@@ -70,6 +71,7 @@ declare abstract class NuMonacoEditorBase implements OnDestroy {
|
|
|
70
71
|
private init;
|
|
71
72
|
protected cleanResize(): this;
|
|
72
73
|
protected registerResize(): this;
|
|
74
|
+
protected disposeEditor(): this;
|
|
73
75
|
updateOptions(v: monaco.editor.IStandaloneEditorConstructionOptions | undefined): void;
|
|
74
76
|
ngOnDestroy(): void;
|
|
75
77
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NuMonacoEditorBase, never>;
|
|
@@ -79,10 +81,11 @@ declare abstract class NuMonacoEditorBase implements OnDestroy {
|
|
|
79
81
|
declare class NuMonacoEditorComponent extends NuMonacoEditorBase implements ControlValueAccessor {
|
|
80
82
|
private _value;
|
|
81
83
|
private _placeholderWidget?;
|
|
82
|
-
placeholder: _angular_core.InputSignal<string | undefined>;
|
|
83
|
-
model: _angular_core.InputSignal<NuMonacoEditorModel | null | undefined>;
|
|
84
|
-
autoFormat: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
85
|
-
maxHeight: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
84
|
+
readonly placeholder: _angular_core.InputSignal<string | undefined>;
|
|
85
|
+
readonly model: _angular_core.InputSignal<NuMonacoEditorModel | null | undefined>;
|
|
86
|
+
readonly autoFormat: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
87
|
+
readonly maxHeight: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
|
|
88
|
+
readonly minHeight: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
|
|
86
89
|
get editor(): monaco.editor.IStandaloneCodeEditor | null | undefined;
|
|
87
90
|
constructor();
|
|
88
91
|
private togglePlaceholder;
|
|
@@ -93,15 +96,15 @@ declare class NuMonacoEditorComponent extends NuMonacoEditorBase implements Cont
|
|
|
93
96
|
format(): Promise<void> | undefined;
|
|
94
97
|
writeValue(value: string): void;
|
|
95
98
|
registerOnChange(fn: (_: string) => void): void;
|
|
96
|
-
registerOnTouched(fn:
|
|
99
|
+
registerOnTouched(fn: () => void): void;
|
|
97
100
|
setDisabledState(v: boolean): void;
|
|
98
101
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NuMonacoEditorComponent, never>;
|
|
99
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NuMonacoEditorComponent, "nu-monaco-editor", ["nuMonacoEditor"], { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; "autoFormat": { "alias": "autoFormat"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
102
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NuMonacoEditorComponent, "nu-monaco-editor", ["nuMonacoEditor"], { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; "autoFormat": { "alias": "autoFormat"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "minHeight": { "alias": "minHeight"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
declare class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {
|
|
103
|
-
old: _angular_core.InputSignal<NuMonacoEditorDiffModel | undefined>;
|
|
104
|
-
new: _angular_core.InputSignal<NuMonacoEditorDiffModel | undefined>;
|
|
106
|
+
readonly old: _angular_core.InputSignal<NuMonacoEditorDiffModel | undefined>;
|
|
107
|
+
readonly new: _angular_core.InputSignal<NuMonacoEditorDiffModel | undefined>;
|
|
105
108
|
get editor(): monaco.editor.IStandaloneDiffEditor | null | undefined;
|
|
106
109
|
initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void;
|
|
107
110
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NuMonacoEditorDiffComponent, never>;
|