/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { html, classMap, choose, when, } from "chrome://global/content/vendor/lit.all.mjs"; import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; export class ListItem extends MozLitElement { static get properties() { return { icon: { type: String }, selected: { type: Boolean }, }; } constructor() { super(); this.icon = ""; this.selected = false; } render() { const classes = { selected: this.selected, "list-item": true }; return html`
  • `; } } export class NewListItem extends MozLitElement { static properties = { icon: { type: String }, selected: { type: Boolean }, }; constructor() { super(); this.id = "new-login-list-item"; this.selected = false; this.icon = "page-icon:undefined"; } render() { return html`
    `; } } export class LoginListItem extends MozLitElement { static get properties() { return { favicon: { type: String }, title: { type: String, reflect: true }, username: { type: String, reflect: true }, notificationIcon: { type: String, reflect: true }, selected: { type: Boolean }, }; } constructor() { super(); this.favicon = ""; this.title = ""; this.username = ""; this.notificationIcon = ""; this.selected = false; } render() { switch (this.notificationIcon) { case "breached": this.classList.add("breached"); break; case "vulnerable": this.classList.add("vulnerable"); break; default: this.classList.remove("breached"); this.classList.remove("vulnerable"); break; } return html`
    ${this.title} ${when( this.username, () => html` ${this.username} `, () => html`` )}
    ${choose( this.notificationIcon, [ [ "breached", () => html``, ], [ "vulnerable", () => html``, ], ], () => html`` )}
    `; } } customElements.define("list-item", ListItem); customElements.define("new-list-item", NewListItem); customElements.define("login-list-item", LoginListItem);