Added template concept

This commit is contained in:
barsdeveloper
2021-10-10 13:52:13 +02:00
parent 84606486c4
commit 8ef5f3dab4
8 changed files with 320 additions and 232 deletions

View File

@@ -2,21 +2,24 @@
* A Graph Entity is an element that can stay directly (as a first child) on the blueprint grid. Those entities are either nodes or links
*/
export default class GraphEntity extends HTMLElement {
constructor() {
/**
*
* @param {import("./template/Template").default} template The template to render this node
*/
constructor(template) {
super()
/** @type {import("./UEBlueprint").EBlueprint}" */
this.blueprint = null
this.template = template
}
connectedCallback() {
this.blueprint = this.closest('u-blueprint')
let aDiv = document.createElement('div')
aDiv.innerHTML = this.render()
this.appendChild(aDiv.firstElementChild)
this.append(...this.template.getElements(this))
}
// Subclasses want to rewrite this
render() {
return ""
return ''
}
}