import { LitElement, html, css } from 'lit'; import { customElement } from 'lit/decorators.js'; import { Spell } from './Spell'; @customElement('spell-scryer') export class Scryer extends LitElement { isSpellPaneOpen: boolean = false; currentSpell: Spell | null = null; spellCount: number = 0; getCurrentSpell() { if (this.currentSpell) { const spell = { ...this.currentSpell }; this.currentSpell = null; return spell; } return null; } setCurrentSpell(spell: Spell) { this.currentSpell = spell; this.spellCount = 1; if (this.isSpellPaneOpen) { this.toggleSpellPane(); } } dismissAddModal() { this.currentSpell = null; this.spellCount = 0; this.requestUpdate(); } setSpellCount() { this.spellCount = 1; } toggleSpellPane() { this.isSpellPaneOpen = !this.isSpellPaneOpen; this.requestUpdate(); } static get styles() { let globalStyle = ''; for (let styleSheetI = 0; styleSheetI < document.styleSheets.length; styleSheetI++) { const { cssRules } = document.styleSheets[styleSheetI]; globalStyle = `${globalStyle}\n${Object.values(cssRules).map(rule => rule.cssText).join('\n')}`; } const stringArray = [globalStyle] as any; stringArray.raw = [globalStyle]; return [ css(stringArray as TemplateStringsArray), css` @media (min-width: 501px) { .the_board >* { width: 15em; } } .spell_scryer { width: 100%; } a, a:hover, a:visited { color: black; text-decoration: none; } a:hover { text-decoration: underline; } .spell_list { position: fixed; z-index: 9999; background-color: white; } .the_board { display: flex; justify-content: center; flex-direction: row; text-align: center; } .the_board >* { padding: .25em; } ` ]; } override render() { return html`
Close
Spells
`; } } declare global { interface HTMLElementTagNameMap { 'spell-scryer': Scryer; } }