1 line
9.7 KiB
Plaintext
1 line
9.7 KiB
Plaintext
|
|
{"version":3,"file":"index.mjs","sources":["../../src/terminal/BaseTerminal.vue","../../src/terminal/Terminal.vue","../../src/terminal/Terminal.vue?vue&type=template&id=df319ce0&lang.js"],"sourcesContent":["<script>\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TerminalStyle from 'primevue/terminal/style';\n\nexport default {\n name: 'BaseTerminal',\n extends: BaseComponent,\n props: {\n welcomeMessage: {\n type: String,\n default: null\n },\n prompt: {\n type: String,\n default: null\n }\n },\n style: TerminalStyle,\n provide() {\n return {\n $pcTerminal: this,\n $parentInstance: this\n };\n }\n};\n</script>\n","<template>\n <div :class=\"cx('root')\" @click=\"onClick\" v-bind=\"ptmi('root')\">\n <div v-if=\"welcomeMessage\" :class=\"cx('welcomeMessage')\" v-bind=\"ptm('welcomeMessage')\">{{ welcomeMessage }}</div>\n <div :class=\"cx('commandList')\" v-bind=\"ptm('content')\">\n <div v-for=\"(command, i) of commands\" :key=\"command.text + i.toString()\" :class=\"cx('command')\" v-bind=\"ptm('commands')\">\n <span :class=\"cx('promptLabel')\" v-bind=\"ptm('prompt')\">{{ prompt }}</span>\n <span :class=\"cx('commandValue')\" v-bind=\"ptm('command')\">{{ command.text }}</span>\n <div :class=\"cx('commandResponse')\" aria-live=\"polite\" v-bind=\"ptm('response')\">{{ command.response }}</div>\n </div>\n </div>\n <div :class=\"cx('prompt')\" v-bind=\"ptm('container')\">\n <span :class=\"cx('promptLabel')\" v-bind=\"ptm('prompt')\">{{ prompt }}</span>\n <input ref=\"input\" v-model=\"commandText\" :class=\"cx('promptValue')\" type=\"text\" autocomplete=\"off\" @keydown=\"onKeydown\" v-bind=\"ptm('commandText')\" />\n </div>\n </div>\n</template>\n\n<script>\nimport TerminalService from 'primevue/terminalservice';\nimport BaseTerminal from './BaseTerminal.vue';\n\nexport default {\n name: 'Terminal',\n extends: BaseTerminal,\n inheritAttrs: false,\n data() {\n return {\n commandText: null,\n commands: []\n };\n },\n mounted() {\n TerminalService.on('response', this.responseListener);\n this.$refs.input.focus();\n },\n updated() {\n this.$el.scrollTop = this.$el.scrollHeight;\n },\n beforeUnmount() {\n TerminalService.off('response', this.responseListener);\n },\n methods: {\n onClick() {\n this.$refs.input.focus();\n },\n onKeydown(event) {\n if (event.key === 'Enter' && this.commandText) {\n this.commands.push({ text: this.commandText });\n TerminalService.emit('command', this.commandText);\n this.commandText = '';\n }\n },\n responseListener(response) {\n this.commands[this.commands.length - 1].response = response;\n }\n }\n};\n</script>\n","<template>\n <div :class=\"cx('root')\" @click=\"onClick\" v-bind=\"ptmi('root')\">\n <div v-if=\"welcomeMessage\" :class=\"cx('welcomeMessage')\" v-bind=\"ptm('welcomeMessage')\">{{ welcomeMessage }}</div>\n <div :class=\"cx('commandList')\" v-bind=\"ptm('content')\">\n <div v-for=\"(command, i) of commands\" :key=\"command.text + i.toString()\" :class=\"cx('command')\" v-bind=\"ptm('commands')\">\n <span :class=\"cx('promptLabel')\" v-bind=\"ptm('prompt')\">{{ prompt }}</span>\n <span :class=\"cx('commandValue')\" v-bind=\"ptm('command')\">{{ command.text }}</span>\n <div :class=\"cx('commandResponse')\" aria-live=\"polite\" v-bind=\"ptm('response')\">{{ command.response }}</div>\n </div>\n </div>\n <div :class=\"cx('prompt')\" v-bind=\"ptm('container')\">\n <span :class=\"cx('promptLabel')\" v-bind=\"ptm('prompt')\">{{ prompt }}</span>\n <input ref=\"input\" v-
|