@e280/authlocal
Version:
User-sovereign login system for everybody
35 lines • 1.53 kB
JavaScript
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 { debounce, Thumbprint } from "@e280/stz";
import { ShadowElement, attributes, html, mixin, signal } from "@benev/slate";
import stylesCss from "./styles.css.js";
import { Copyable } from "../../views/copyable/view.js";
let AuthSigil = class AuthSigil extends ShadowElement {
copyStatus = signal(undefined);
attrs = attributes(this, {
"hex": String,
});
clearStatus = debounce(1000, () => {
this.copyStatus.value = undefined;
});
render() {
let { hex } = this.attrs;
if (hex === undefined) {
console.error(`<auth-sigil> element attr [hex] is required`);
hex = "";
}
const { sigil, thumbprint } = Thumbprint.build.fromHex(hex);
return Copyable([thumbprint], { content: html `
<div part="copybox">${sigil}</div>
` });
}
};
AuthSigil = __decorate([
mixin.css(stylesCss)
], AuthSigil);
export { AuthSigil };
//# sourceMappingURL=element.js.map