Fixed an error with a nil pointer deref

This commit is contained in:
Simon Martens
2024-12-04 19:06:40 +01:00
parent afe51197ef
commit 3d78e01287
4 changed files with 649 additions and 15 deletions

View File

@@ -4,7 +4,7 @@ tmp_dir = "tmp"
[build]
args_bin = []
full_bin = "npm --prefix views/ run build -- --config vite.dev.config.js; export KGPZ_WATCH=false; ./tmp/main"
full_bin = "export KGPZ_WATCH=false; ./tmp/main"
cmd = "go build -tags=\"dev\" -o ./tmp/main ."
delay = 400
exclude_dir = [
@@ -29,7 +29,7 @@ kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
post_cmd = ["npm --prefix views/ run build -- --config vite.dev.config.js"]
pre_cmd = []
rerun = false
rerun_delay = 500

View File

@@ -1,3 +1,4 @@
#!/bin/bash
rm -rf ./bin
rm -rf ./cache_gnd
rm -rf ./data_git

View File

@@ -1,22 +1,31 @@
function a() {
document.querySelectorAll("template[simple]").forEach((l) => {
let s = l.getAttribute("id"), n = l.content;
customElements.define(s, class extends HTMLElement {
function setup() {
let templates = document.querySelectorAll("template[simple]");
templates.forEach((template) => {
let templateId = template.getAttribute("id");
let templateContent = template.content;
customElements.define(templateId, class extends HTMLElement {
constructor() {
super(), this.appendChild(n.cloneNode(!0)), this.slots = this.querySelectorAll("slot");
super();
this.appendChild(templateContent.cloneNode(true));
this.slots = this.querySelectorAll("slot");
}
connectedCallback() {
let o = [];
this.slots.forEach((e) => {
let r = e.getAttribute("name"), t = this.querySelector(`[slot="${r}"]`);
t && (e.replaceWith(t.cloneNode(!0)), o.push(t));
}), o.forEach((e) => {
e.remove();
let toremove = [];
this.slots.forEach((tslot) => {
let slotName = tslot.getAttribute("name");
let slotContent = this.querySelector(`[slot="${slotName}"]`);
if (slotContent) {
tslot.replaceWith(slotContent.cloneNode(true));
toremove.push(slotContent);
}
});
toremove.forEach((element) => {
element.remove();
});
}
});
});
}
export {
a as setup
setup
};

File diff suppressed because one or more lines are too long