forked from cory/tildefriends
.gitea
apps
admin
api
apps
blog
db
follow
identity
intro
issues
journal
app.js
commonmark.min.js
index.html
lit-all.min.js
lit-all.min.js.map
tf-id-picker.js
tf-journal-app.js
tf-journal-entry.js
room
sneaker
ssb
storage
test
todo
web
welcome
wiki
admin.json
api.json
apps.json
blog.json
db.json
follow.json
identity.json
intro.json
issues.json
journal.json
room.json
sneaker.json
ssb.json
storage.json
test.json
todo.json
web.json
welcome.json
wiki.json
core
deps
docs
metadata
src
tools
.clang-format
.dockerignore
.git-blame-ignore-revs
.gitignore
.gitmodules
.prettierignore
.prettierrc.yaml
CONTRIBUTING.md
Dockerfile
Doxyfile
GNUmakefile
LICENSE
README.md
default.nix
flake.lock
flake.nix
package-lock.json
package.json
44 lines
823 B
JavaScript
44 lines
823 B
JavaScript
import {LitElement, html} from './lit-all.min.js';
|
|
import * as tfrpc from '/static/tfrpc.js';
|
|
|
|
/*
|
|
** Provide a list of IDs, and this lets the user pick one.
|
|
*/
|
|
class TfIdentityPickerElement extends LitElement {
|
|
static get properties() {
|
|
return {
|
|
ids: {type: Array},
|
|
selected: {type: String},
|
|
};
|
|
}
|
|
|
|
constructor() {
|
|
super();
|
|
this.ids = [];
|
|
}
|
|
|
|
changed(event) {
|
|
this.selected = event.srcElement.value;
|
|
this.dispatchEvent(
|
|
new Event('change', {
|
|
srcElement: this,
|
|
})
|
|
);
|
|
}
|
|
|
|
render() {
|
|
return html`
|
|
<select @change=${this.changed} style="max-width: 100%">
|
|
${(this.ids ?? []).map(
|
|
(id) =>
|
|
html`<option ?selected=${id == this.selected} value=${id}>
|
|
${id}
|
|
</option>`
|
|
)}
|
|
</select>
|
|
`;
|
|
}
|
|
}
|
|
|
|
customElements.define('tf-id-picker', TfIdentityPickerElement);
|