UNPKG

@dodona/papyros

Version:

Scratchpad for multiple programming languages in the browser.

72 lines (71 loc) 3.15 kB
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 { RunState } from "../../state/Runner"; import { PapyrosElement } from "../PapyrosElement"; import { RunMode } from "../../../backend/Backend"; import "@material/web/button/filled-button"; import "@material/web/button/outlined-button"; let ButtonLint = class ButtonLint extends PapyrosElement { static get styles() { return css ` :host { display: flex; justify-content: space-between; height: fit-content; padding: 0.5rem; gap: 1rem; flex-wrap: wrap; } .buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; } `; } get buttons() { if (this.papyros.runner.state === RunState.Ready) { if (this.papyros.debugger.active) { return html ` <md-outlined-button @click=${() => (this.papyros.debugger.active = false)}> <span slot="icon">${this.papyros.constants.icons.stopDebug}</span> ${this.t("Papyros.debug.stop")} </md-outlined-button>`; } else { return [ html ` <md-filled-button @click=${() => this.papyros.runner.start(RunMode.Run)}> <span slot="icon">${this.papyros.constants.icons[RunMode.Run]}</span> ${this.t(`Papyros.run_modes.${RunMode.Run}`)} </md-filled-button>`, ...this.papyros.runner.runModes.map((mode) => html ` <md-outlined-button @click=${() => this.papyros.runner.start(mode)}> <span slot="icon">${this.papyros.constants.icons[mode]}</span> ${this.t(`Papyros.run_modes.${mode}`)} </md-outlined-button>`), ]; } } else { return html ` <md-filled-button @click=${() => this.papyros.runner.stop()}> <span slot="icon">${this.papyros.constants.icons.stop}</span> ${this.t("Papyros.stop")} </md-filled-button>`; } } render() { return html ` <div class="buttons">${this.buttons}</div> <div class="buttons"><slot></slot></div> `; } }; ButtonLint = __decorate([ customElement("p-button-lint") ], ButtonLint); export { ButtonLint }; //# sourceMappingURL=ButtonLint.js.map