UNPKG

ui-lit

Version:

UI Elements on LIT

44 lines (43 loc) 1.14 kB
import { __decorate } from "tslib"; import { customElement, property, query } from 'lit/decorators.js'; import { LitElement, html, css } from 'lit'; import QRCode from 'qrcode'; let LitQRCode = class LitQRCode extends LitElement { constructor() { super(...arguments); this.value = ''; this.width = 200; } _setQRCode() { QRCode.toCanvas(this.canvas, this.value, { width: this.width }); } updated() { this._setQRCode(); } render() { return html `<canvas></canvas>`; } }; LitQRCode.styles = css ` :host{ display: inline-flex; justify-content: center; align-items: center; contain: content; } canvas{ display: block; }`; __decorate([ query('canvas') ], LitQRCode.prototype, "canvas", void 0); __decorate([ property({ type: String }) ], LitQRCode.prototype, "value", void 0); __decorate([ property({ type: Number }) ], LitQRCode.prototype, "width", void 0); LitQRCode = __decorate([ customElement('lit-qrcode') ], LitQRCode); export { LitQRCode };