Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-terminal.mjs.map

1 line
9.6 KiB
Plaintext
Raw Normal View History

2024-07-16 15:23:22 +00:00
{"version":3,"file":"primeng-terminal.mjs","sources":["../../src/app/components/terminal/terminalservice.ts","../../src/app/components/terminal/terminal.ts","../../src/app/components/terminal/primeng-terminal.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable()\nexport class TerminalService {\n private commandSource = new Subject<string>();\n private responseSource = new Subject<string>();\n\n commandHandler = this.commandSource.asObservable();\n responseHandler = this.responseSource.asObservable();\n\n sendCommand(command: string) {\n if (command) {\n this.commandSource.next(command);\n }\n }\n\n sendResponse(response: string) {\n if (response) {\n this.responseSource.next(response);\n }\n }\n}\n","import { NgModule, Component, AfterViewInit, AfterViewChecked, OnDestroy, Input, ElementRef, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { DomHandler } from 'primeng/dom';\nimport { TerminalService } from './terminalservice';\nimport { Subscription } from 'rxjs';\n/**\n * Terminal is a text based user interface.\n * @group Components\n */\n@Component({\n selector: 'p-terminal',\n template: `\n <div [ngClass]=\"'p-terminal p-component'\" [ngStyle]=\"style\" [class]=\"styleClass\" (click)=\"focus(in)\">\n <div *ngIf=\"welcomeMessage\">{{ welcomeMessage }}</div>\n <div class=\"p-terminal-content\">\n <div *ngFor=\"let command of commands\">\n <span class=\"p-terminal-prompt\">{{ prompt }}</span>\n <span class=\"p-terminal-command\">{{ command.text }}</span>\n <div class=\"p-terminal-response\" [attr.aria-live]=\"'polite'\">{{ command.response }}</div>\n </div>\n </div>\n <div class=\"p-terminal-prompt-container\">\n <span class=\"p-terminal-content-prompt\">{{ prompt }}</span>\n <input #in type=\"text\" [(ngModel)]=\"command\" class=\"p-terminal-input\" autocomplete=\"off\" (keydown)=\"handleCommand($event)\" autofocus />\n </div>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./terminal.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class Terminal implements AfterViewInit, AfterViewChecked, OnDestroy {\n /**\n * Initial text to display on terminal.\n * @group Props\n */\n @Input() welcomeMessage: string | undefined;\n /**\n * Prompt text for each command.\n * @group Props\n */\n @Input() prompt: string | undefined;\n /**\n * Inline style of the component.\n * @group Props\n */\n @Input() style: { [klass: string]: any } | null | undefined;\n /**\n * Style class of the component.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n\n commands: any[] = [];\n\n command!: string;\n\n container!: Element;\n\n commandProcessed!: boolean;\n\n subscription: Subscription;\n\n constructor(public el: ElementRef, public terminalService: TerminalService, public cd: ChangeDetectorRef) {\n this.subscription = terminalService.responseHandler.subscribe((response) => {\n this.commands[this.commands.length - 1].response = response;\n this.commandProcessed = true;\n });\n }\n\n ngAfterViewInit() {\n this.container = DomHandler.find(this.el.nativeElement, '.p-terminal')[0];\n }\n\n ngAfterViewChecked() {\n if (this.commandProcessed) {\n this.container.scrollTop = this.container.scrollHeight;\n this.commandProcessed = false;\n }\n }\n\n @Input()\n set response(value: string) {\n if (value) {\n this.commands[this.commands.length - 1].response = value;\n