{"version":3,"file":"ng-zorro-antd-code-editor.mjs","sources":["../../components/code-editor/typings.ts","../../components/code-editor/code-editor.service.ts","../../components/code-editor/code-editor.component.ts","../../components/code-editor/code-editor.module.ts","../../components/code-editor/public-api.ts","../../components/code-editor/ng-zorro-antd-code-editor.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { editor } from 'monaco-editor';\n\nimport IStandAloneEditorConstructionOptions = editor.IStandaloneEditorConstructionOptions;\nimport IDiffEditorConstructionOptions = editor.IDiffEditorConstructionOptions;\n\nexport type EditorOptions = IStandAloneEditorConstructionOptions;\nexport type DiffEditorOptions = IDiffEditorConstructionOptions;\nexport type JoinedEditorOptions = EditorOptions | DiffEditorOptions;\n\nexport type NzEditorMode = 'normal' | 'diff';\n\nexport const NzCodeEditorLoadingStatus = {\n  UNLOAD: 'unload',\n  LOADING: 'loading',\n  LOADED: 'LOADED'\n} as const;\n\nexport type NzCodeEditorLoadingStatus = (typeof NzCodeEditorLoadingStatus)[keyof typeof NzCodeEditorLoadingStatus];\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { DOCUMENT, inject, Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\nimport { CodeEditorConfig, NzConfigService, onConfigChangeEventForComponent } from 'ng-zorro-antd/core/config';\nimport { PREFIX, warn } from 'ng-zorro-antd/core/logger';\nimport { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { JoinedEditorOptions, NzCodeEditorLoadingStatus } from './typings';\n\ndeclare const monaco: NzSafeAny;\n\nconst NZ_CONFIG_MODULE_NAME = 'codeEditor';\n\nfunction tryTriggerFunc(fn?: (...args: NzSafeAny[]) => NzSafeAny): (...args: NzSafeAny) => void {\n  return (...args: NzSafeAny[]) => {\n    if (fn) {\n      fn(...args);\n    }\n  };\n}\n\n// Caretaker note: previously, these were `NzCodeEditorService` properties.\n// They're kept as static variables because this will allow loading Monaco only once.\n// This applies to micro frontend apps with multiple Angular apps or a single Angular app\n// that can be bootstrapped and destroyed multiple times (e.g. using Webpack module federation).\n// Root providers are re-initialized each time the app is bootstrapped. Platform providers aren't.\n// We can't make the `NzCodeEditorService` to be a platform provider (`@Injectable({ providedIn: 'platform' })`)\n// since it depends on other root providers.\nconst loaded$ = new ReplaySubject<boolean>(1);\nlet loadingStatus: NzCodeEditorLoadingStatus = NzCodeEditorLoadingStatus.UNLOAD;\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class NzCodeEditorService {\n  private readonly nzConfigService = inject(NzConfigService);\n  private document: Document = inject(DOCUMENT);\n  private firstEditorInitialized = false;\n  private option: JoinedEditorOptions = {};\n  private config: CodeEditorConfig;\n\n  option$ = new BehaviorSubject<JoinedEditorOptions>(this.option);\n\n  constructor() {\n    const globalConfig = this.nzConfigService.getConfigForComponent(NZ_CONFIG_MODULE_NAME);\n\n    this.config = { ...globalConfig };\n    if (this.config.monacoEnvironment) {\n      (this.document.defaultView as NzSafeAny).MonacoEnvironment = { ...this.config.monacoEnvironment };\n    }\n    this.option = this.config.defaultEditorOption || {};\n\n    onConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME, () => {\n      const newGlobalConfig: NzSafeAny = this.nzConfigService.getConfigForComponent(NZ_CONFIG_MODULE_NAME);\n      if (newGlobalConfig) {\n        this._updateDefaultOption(newGlobalConfig.defaultEditorOption);\n      }\n    });\n  }\n\n  private _updateDefaultOption(option: JoinedEditorOptions): void {\n    this.option = { ...this.option, ...option };\n    this.option$.next(this.option);\n\n    if ('theme' in option && option.theme) {\n      monaco.editor.setTheme(option.theme);\n    }\n  }\n\n  requestToInit(): Observable<JoinedEditorOptions> {\n    if (loadingStatus === NzCodeEditorLoadingStatus.LOADED) {\n      this.onInit();\n      return of(this.getLatestOption());\n    }\n\n    if (loadingStatus === NzCodeEditorLoadingStatus.UNLOAD) {\n      if (this.config.useStaticLoading && typeof monaco === 'undefined') {\n        warn(\n          'You choose to use static loading but it seems that you forget ' +\n            'to config webpack plugin correctly. Please refer to our official website' +\n            'for more details about static loading.'\n        );\n      } else {\n        this.loadMonacoScript();\n      }\n    }\n\n    return loaded$.pipe(\n      tap(() => this.onInit()),\n      map(() => this.getLatestOption())\n    );\n  }\n\n  private loadMonacoScript(): void {\n    if (this.config.useStaticLoading) {\n      Promise.resolve().then(() => this.onLoad());\n      return;\n    }\n\n    if (loadingStatus === NzCodeEditorLoadingStatus.LOADING) {\n      return;\n    }\n\n    loadingStatus = NzCodeEditorLoadingStatus.LOADING;\n\n    const assetsRoot = this.config.assetsRoot;\n    const vs = assetsRoot ? `${assetsRoot}/vs` : 'assets/vs';\n    const windowAsAny = window as NzSafeAny;\n    const loadScript = this.document.createElement('script');\n\n    loadScript.type = 'text/javascript';\n    loadScript.src = `${vs}/loader.js`;\n\n    const onLoad = (): void => {\n      cleanup();\n      windowAsAny.require.config({\n        paths: { vs },\n        ...this.config.extraConfig\n      });\n      windowAsAny.require(['vs/editor/editor.main'], () => {\n        this.onLoad();\n      });\n    };\n\n    const onError = (): void => {\n      cleanup();\n      throw new Error(`${PREFIX} cannot load assets of monaco editor from source \"${vs}\".`);\n    };\n\n    const cleanup = (): void => {\n      // Caretaker note: we have to remove these listeners once the `<script>` is loaded successfully\n      // or not since the `onLoad` listener captures `this`, which will prevent the `NzCodeEditorService`\n      // from being garbage collected.\n      loadScript.removeEventListener('load', onLoad);\n      loadScript.removeEventListener('error', onError);\n      // We don't need to keep the `<script>` element within the `<body>` since JavaScript has\n      // been executed and Monaco is available globally. E.g. Webpack, always removes `<script>`\n      // elements after loading chunks (see its `LoadScriptRuntimeModule`).\n      this.document.documentElement.removeChild(loadScript);\n    };\n\n    loadScript.addEventListener('load', onLoad);\n    loadScript.addEventListener('error', onError);\n\n    this.document.documentElement.appendChild(loadScript);\n  }\n\n  private onLoad(): void {\n    loadingStatus = NzCodeEditorLoadingStatus.LOADED;\n    loaded$.next(true);\n    loaded$.complete();\n\n    tryTriggerFunc(this.config.onLoad)();\n  }\n\n  private onInit(): void {\n    if (!this.firstEditorInitialized) {\n      this.firstEditorInitialized = true;\n      tryTriggerFunc(this.config.onFirstEditorInit)();\n    }\n\n    tryTriggerFunc(this.config.onInit)();\n  }\n\n  private getLatestOption(): JoinedEditorOptions {\n    return { ...this.option };\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Platform } from '@angular/cdk/platform';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n  AfterViewInit,\n  booleanAttribute,\n  ChangeDetectionStrategy,\n  Component,\n  DestroyRef,\n  ElementRef,\n  EventEmitter,\n  forwardRef,\n  inject,\n  Input,\n  NgZone,\n  Output,\n  TemplateRef,\n  ViewEncapsulation\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BehaviorSubject, combineLatest, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, map } from 'rxjs/operators';\n\nimport type { editor, IDisposable } from 'monaco-editor';\n\nimport { warn } from 'ng-zorro-antd/core/logger';\nimport { NzSafeAny, OnChangeType, OnTouchedType } from 'ng-zorro-antd/core/types';\nimport { fromEventOutsideAngular, inNextTick } from 'ng-zorro-antd/core/util';\nimport { NzSpinComponent } from 'ng-zorro-antd/spin';\n\nimport { NzCodeEditorService } from './code-editor.service';\nimport { DiffEditorOptions, EditorOptions, JoinedEditorOptions, NzEditorMode } from './typings';\n\n// Import types from monaco editor.\ntype ITextModel = editor.ITextModel;\ntype IStandaloneCodeEditor = editor.IStandaloneCodeEditor;\ntype IStandaloneDiffEditor = editor.IStandaloneDiffEditor;\n\ndeclare const monaco: NzSafeAny;\n\n@Component({\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n  selector: 'nz-code-editor',\n  exportAs: 'nzCodeEditor',\n  template: `\n    @if (nzLoading) {\n      <div class=\"ant-code-editor-loading\">\n        <nz-spin />\n      </div>\n    }\n    @if (nzToolkit) {\n      <div class=\"ant-code-editor-toolkit\">\n        <ng-template [ngTemplateOutlet]=\"nzToolkit\" />\n      </div>\n    }\n  `,\n  providers: [\n    {\n      provide: NG_VALUE_ACCESSOR,\n      useExisting: forwardRef(() => NzCodeEditorComponent),\n      multi: true\n    }\n  ],\n  imports: [NzSpinComponent, NgTemplateOutlet]\n})\nexport class NzCodeEditorComponent implements AfterViewInit, ControlValueAccessor {\n  private nzCodeEditorService = inject(NzCodeEditorService);\n  private ngZone = inject(NgZone);\n  private platform = inject(Platform);\n  private destroyRef = inject(DestroyRef);\n\n  @Input() nzEditorMode: NzEditorMode = 'normal';\n  @Input() nzOriginalText = '';\n  @Input({ transform: booleanAttribute }) nzLoading = false;\n  @Input({ transform: booleanAttribute }) nzFullControl = false;\n  @Input() nzToolkit?: TemplateRef<void>;\n\n  @Input() set nzEditorOption(value: JoinedEditorOptions) {\n    this.editorOption$.next(value);\n  }\n\n  @Output() readonly nzEditorInitialized = new EventEmitter<IStandaloneCodeEditor | IStandaloneDiffEditor>();\n\n  editorOptionCached: JoinedEditorOptions = {};\n\n  private readonly el: HTMLElement = inject(ElementRef<HTMLElement>).nativeElement;\n  private resize$ = new Subject<void>();\n  private editorOption$ = new BehaviorSubject<JoinedEditorOptions>({});\n  private editorInstance: IStandaloneCodeEditor | IStandaloneDiffEditor | null = null;\n  private value = '';\n  private modelSet = false;\n  private onDidChangeContentDisposable: IDisposable | null = null;\n\n  constructor() {\n    this.el.classList.add('ant-code-editor');\n    this.destroyRef.onDestroy(() => {\n      if (this.onDidChangeContentDisposable) {\n        this.onDidChangeContentDisposable.dispose();\n        this.onDidChangeContentDisposable = null;\n      }\n\n      if (this.editorInstance) {\n        this.editorInstance.dispose();\n        this.editorInstance = null;\n      }\n    });\n  }\n\n  /**\n   * Initialize a monaco editor instance.\n   */\n  ngAfterViewInit(): void {\n    if (!this.platform.isBrowser) {\n      return;\n    }\n\n    this.nzCodeEditorService\n      .requestToInit()\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(option => this.setup(option));\n  }\n\n  writeValue(value: string): void {\n    this.value = value;\n    this.setValue();\n  }\n\n  registerOnChange(fn: OnChangeType): NzSafeAny {\n    this.onChange = fn;\n  }\n\n  registerOnTouched(fn: OnTouchedType): void {\n    this.onTouch = fn;\n  }\n\n  onChange: OnChangeType = (_value: string) => {};\n\n  onTouch: OnTouchedType = () => {};\n\n  layout(): void {\n    this.resize$.next();\n  }\n\n  private setup(option: JoinedEditorOptions): void {\n    // The `setup()` is invoked when the Monaco editor is loaded. This may happen asynchronously for the first\n    // time, and it'll always happen synchronously afterwards. The first `setup()` invokation is outside the Angular\n    // zone, but further invokations will happen within the Angular zone. We call the `setModel()` on the editor\n    // instance, which tells Monaco to add event listeners lazily internally (`mousemove`, `mouseout`, etc.).\n    // We should avoid adding them within the Angular zone since this will drastically affect the performance.\n    this.ngZone.runOutsideAngular(() =>\n      inNextTick()\n        .pipe(takeUntilDestroyed(this.destroyRef))\n        .subscribe(() => {\n          this.editorOptionCached = option;\n          this.registerOptionChanges();\n          this.initMonacoEditorInstance();\n          this.registerResizeChange();\n          this.setValue();\n\n          if (!this.nzFullControl) {\n            this.setValueEmitter();\n          }\n\n          if (this.nzEditorInitialized.observers.length) {\n            this.ngZone.run(() => this.nzEditorInitialized.emit(this.editorInstance!));\n          }\n        })\n    );\n  }\n\n  private registerOptionChanges(): void {\n    combineLatest([this.editorOption$, this.nzCodeEditorService.option$])\n      .pipe(takeUntilDestroyed(this.destroyRef))\n      .subscribe(([selfOpt, defaultOpt]) => {\n        this.editorOptionCached = {\n          ...this.editorOptionCached,\n          ...defaultOpt,\n          ...selfOpt\n        };\n        this.updateOptionToMonaco();\n      });\n  }\n\n  private initMonacoEditorInstance(): void {\n    this.ngZone.runOutsideAngular(() => {\n      this.editorInstance =\n        this.nzEditorMode === 'normal'\n          ? monaco.editor.create(this.el, { ...this.editorOptionCached })\n          : monaco.editor.createDiffEditor(this.el, {\n              ...(this.editorOptionCached as DiffEditorOptions)\n            });\n    });\n  }\n\n  private registerResizeChange(): void {\n    fromEventOutsideAngular(window, 'resize')\n      .pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef))\n      .subscribe(() => {\n        this.layout();\n      });\n\n    this.resize$\n      .pipe(\n        takeUntilDestroyed(this.destroyRef),\n        filter(() => !!this.editorInstance),\n        map(() => ({\n          width: this.el.clientWidth,\n          height: this.el.clientHeight\n        })),\n        distinctUntilChanged((a, b) => a.width === b.width && a.height === b.height),\n        debounceTime(50)\n      )\n      .subscribe(() => {\n        this.editorInstance!.layout();\n      });\n  }\n\n  private setValue(): void {\n    if (!this.editorInstance) {\n      return;\n    }\n\n    if (this.nzFullControl && this.value) {\n      warn(`should not set value when you are using full control mode! It would result in ambiguous data flow!`);\n      return;\n    }\n\n    if (this.nzEditorMode === 'normal') {\n      if (this.modelSet) {\n        const model = this.editorInstance.getModel() as ITextModel;\n        this.preservePositionAndSelections(() => model.setValue(this.value));\n      } else {\n        (this.editorInstance as IStandaloneCodeEditor).setModel(\n          monaco.editor.createModel(this.value, (this.editorOptionCached as EditorOptions).language)\n        );\n        this.modelSet = true;\n      }\n    } else {\n      if (this.modelSet) {\n        const model = (this.editorInstance as IStandaloneDiffEditor).getModel()!;\n        this.preservePositionAndSelections(() => {\n          model.modified.setValue(this.value);\n          model.original.setValue(this.nzOriginalText);\n        });\n      } else {\n        const language = (this.editorOptionCached as EditorOptions).language;\n        (this.editorInstance as IStandaloneDiffEditor).setModel({\n          original: monaco.editor.createModel(this.nzOriginalText, language),\n          modified: monaco.editor.createModel(this.value, language)\n        });\n        this.modelSet = true;\n      }\n    }\n  }\n\n  /**\n   * {@link editor.ICodeEditor}#setValue resets the cursor position to the start of the document.\n   * This helper memorizes the cursor position and selections and restores them after the given\n   * function has been called.\n   */\n  private preservePositionAndSelections(fn: () => unknown): void {\n    if (!this.editorInstance) {\n      fn();\n      return;\n    }\n\n    const position = this.editorInstance.getPosition();\n    const selections = this.editorInstance.getSelections();\n\n    fn();\n\n    if (position) {\n      this.editorInstance.setPosition(position);\n    }\n    if (selections) {\n      this.editorInstance.setSelections(selections);\n    }\n  }\n\n  private setValueEmitter(): void {\n    const model = (\n      this.nzEditorMode === 'normal'\n        ? (this.editorInstance as IStandaloneCodeEditor).getModel()\n        : (this.editorInstance as IStandaloneDiffEditor).getModel()!.modified\n    ) as ITextModel;\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    // (`nz-code-editor -> monaco -> nz-code-editor`) and prevents the `nz-code-editor` from being GC'd.\n    this.onDidChangeContentDisposable = model.onDidChangeContent(() => {\n      this.emitValue(model.getValue());\n    });\n  }\n\n  private emitValue(value: string): void {\n    if (this.value === value) {\n      // If the value didn't change there's no reason to send an update.\n      // Specifically this may happen during an update from the model (writeValue) where sending an update to the model would actually be incorrect.\n      return;\n    }\n\n    this.value = value;\n    // We're re-entering the Angular zone only if the value has been changed since there's a `return` expression previously.\n    // This won't cause \"dead\" change detections (basically when the `tick()` has been run, but there's nothing to update).\n    this.ngZone.run(() => {\n      this.onChange(value);\n    });\n  }\n\n  private updateOptionToMonaco(): void {\n    if (this.editorInstance) {\n      this.editorInstance.updateOptions({ ...this.editorOptionCached });\n    }\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\n\nimport { NzCodeEditorComponent } from './code-editor.component';\n\n@NgModule({\n  imports: [NzCodeEditorComponent],\n  exports: [NzCodeEditorComponent]\n})\nexport class NzCodeEditorModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './typings';\nexport * from './code-editor.component';\nexport * from './code-editor.module';\nexport * from './code-editor.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;AAGG;AAaI,MAAM,yBAAyB,GAAG;AACvC,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,MAAM,EAAE;;;ACnBV;;;AAGG;AAcH,MAAM,qBAAqB,GAAG,YAAY;AAE1C,SAAS,cAAc,CAAC,EAAwC,EAAA;AAC9D,IAAA,OAAO,CAAC,GAAG,IAAiB,KAAI;QAC9B,IAAI,EAAE,EAAE;AACN,YAAA,EAAE,CAAC,GAAG,IAAI,CAAC;QACb;AACF,IAAA,CAAC;AACH;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC;AAC7C,IAAI,aAAa,GAA8B,yBAAyB,CAAC,MAAM;MAKlE,mBAAmB,CAAA;AACb,IAAA,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;AAClD,IAAA,QAAQ,GAAa,MAAM,CAAC,QAAQ,CAAC;IACrC,sBAAsB,GAAG,KAAK;IAC9B,MAAM,GAAwB,EAAE;AAChC,IAAA,MAAM;IAEd,OAAO,GAAG,IAAI,eAAe,CAAsB,IAAI,CAAC,MAAM,CAAC;AAE/D,IAAA,WAAA,GAAA;QACE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,qBAAqB,CAAC;AAEtF,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,YAAY,EAAE;AACjC,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE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