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] [build]
args_bin = [] 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 ." cmd = "go build -tags=\"dev\" -o ./tmp/main ."
delay = 400 delay = 400
exclude_dir = [ exclude_dir = [
@@ -29,7 +29,7 @@ kill_delay = "0s"
log = "build-errors.log" log = "build-errors.log"
poll = false poll = false
poll_interval = 0 poll_interval = 0
post_cmd = [] post_cmd = ["npm --prefix views/ run build -- --config vite.dev.config.js"]
pre_cmd = [] pre_cmd = []
rerun = false rerun = false
rerun_delay = 500 rerun_delay = 500

View File

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

View File

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

File diff suppressed because one or more lines are too long