@dodona/papyros
Version:
Scratchpad for multiple programming languages in the browser.
53 lines • 2.24 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { customElement } from "lit/decorators.js";
import { css, html } from "lit";
import "../code_mirror/BatchInputEditor";
import { RunState } from "../../state/Runner";
import { PapyrosElement } from "../PapyrosElement";
let BatchInput = class BatchInput extends PapyrosElement {
static get styles() {
return css `
:host {
width: 100%;
height: 100%;
overflow: auto;
display: block;
}
`;
}
get usedLines() {
if (this.papyros.debugger.active && this.papyros.debugger.debugUsedInputs !== undefined) {
return this.papyros.debugger.debugUsedInputs;
}
return this.papyros.io.inputs.length;
}
get placeholder() {
if (this.papyros.io.prompt) {
return this.papyros.io.prompt;
}
return this.t("Papyros.input_placeholder.batch");
}
render() {
return html `
<p-batch-input-editor
.value=${this.papyros.io.inputBuffer}
.usedLines=${this.usedLines}
.readOnly=${this.papyros.debugger.active && this.papyros.runner.state === RunState.Ready}
.placeholder=${this.placeholder}
.translations=${this.papyros.i18n.getTranslations("CodeMirror")}
.theme=${this.papyros.constants.CodeMirrorTheme}
=${(e) => (this.papyros.io.inputBuffer = e.detail)}
></p-batch-input-editor>
`;
}
};
BatchInput = __decorate([
customElement("p-batch-input")
], BatchInput);
export { BatchInput };
//# sourceMappingURL=BatchInput.js.map