Files
@ e7e03c203c99
Branch filter:
Location: light9/web/RdfdbSyncedGraph.ts - annotation
e7e03c203c99
2.1 KiB
video/MP2T
resize cursor canvas for 400px tall spectros. fix canvas resolution code
4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 f2b3cfcc23d3 f2b3cfcc23d3 f2b3cfcc23d3 f2b3cfcc23d3 f2b3cfcc23d3 f2b3cfcc23d3 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 | import debug from "debug";
import { LitElement, css, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { SyncedGraph } from "./SyncedGraph";
const log = debug("syncedgraph-el");
// Contains a SyncedGraph. Displays as little status box.
// Put one element on your page and use getTopGraph everywhere.
// todo; if you combine some pages and end up with 2+ elems, they still pick a
// leader (and repick if you remove that element). this could make it reasonable
// to have a lot more elems think they're the only ones talking to a graph.
//
//
@customElement("rdfdb-synced-graph")
export class RdfdbSyncedGraph extends LitElement {
@property() graph: SyncedGraph;
@property() status: string;
@property() testGraph = false;
static styles = [
css`
:host {
display: inline-block;
border: 1px solid gray;
min-width: 22em;
background: #05335a;
color: #4fc1d4;
}
`,
];
render() {
return html`graph: ${this.status}`;
}
constructor() {
super();
this.status = "startup";
const prefixes = new Map<string, string>([
["", "http://light9.bigasterisk.com/"],
["dev", "http://light9.bigasterisk.com/device/"],
["effect", "http://light9.bigasterisk.com/effect/"],
["rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"],
["rdfs", "http://www.w3.org/2000/01/rdf-schema#"],
["xsd", "http://www.w3.org/2001/XMLSchema#"],
]);
this.graph = new SyncedGraph(
this.testGraph ? "unused" : "/service/rdfdb/syncedGraph",
prefixes,
(s: string) => {
this.status = s;
}
);
setTopGraph(this.graph);
}
}
// todo: consider if this has anything to contribute:
// https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md
let setTopGraph: (sg: SyncedGraph) => void;
(window as any).topSyncedGraph = new Promise<SyncedGraph>((res, rej) => {
setTopGraph = res;
});
export async function getTopGraph(): Promise<SyncedGraph> {
const s = (window as any).topSyncedGraph;
return await s;
}
|