2023-05-24 12:53:29 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
2023-09-25 19:11:55 +00:00
|
|
|
@layer primevue {
|
|
|
|
.p-terminal {
|
|
|
|
height: 18rem;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-terminal-prompt-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-terminal-input {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
border: 0 none;
|
|
|
|
background-color: transparent;
|
|
|
|
color: inherit;
|
|
|
|
padding: 0;
|
|
|
|
outline: 0 none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-terminal-input::-ms-clear {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-05-24 12:53:29 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: 'p-terminal p-component',
|
|
|
|
content: 'p-terminal-content',
|
|
|
|
prompt: 'p-terminal-prompt',
|
|
|
|
command: 'p-terminal-command',
|
|
|
|
response: 'p-terminal-response',
|
|
|
|
container: 'p-terminal-prompt-container',
|
|
|
|
commandText: 'p-terminal-input'
|
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'terminal', manual: true });
|
2023-05-24 12:53:29 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseTerminal',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
welcomeMessage: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
prompt: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-05-30 12:28:04 +00:00
|
|
|
classes,
|
|
|
|
loadStyle
|
2023-05-24 12:53:29 +00:00
|
|
|
},
|
2023-05-30 12:28:04 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-24 12:53:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|