Statische Seiten

This commit is contained in:
Simon Martens
2025-02-24 16:20:08 +01:00
parent d806799b83
commit 6b5fa3dbc3
27 changed files with 617 additions and 85 deletions

View File

@@ -1,20 +1,20 @@
var L = (s) => {
var _ = (s) => {
throw TypeError(s);
};
var T = (s, e, t) => e.has(s) || L("Cannot " + t);
var g = (s, e, t) => (T(s, e, "read from private field"), t ? t.call(s) : e.get(s)), c = (s, e, t) => e.has(s) ? L("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), u = (s, e, t, i) => (T(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), f = (s, e, t) => (T(s, e, "access private method"), t);
const w = "script[xslt-onload]", v = "xslt-template", A = "xslt-transformed", k = "filter-list", m = "filter-list-list", M = "filter-list-item", y = "filter-list-input", x = "filter-list-searchable", B = "scroll-button", P = "tool-tip", I = "abbrev-tooltips";
var T = (s, e, t) => e.has(s) || _("Cannot " + t);
var f = (s, e, t) => (T(s, e, "read from private field"), t ? t.call(s) : e.get(s)), c = (s, e, t) => e.has(s) ? _("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), d = (s, e, t, i) => (T(s, e, "write to private field"), i ? i.call(s, t) : e.set(s, t), t), g = (s, e, t) => (T(s, e, "access private method"), t);
const k = "script[xslt-onload]", v = "xslt-template", w = "xslt-transformed", A = "filter-list", m = "filter-list-list", M = "filter-list-item", y = "filter-list-input", x = "filter-list-searchable", B = "scroll-button", I = "tool-tip", P = "abbrev-tooltips", C = "int-link";
var h, b, E;
class R {
class z {
constructor() {
c(this, b);
c(this, h);
u(this, h, /* @__PURE__ */ new Map());
d(this, h, /* @__PURE__ */ new Map());
}
setup() {
let e = htmx.findAll(w);
let e = htmx.findAll(k);
for (let t of e)
f(this, b, E).call(this, t);
g(this, b, E).call(this, t);
}
hookupHTMX() {
htmx.on("htmx:load", (e) => {
@@ -23,26 +23,26 @@ class R {
}
}
h = new WeakMap(), b = new WeakSet(), E = function(e) {
if (e.getAttribute(A) === "true" || !e.hasAttribute(v))
if (e.getAttribute(w) === "true" || !e.hasAttribute(v))
return;
let t = "#" + e.getAttribute(v), i = g(this, h).get(t);
let t = "#" + e.getAttribute(v), i = f(this, h).get(t);
if (!i) {
let l = htmx.find(t);
if (l) {
let S = l.innerHTML ? new DOMParser().parseFromString(l.innerHTML, "application/xml") : l.contentDocument;
i = new XSLTProcessor(), i.importStylesheet(S), g(this, h).set(t, i);
i = new XSLTProcessor(), i.importStylesheet(S), f(this, h).set(t, i);
} else
throw new Error("Unknown XSLT template: " + t);
}
let r = new DOMParser().parseFromString(e.innerHTML, "application/xml"), n = i.transformToFragment(r, document), a = new XMLSerializer().serializeToString(n);
e.outerHTML = a;
let r = new DOMParser().parseFromString(e.innerHTML, "application/xml"), n = i.transformToFragment(r, document), o = new XMLSerializer().serializeToString(n);
e.outerHTML = o;
};
var o, p, _;
var a, p, L;
class H extends HTMLElement {
constructor() {
super();
c(this, p);
c(this, o, !1);
c(this, a, !1);
this._items = [], this._url = "", this._filterstart = !1, this._placeholder = "Liste filtern...", this.render();
}
static get observedAttributes() {
@@ -55,7 +55,7 @@ class H extends HTMLElement {
return this._items;
}
connectedCallback() {
this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._filterstart && u(this, o, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this));
this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._filterstart && d(this, a, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this));
}
attributeChangedCallback(t, i, r) {
t === "data-url" && i !== r && (this._url = r, this.render()), t === "data-filterstart" && i !== r && (this._filterstart = r === "true", this.render()), t === "data-placeholder" && i !== r && (this._placeholder = r, this.render());
@@ -64,14 +64,14 @@ class H extends HTMLElement {
t.target && t.target.tagName.toLowerCase() === "input" && (this._filter = t.target.value, this.renderList());
}
onGainFocus(t) {
t.target && t.target.tagName.toLowerCase() === "input" && (u(this, o, !1), this.renderList());
t.target && t.target.tagName.toLowerCase() === "input" && (d(this, a, !1), this.renderList());
}
onLoseFocus(t) {
let i = this.querySelector("input");
if (t.target && t.target === i) {
if (relatedElement = t.relatedTarget, relatedElement && this.contains(relatedElement))
return;
i.value = "", this._filter = "", this._filterstart && u(this, o, !0), this.renderList();
i.value = "", this._filter = "", this._filterstart && d(this, a, !0), this.renderList();
}
}
onEnter(t) {
@@ -139,7 +139,7 @@ class H extends HTMLElement {
`;
}
ActiveDot(t) {
return f(this, p, _).call(this, t), "";
return g(this, p, L).call(this, t), "";
}
NoItems(t) {
return t.length === 0 ? '<div class="px-2 py-0.5 italic text-gray-500">Keine Einträge gefunden</div>' : "";
@@ -167,13 +167,13 @@ class H extends HTMLElement {
t = this._items.filter((r) => i.every((n) => this.getSearchText(r).toLowerCase().includes(n.toLowerCase())));
}
return `
<div id="${m}" class="${m} pt-1 min-h-[19rem] max-h-60 overflow-auto border-b border-zinc-300 bg-stone-50 ${g(this, o) ? "hidden" : ""}">
<div id="${m}" class="${m} pt-1 min-h-[19rem] max-h-60 overflow-auto border-b border-zinc-300 bg-stone-50 ${f(this, a) ? "hidden" : ""}">
${t.map(
(i, r) => `
<a
href="${this._url}${this.getHREF(i)}"
class="${M} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${r % 2 === 0 ? "bg-stone-100" : "bg-stone-50"}"
${f(this, p, _).call(this, i) ? 'aria-current="page"' : ""}>
${g(this, p, L).call(this, i) ? 'aria-current="page"' : ""}>
${this.ActiveDot(i)}
${this.getLinkText(i)}
</a>
@@ -184,13 +184,13 @@ class H extends HTMLElement {
`;
}
}
o = new WeakMap(), p = new WeakSet(), _ = function(t) {
a = new WeakMap(), p = new WeakSet(), L = function(t) {
if (!t)
return !1;
let i = this.getHREF(t);
return !(i === "" || !window.location.href.endsWith(i));
};
class C extends HTMLElement {
class $ extends HTMLElement {
constructor() {
super(), this.handleScroll = this.handleScroll.bind(this), this.scrollToTop = this.scrollToTop.bind(this);
}
@@ -334,7 +334,7 @@ class F extends HTMLElement {
}
}
}
class d extends HTMLElement {
class u extends HTMLElement {
static get observedAttributes() {
return ["data-text", "data-abbrevmap"];
}
@@ -397,7 +397,7 @@ class d extends HTMLElement {
};
}
constructor() {
super(), this._abbrevMap = d.defaultAbbrevMap;
super(), this._abbrevMap = u.defaultAbbrevMap;
}
connectedCallback() {
this.render();
@@ -407,13 +407,13 @@ class d extends HTMLElement {
}
_parseAndSetAbbrevMap(e) {
if (!e) {
this._abbrevMap = d.defaultAbbrevMap;
this._abbrevMap = u.defaultAbbrevMap;
return;
}
try {
this._abbrevMap = JSON.parse(e);
} catch {
this._abbrevMap = d.defaultAbbrevMap;
this._abbrevMap = u.defaultAbbrevMap;
}
}
setAbbrevMap(e) {
@@ -437,17 +437,17 @@ class d extends HTMLElement {
}
const n = this.findLongestAbbrevAt(e, r, t);
if (n) {
const { match: a, meaning: l } = n;
const { match: o, meaning: l } = n;
i += `
<tool-tip position="top" class="!inline" timeout="300">
<div class="data-tip p-2 text-sm text-white bg-gray-700 rounded shadow">
${l}
</div>
<span class="cursor-help text-blue-900 hover:text-slate-800">
${a}
${o}
</span>
</tool-tip>
`, r += a.length;
`, r += o.length;
} else
i += e[r], r++;
}
@@ -455,21 +455,40 @@ class d extends HTMLElement {
}
findLongestAbbrevAt(e, t, i) {
let r = null, n = 0;
for (const a of Object.keys(i))
e.startsWith(a, t) && a.length > n && (r = a, n = a.length);
for (const o of Object.keys(i))
e.startsWith(o, t) && o.length > n && (r = o, n = o.length);
return r ? { match: r, meaning: i[r] } : null;
}
isSpaceOrPunct(e) {
return /\s|[.,;:!?]/.test(e);
}
}
customElements.define(I, d);
customElements.define(k, H);
customElements.define(B, C);
customElements.define(P, F);
class N extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.style.cursor = "pointer", this.addEventListener("click", this.handleClick);
}
disconnectedCallback() {
this.removeEventListener("click", this.handleClick);
}
handleClick(e) {
const t = this.getAttribute("data-jump");
if (t) {
const i = document.querySelector(t);
i ? i.scrollIntoView({ behavior: "smooth" }) : console.warn(`No element found for selector: ${t}`);
}
}
}
customElements.define(C, N);
customElements.define(P, u);
customElements.define(A, H);
customElements.define(B, $);
customElements.define(I, F);
export {
d as AbbreviationTooltips,
u as AbbreviationTooltips,
H as FilterList,
C as ScrollButton,
R as XSLTParseProcess
$ as ScrollButton,
z as XSLTParseProcess
};

File diff suppressed because one or more lines are too long