UNPKG

@dodona/papyros

Version:

Scratchpad for multiple programming languages in the browser.

58 lines (57 loc) 2.37 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, property } from "lit/decorators.js"; import { PapyrosElement } from "./PapyrosElement"; import { css, html } from "lit"; import { CODE_TAB } from "../state/InputOutput"; import "./EditorTab"; import "./AddFileButton"; import { tabButtonStyles } from "./shared-styles"; let EditorTabs = class EditorTabs extends PapyrosElement { constructor() { super(...arguments); this.files = []; } static get styles() { return css ` :host { display: flex; flex-direction: row; gap: 0.25rem; padding: 0.25rem 0.25rem 0; background-color: var(--md-sys-color-surface-container); border-radius: 0.5rem 0.5rem 0 0; max-height: 2.5rem; flex-shrink: 0; overflow-x: auto; } ${tabButtonStyles} `; } render() { const activeTab = this.papyros.io.activeEditorTab; const debugActive = this.papyros.debugger.active; return html ` <button class=${activeTab === CODE_TAB ? "active" : ""} @click=${() => (this.papyros.io.activeEditorTab = CODE_TAB)} > ${this.t("Papyros.editor_tab_code")} </button> ${this.files.map((f) => html `<p-editor-tab .papyros=${this.papyros} .file=${f}></p-editor-tab>`)} ${debugActive ? "" : html `<p-add-file-button .papyros=${this.papyros}></p-add-file-button>`} `; } }; __decorate([ property({ attribute: false }) ], EditorTabs.prototype, "files", void 0); EditorTabs = __decorate([ customElement("p-editor-tabs") ], EditorTabs); export { EditorTabs }; //# sourceMappingURL=EditorTabs.js.map