import debug from "debug";
import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { NamedNode } from "n3";
import Sylvester from "sylvester";
import { Zoom } from "../light9-timeline-audio";
import { PlainViewState } from "../Light9CursorCanvas";
import { getTopGraph } from "../RdfdbSyncedGraph";
import { SyncedGraph } from "../SyncedGraph";
import { TimingUpdate } from "./main";
import { showRoot } from "../show_specific";
export { Light9TimelineAudio } from "../light9-timeline-audio";
export { Light9CursorCanvas } from "../Light9CursorCanvas";
export { RdfdbSyncedGraph } from "../RdfdbSyncedGraph";
export { ResourceDisplay } from "../ResourceDisplay";
const $V = Sylvester.Vector.create;
debug.enable("*");
const log = debug("asco");
function byId(id: string): HTMLElement {
return document.getElementById(id)!;
}
async function postJson(url: string, jsBody: Object) {
return fetch(url, {
method: "POST",
headers: { "Content-Type": "applcation/json" },
body: JSON.stringify(jsBody),
});
}
@customElement("light9-ascoltami-ui")
export class Light9AscoltamiUi extends LitElement {
graph!: SyncedGraph;
times!: { intro: number; post: number };
@property() nextText: string = "";
@property() isPlaying: boolean = false;
@property() show: NamedNode | null = null;
@property() song: NamedNode | null = null;
@property() selectedSong: NamedNode | null = null;
@property() currentDuration: number = 0;
@property() zoom: Zoom;
@property() overviewZoom: Zoom;
@property() viewState: PlainViewState | null = null;
static styles = [
css`
:host {
display: flex;
flex-direction: column;
}
.timeRow {
margin: 14px;
position: relative;
}
#overview {
height: 60px;
}
#zoomed {
margin-top: 40px;
height: 80px;
}
#cursor {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
#grow {
flex: 1 1 auto;
display: flex;
}
#grow > span {
display: flex;
position: relative;
width: 50%;
}
#playSelected {
height: 100px;
}
#songList {
overflow-y: scroll;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
#songList .row {
width: 60%;
min-height: 40px;
text-align: left;
position: relative;
}
#songList .row:nth-child(even) {
background: #333;
}
#songList .row:nth-child(odd) {
background: #444;
}
#songList button {
min-height: 40px;
margin-bottom: 10px;
}
#songList .row.playing {
box-shadow: 0 0 30px red;
background-color: #de5050;
}
`,
];
render() {
return html`