UNPKG

@authduo/authduo

Version:

Free User-sovereign Authentication for the World

39 lines 1.59 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 { ShadowElement, attributes, html, mixin } from "@benev/slate"; import { Auth } from "../../auth.js"; import stylesCss from "./styles.css.js"; let AuthButton = class AuthButton extends ShadowElement { auth = Auth.get(); #attrs = attributes(this, { "src": String, }); get src() { return this.#attrs.src ?? Auth.defaultUrl; } set src(src) { this.#attrs.src = src; } render() { const { auth } = this; const { login } = auth; if (login) { const logout = () => { auth.login = null; }; return html `<button part=button class=logout @click="${logout}">Logout</button>`; } else { const popup = () => auth.popup(this.#attrs.src); return html `<button part=button class=login @click="${popup}">Login</button>`; } } }; AuthButton = __decorate([ mixin.css(stylesCss), mixin.reactive() ], AuthButton); export { AuthButton }; //# sourceMappingURL=element.js.map