class VerticalStyleCard extends HTMLElement { constructor() { super(); // Make use of shadowRoot to avoid conflicts when reusing this.attachShadow({ mode: 'open' }); } setConfig(config) { if (!config || !config.cards || !Array.isArray(config.cards)) { throw new Error('Card config incorrect'); } const cardConfig = Object.assign({}, config); cardConfig.style = Object.assign({}, config.style); var prop = { "border": null , "background_color":null , "font_size":null} ; var cardSize = Object.keys(cardConfig.style); if (cardSize.length == 0) Object.assign(cardConfig.style, prop); if (cardConfig.style.border === undefined || cardConfig.style.border == null ) cardConfig.style.border = true; if (!cardConfig.style.background_color || cardConfig.style.background_color == null ) cardConfig.style.background_color = 'var(--paper-card-background-color)'; if (!cardConfig.style.font_size || cardConfig.style.font_size == null ) cardConfig.style.font_size = 'var(--paper-font-headline_-_font-size)'; this.style.background = cardConfig.style.background_color; this.style.padding = '5px 5px 5px 5px'; if (cardConfig.style.border == true){ this.style.boxShadow = "0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.15)"; this.style.borderRadius = "2px"; } const root = this.shadowRoot; while (root.lastChild) { root.removeChild(root.lastChild); } this._refCards = []; if (config.title) { const title = document.createElement("div"); title.className = "header"; title.style = "font-family: var(--paper-font-headline_-_font-family); -webkit-font-smoothing: var(--paper-font-headline_-_-webkit-font-smoothing); font-size: " + cardConfig.style.font_size + "; font-weight: var(--paper-font-headline_-_font-weight); letter-spacing: var(--paper-font-headline_-_letter-spacing); line-height: var(--paper-font-headline_-_line-height);text-rendering: var(--paper-font-common-expensive-kerning_-_text-rendering);opacity: var(--dark-primary-opacity);padding: 5px 16px 10px 16px"; title.innerHTML = '