web: update flow diagram on ak-refresh

This commit is contained in:
Jens Langhammer 2021-02-14 19:16:40 +01:00
parent 69e6221906
commit d122bddae2
1 changed files with 7 additions and 0 deletions

View File

@ -11,8 +11,11 @@ export const FILL_LIGHT_MODE = "#f0f0f0";
@customElement("ak-flow-diagram")
export class FlowDiagram extends LitElement {
_flowSlug?: string;
@property()
set flowSlug(value: string) {
this._flowSlug = value;
Flow.diagram(value).then((data) => {
this.diagram = FlowChart.parse(data.diagram);
});
@ -33,6 +36,10 @@ export class FlowDiagram extends LitElement {
constructor() {
super();
this.addEventListener("ak-refresh", () => {
if (!this._flowSlug) return
this.flowSlug = this._flowSlug;
});
window.matchMedia("(prefers-color-scheme: light)").addEventListener("change", (ev) => {
if (ev.matches) {
this.fontColour = FONT_COLOUR_LIGHT_MODE;