Skip to content

Commit

Permalink
feat(server-jetty): set dark theme by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Jul 22, 2024
1 parent df75b6d commit c4a06ec
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server-jetty/src/main/js/src/lg4j-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
//const mermaidAPI = mermaid.mermaidAPI;


const renderSVG = (diagram) => html`
<div>
${unsafeSVG(diagram.svg)}
</div>`;

/**
* WcMermaid
* @class
Expand All @@ -23,6 +18,7 @@ export class LG4jMermaid extends LitElement {
mermaid.initialize({
logLevel: 'none',
startOnLoad: false,
theme: 'dark'
});

this._content = null
Expand All @@ -38,6 +34,12 @@ export class LG4jMermaid extends LitElement {
},
args: () => [this.#textContent]
})

#renderSVG = (diagram) => html`
<div>
${unsafeSVG(diagram.svg)}
</div>`;

/**
* @returns {ChildNode[]}
* @private
Expand Down Expand Up @@ -116,7 +118,7 @@ export class LG4jMermaid extends LitElement {

return this.#mermaidTask.render({
pending: () => html`<p>rendering diagram...</p>`,
complete: renderSVG,
complete: this.#renderSVG,
error: (e) => html`<p>Error: ${e}</p>`
});
}
Expand Down

0 comments on commit c4a06ec

Please sign in to comment.