# HG changeset patch
# User drewp@bigasterisk.com
# Date 2022-05-31 07:41:35
# Node ID 5f94c9f5b87963a5d994417c7efda0380fec6700
# Parent ffd0a84d54f256bed5834735c547a032185b8b06
port ui to lit
diff --git a/light9/effect/sequencer/web/Light9SequencerUi.ts b/light9/effect/sequencer/web/Light9SequencerUi.ts
--- a/light9/effect/sequencer/web/Light9SequencerUi.ts
+++ b/light9/effect/sequencer/web/Light9SequencerUi.ts
@@ -1,122 +1,161 @@
-
-
-
-
+import debug from "debug";
+import { css, html, LitElement } from "lit";
+import { customElement, property } from "lit/decorators.js";
+import { NamedNode } from "n3";
+import { getTopGraph } from "../../../web/RdfdbSyncedGraph";
+import { SyncedGraph } from "../../../web/SyncedGraph";
+
+debug.enable("*");
+const log = debug("sequencer");
-
-
- Song
-
-
- t={{report.roundT}}
-
- Notes
+interface Note {
+ note: string;
+ nonZero: boolean;
+ rowClass?: string; // added in message handler below
+ effectClass: string;
+ effectSettings: { [attr: string]: string };
+ effectSettingsPairs: EffectSettingsPair[]; // added in message handler below
+ devicesAffected: number;
+}
+interface Report {
+ song: string;
+ songUri: NamedNode; // added in message handler below
+ t: number;
+ roundT?: number; // added in message handler below
+ recentFps: number;
+ recentDeltas: number[];
+ recentDeltasStyle: string[]; // added in message handler below
+ songNotes: Note[];
+}
+interface EffectSettingsPair {
+ effectAttr: string;
+ value: any;
+}
+@customElement("light9-sequencer-ui")
+export class Light9SequencerUi extends LitElement {
+ static styles = [
+ css`
+ :host {
+ display: block;
+ }
+ td {
+ white-space: nowrap;
+ padding: 0 10px;
+ vertical-align: top;
+ vertical-align: top;
+ text-align: start;
+ }
+ tr.active {
+ background: #151515;
+ }
+ .inactive > * {
+ opacity: 0.5;
+ }
+ .effectSetting {
+ display: inline-block;
+ background: #1b1e21;
+ margin: 1px 3px;
+ }
+ .chart {
+ height: 40px;
+ background: #222;
+ display: inline-flex;
+ align-items: flex-end;
+ }
+ .chart > div {
+ background: #a4a54f;
+ width: 8px;
+ margin: 0 1px;
+ }
+ .number {
+ display: inline-block;
+ min-width: 4em;
+ }
+ `,
+ ];
+ render() {
+ return html`
+
-
-
- Note |
- Effect class |
- Effect settings |
- Devices affected |
-
-
+
-
-
-
- |
-
-
- |
-
-
-
-
- :
- {{item.value}}
-
-
-
- |
-
- {{item.devicesAffected}}
- |
-
-
-
+ Song
+
+
+ t=${this.report.roundT}
+
+ Notes
+
+
+
+ Note |
+ Effect class |
+ Effect settings |
+ Devices affected |
+
+ ${this.report.songNotes.map(
+ (item: Note) => html`
+
+ |
+ |
+
+ ${item.effectSettingsPairs.map(
+ (item) => html`
+
+
+ :
+ ${item.value}
+
+
+ `
+ )}
+ |
+ ${item.devicesAffected} |
+
+ `
+ )}
+
+ `;
+ }
-
-
-
+ (report.songNotes || []).forEach((note) => {
+ note.rowClass = note.nonZero ? "active" : "inactive";
+ note.effectSettingsPairs = [];
+
+ const attrs = Object.keys(note.effectSettings);
+ attrs.sort();
+ attrs.forEach((attr) => {
+ note.effectSettingsPairs.push({ effectAttr: attr, value: note.effectSettings[attr] } as EffectSettingsPair);
+ });
+ });
+ this.report = report;
+ }
+}
diff --git a/light9/effect/sequencer/web/index.html b/light9/effect/sequencer/web/index.html
--- a/light9/effect/sequencer/web/index.html
+++ b/light9/effect/sequencer/web/index.html
@@ -5,7 +5,7 @@
-
+