@ng-util/monaco-editor 16.0.0 → 16.0.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 +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/monaco-editor.component.ts","../../../../packages/monaco-editor/monaco-editor-diff.component.ts","../../../../packages/monaco-editor/monaco-editor.module.ts","../../../../packages/monaco-editor/ng-util-monaco-editor.ts"],"sourcesContent":["// tslint:disable-next-line: no-reference\n/// <reference path=\"./monaco.d.ts\" />\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';\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 { InjectionToken } from '@angular/core';\n\nexport const NU_MONACO_EDITOR_CONFIG = new InjectionToken('NU_MONACO_EDITOR_CONFIG');\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","import { DOCUMENT } from '@angular/common';\nimport {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n Output,\n SimpleChange,\n SimpleChanges,\n} from '@angular/core';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\nimport { NuMonacoEditorEvent, NuMonacoEditorEventType } from './monaco-editor.types';\n\nlet loadedMonaco = false;\nlet loadPromise: Promise<void>;\n\n@Component({\n selector: 'nu-monaco-base',\n template: ``,\n standalone: true,\n})\n// eslint-disable-next-line @angular-eslint/component-class-suffix\nexport abstract class NuMonacoEditorBase implements AfterViewInit, OnChanges, OnDestroy {\n protected _editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n protected _options!: monaco.editor.IStandaloneEditorConstructionOptions;\n protected _resize$: Subscription | null = null;\n protected _config: NuMonacoEditorConfig;\n protected _disabled?: boolean;\n\n @Input() height = `200px`;\n @Input() delay = 0;\n @Input()\n set disabled(val: boolean | string) {\n this._disabled = typeof val === 'string' ? true : val;\n this.setDisabled();\n }\n @Input()\n set options(val: monaco.editor.IStandaloneEditorConstructionOptions) {\n this._options = { ...this._config.defaultOptions, ...val };\n }\n get options() {\n return this._options;\n }\n @Output() event = new EventEmitter<NuMonacoEditorEvent>();\n\n constructor(\n protected el: ElementRef<HTMLElement>,\n @Inject(NU_MONACO_EDITOR_CONFIG) config: NuMonacoEditorConfig,\n @Inject(DOCUMENT) protected doc: any,\n protected ngZone: NgZone,\n ) {\n this._config = { baseUrl: 'https://cdn.jsdelivr.net/npm/monaco-editor/min', ...config };\n this.options = this._config.defaultOptions!;\n }\n\n protected abstract initMonaco(_options: monaco.editor.IStandaloneEditorConstructionOptions, _initEvent: boolean): void;\n\n protected notifyEvent(type: NuMonacoEditorEventType, other?: NuMonacoEditorEvent): void {\n this.ngZone.run(() => this.event.emit({ type, editor: this._editor!, ...other }));\n }\n\n protected setDisabled(): this {\n if (this._editor) {\n (this._editor as monaco.editor.IStandaloneCodeEditor).updateOptions({ readOnly: this._disabled });\n }\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 const baseUrl = this._config.baseUrl;\n const amdLoader = () => {\n win.require.config({ paths: { vs: `${baseUrl}/vs` } });\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}/vs/loader.js`;\n loaderScript.onload = amdLoader;\n loaderScript.onerror = () => 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 if (this._resize$) {\n this._resize$.unsubscribe();\n }\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 updateOptions(): void {\n if (!this._editor) return;\n this.ngZone.runOutsideAngular(() => {\n this._editor!.dispose();\n this.initMonaco(this._options, false);\n });\n }\n\n ngAfterViewInit(): void {\n this.ngZone.runOutsideAngular(() => setTimeout(() => this.init(), +this.delay));\n }\n\n ngOnChanges(changes: { [P in keyof this]?: SimpleChange } & SimpleChanges): void {\n const allKeys = Object.keys(changes);\n if (allKeys.length === 1 && allKeys[0] === 'disabled') return;\n this.updateOptions();\n }\n\n ngOnDestroy(): void {\n this.cleanResize();\n if (this._editor) {\n this._editor.dispose();\n this._editor = undefined;\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorModel } from './monaco-editor.types';\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 standalone: true,\n})\nexport class NuMonacoEditorComponent extends NuMonacoEditorBase implements ControlValueAccessor {\n private _value = '';\n\n @Input() model?: NuMonacoEditorModel | null;\n @Input() autoFormat = true;\n\n get editor(): monaco.editor.IStandaloneCodeEditor {\n return this._editor as monaco.editor.IStandaloneCodeEditor;\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\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 }\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\n this.ngZone.run(() => {\n this._value = value;\n this.onChange(value);\n });\n });\n editor.onDidBlurEditorWidget(() => this.onTouched());\n\n this.registerResize();\n\n if (this.autoFormat) {\n editor\n .getAction('editor.action.formatDocument')\n .run()\n .then(() => this.notifyEvent(initEvent ? 'init' : 're-init'));\n return;\n }\n this.notifyEvent(initEvent ? 'init' : 're-init');\n }\n\n writeValue(value: string): void {\n this._value = value || '';\n if (this._editor) {\n (this._editor as monaco.editor.IStandaloneCodeEditor).setValue(this._value);\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(_isDisabled: boolean): void {\n this.disabled = _isDisabled;\n this.setDisabled();\n }\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\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 standalone: true,\n})\nexport class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {\n @Input() old!: NuMonacoEditorDiffModel | null;\n @Input() new!: NuMonacoEditorDiffModel | null;\n\n get editor(): monaco.editor.IStandaloneDiffEditor {\n return this._editor as monaco.editor.IStandaloneDiffEditor;\n }\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n if (!this.old || !this.new) {\n throw new Error('old or new not found for nu-monaco-diff-editor');\n }\n\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(this.old.code, this.old.language || options.language),\n modified: monaco.editor.createModel(this.new.code, this.new.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","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NuMonacoEditorDiffComponent } from './monaco-editor-diff.component';\nimport { NuMonacoEditorComponent } from './monaco-editor.component';\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\n\nconst COMPONENTS = [NuMonacoEditorComponent, NuMonacoEditorDiffComponent];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS,\n})\nexport class NuMonacoEditorModule {\n static forRoot(config?: NuMonacoEditorConfig): ModuleWithProviders<NuMonacoEditorModule> {\n return {\n ngModule: NuMonacoEditorModule,\n providers: [{ provide: NU_MONACO_EDITOR_CONFIG, useValue: config }],\n };\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,CAAC,yBAAyB;;ACkBnF,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,IAAI,WAA0B,CAAC;AAE/B,MAMsB,kBAAkB,CAAA;IAStC,IACI,QAAQ,CAAC,GAAqB,EAAA;AAChC,QAAA,IAAI,CAAC,SAAS,GAAG,OAAO,GAAG,KAAK,QAAQ,GAAG,IAAI,GAAG,GAAG,CAAC;QACtD,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;IACD,IACI,OAAO,CAAC,GAAuD,EAAA;AACjE,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,GAAG,EAAE,CAAC;KAC5D;AACD,IAAA,IAAI,OAAO,GAAA;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB;AAGD,I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AAuB,EAAE,2BAA2B,CAAA,EAAA,CAAA,CAAA,EAAA;AAM3D,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAHrB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGX,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC;AACtC,oBAAA,OAAO,EAAE,UAAU;AACpB,iBAAA,CAAA;;;ACXD;;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/monaco-editor.component.ts","../../../../packages/monaco-editor/monaco-editor-diff.component.ts","../../../../packages/monaco-editor/monaco-editor.module.ts","../../../../packages/monaco-editor/ng-util-monaco-editor.ts"],"sourcesContent":["// tslint:disable-next-line: no-reference\n/// <reference path=\"./monaco.d.ts\" />\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';\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 { InjectionToken } from '@angular/core';\n\nexport const NU_MONACO_EDITOR_CONFIG = new InjectionToken('NU_MONACO_EDITOR_CONFIG');\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 AfterViewInit,\n Component,\n DestroyRef,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n Output,\n SimpleChange,\n SimpleChanges,\n} from '@angular/core';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\nimport { NuMonacoEditorEvent, NuMonacoEditorEventType } from './monaco-editor.types';\n\nlet loadedMonaco = false;\nlet loadPromise: Promise<void>;\n\n@Component({\n selector: 'nu-monaco-base',\n template: ``,\n standalone: true,\n})\n// eslint-disable-next-line @angular-eslint/component-class-suffix\nexport abstract class NuMonacoEditorBase implements AfterViewInit, OnChanges, OnDestroy {\n protected _editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;\n protected _options!: monaco.editor.IStandaloneEditorConstructionOptions;\n protected _resize$: Subscription | null = null;\n protected _config: NuMonacoEditorConfig;\n protected _disabled?: boolean;\n\n @Input() height = `200px`;\n @Input() delay = 0;\n @Input()\n set disabled(val: boolean | string) {\n this._disabled = typeof val === 'string' ? true : val;\n this.setDisabled();\n }\n @Input()\n set options(val: monaco.editor.IStandaloneEditorConstructionOptions) {\n this._options = { ...this._config.defaultOptions, ...val };\n }\n get options() {\n return this._options;\n }\n @Output() event = new EventEmitter<NuMonacoEditorEvent>();\n\n constructor(\n protected el: ElementRef<HTMLElement>,\n @Inject(NU_MONACO_EDITOR_CONFIG) config: NuMonacoEditorConfig,\n @Inject(DOCUMENT) protected doc: any,\n protected ngZone: NgZone,\n protected destroy$: DestroyRef,\n ) {\n this._config = { baseUrl: 'https://cdn.jsdelivr.net/npm/monaco-editor/min', autoFormatTime: 100, ...config };\n this.options = this._config.defaultOptions!;\n }\n\n protected abstract initMonaco(_options: monaco.editor.IStandaloneEditorConstructionOptions, _initEvent: boolean): void;\n\n protected notifyEvent(type: NuMonacoEditorEventType, other?: NuMonacoEditorEvent): void {\n this.ngZone.run(() => this.event.emit({ type, editor: this._editor!, ...other }));\n }\n\n protected setDisabled(): this {\n if (this._editor) {\n (this._editor as monaco.editor.IStandaloneCodeEditor).updateOptions({ readOnly: this._disabled });\n }\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 const baseUrl = this._config.baseUrl;\n const amdLoader = () => {\n win.require.config({ paths: { vs: `${baseUrl}/vs` } });\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}/vs/loader.js`;\n loaderScript.onload = amdLoader;\n loaderScript.onerror = () => 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 protected updateOptions(): void {\n if (!this._editor) return;\n this.ngZone.runOutsideAngular(() => {\n this._editor!.dispose();\n this.initMonaco(this._options, false);\n });\n }\n\n ngAfterViewInit(): void {\n this.ngZone.runOutsideAngular(() => setTimeout(() => this.init(), +this.delay));\n }\n\n ngOnChanges(changes: { [P in keyof this]?: SimpleChange } & SimpleChanges): void {\n const allKeys = Object.keys(changes);\n if (allKeys.length === 1 && allKeys[0] === 'disabled') return;\n this.updateOptions();\n }\n\n ngOnDestroy(): void {\n this.cleanResize();\n if (this._editor) {\n this._editor.dispose();\n this._editor = undefined;\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, forwardRef, Input } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { NuMonacoEditorBase } from './monaco-editor-base.component';\nimport { NuMonacoEditorModel } from './monaco-editor.types';\nimport { take, timer } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 standalone: true,\n})\nexport class NuMonacoEditorComponent extends NuMonacoEditorBase implements ControlValueAccessor {\n private _value = '';\n\n @Input() model?: NuMonacoEditorModel | null;\n @Input() autoFormat = true;\n\n get editor(): monaco.editor.IStandaloneCodeEditor {\n return this._editor as monaco.editor.IStandaloneCodeEditor;\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\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 }\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\n this.ngZone.run(() => {\n this._value = value;\n this.onChange(value);\n });\n });\n editor.onDidBlurEditorWidget(() => this.onTouched());\n\n this.registerResize();\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 const action = editor.getAction('editor.action.formatDocument');\n if (action == null) {\n this.notifyEvent(eventName);\n return;\n }\n action.run().then(() => this.notifyEvent(eventName));\n });\n return;\n }\n this.notifyEvent(eventName);\n }\n\n writeValue(value: string): void {\n this._value = value || '';\n if (this._editor) {\n (this._editor as monaco.editor.IStandaloneCodeEditor).setValue(this._value);\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(_isDisabled: boolean): void {\n this.disabled = _isDisabled;\n this.setDisabled();\n }\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\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 standalone: true,\n})\nexport class NuMonacoEditorDiffComponent extends NuMonacoEditorBase {\n @Input() old!: NuMonacoEditorDiffModel | null;\n @Input() new!: NuMonacoEditorDiffModel | null;\n\n get editor(): monaco.editor.IStandaloneDiffEditor {\n return this._editor as monaco.editor.IStandaloneDiffEditor;\n }\n\n initMonaco(options: monaco.editor.IStandaloneEditorConstructionOptions, initEvent: boolean): void {\n if (!this.old || !this.new) {\n throw new Error('old or new not found for nu-monaco-diff-editor');\n }\n\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(this.old.code, this.old.language || options.language),\n modified: monaco.editor.createModel(this.new.code, this.new.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","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { NuMonacoEditorDiffComponent } from './monaco-editor-diff.component';\nimport { NuMonacoEditorComponent } from './monaco-editor.component';\nimport { NuMonacoEditorConfig, NU_MONACO_EDITOR_CONFIG } from './monaco-editor.config';\n\nconst COMPONENTS = [NuMonacoEditorComponent, NuMonacoEditorDiffComponent];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS,\n})\nexport class NuMonacoEditorModule {\n static forRoot(config?: NuMonacoEditorConfig): ModuleWithProviders<NuMonacoEditorModule> {\n return {\n ngModule: NuMonacoEditorModule,\n providers: [{ provide: NU_MONACO_EDITOR_CONFIG, useValue: config }],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\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,EAAA,IAAA,EAAA,oBAAoB,YAHrB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAGX,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC;AACtC,oBAAA,OAAO,EAAE,UAAU;AACpB,iBAAA,CAAA;;;ACXD;;AAEG;;;;"}
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChange, SimpleChanges } from '@angular/core';
1
+ import { AfterViewInit, DestroyRef, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChange, SimpleChanges } from '@angular/core';
2
2
  import { Subscription } from 'rxjs';
3
3
  import { NuMonacoEditorConfig } from './monaco-editor.config';
4
4
  import { NuMonacoEditorEvent, NuMonacoEditorEventType } from './monaco-editor.types';
@@ -7,6 +7,7 @@ export declare abstract class NuMonacoEditorBase implements AfterViewInit, OnCha
7
7
  protected el: ElementRef<HTMLElement>;
8
8
  protected doc: any;
9
9
  protected ngZone: NgZone;
10
+ protected destroy$: DestroyRef;
10
11
  protected _editor?: monaco.editor.IStandaloneCodeEditor | monaco.editor.IStandaloneDiffEditor;
11
12
  protected _options: monaco.editor.IStandaloneEditorConstructionOptions;
12
13
  protected _resize$: Subscription | null;
@@ -18,7 +19,7 @@ export declare abstract class NuMonacoEditorBase implements AfterViewInit, OnCha
18
19
  set options(val: monaco.editor.IStandaloneEditorConstructionOptions);
19
20
  get options(): monaco.editor.IStandaloneEditorConstructionOptions;
20
21
  event: EventEmitter<NuMonacoEditorEvent>;
21
- constructor(el: ElementRef<HTMLElement>, config: NuMonacoEditorConfig, doc: any, ngZone: NgZone);
22
+ constructor(el: ElementRef<HTMLElement>, config: NuMonacoEditorConfig, doc: any, ngZone: NgZone, destroy$: DestroyRef);
22
23
  protected abstract initMonaco(_options: monaco.editor.IStandaloneEditorConstructionOptions, _initEvent: boolean): void;
23
24
  protected notifyEvent(type: NuMonacoEditorEventType, other?: NuMonacoEditorEvent): void;
24
25
  protected setDisabled(): this;
@@ -19,4 +19,8 @@ export interface NuMonacoEditorConfig {
19
19
  * The event before the first preload of the monaco editor library is completed, use this function to set nls availableLanguages.
20
20
  */
21
21
  monacoPreLoad?: () => void;
22
+ /**
23
+ * Trigger automatic format delay time, default: `100`
24
+ */
25
+ autoFormatTime?: number;
22
26
  }