full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -1,4 +1,5 @@
import { TRANSITION_AFTER_SWAP, doPreparation, doSwap } from "./events.js";
import { doPreparation, doSwap, TRANSITION_AFTER_SWAP } from "./events.js";
import { detectScriptExecuted } from "./swap-functions.js";
const inBrowser = import.meta.env.SSR === false;
const pushState = inBrowser && history.pushState.bind(history);
const replaceState = inBrowser && history.replaceState.bind(history);
@@ -75,6 +76,14 @@ function getFallback() {
}
function runScripts() {
let wait = Promise.resolve();
let needsWaitForInlineModuleScript = false;
for (const script of document.getElementsByTagName("script")) {
script.dataset.astroExec === void 0 && script.getAttribute("type") === "module" && (needsWaitForInlineModuleScript = script.getAttribute("src") === null);
}
needsWaitForInlineModuleScript && document.body.insertAdjacentHTML(
"beforeend",
`<script type="module" src="data:application/javascript,"/>`
);
for (const script of document.getElementsByTagName("script")) {
if (script.dataset.astroExec === "") continue;
const type = script.getAttribute("type");
@@ -186,14 +195,20 @@ async function updateDOM(preparationEvent, options, currentTransition, historySt
);
return Promise.allSettled(newAnimations.map((a) => a.finished));
}
if (fallback === "animate" && !currentTransition.transitionSkipped && !preparationEvent.signal.aborted) {
try {
await animate("old");
} catch {
const animateFallbackOld = async () => {
if (fallback === "animate" && !currentTransition.transitionSkipped && !preparationEvent.signal.aborted) {
try {
await animate("old");
} catch {
}
}
}
};
const pageTitleForBrowserHistory = document.title;
const swapEvent = doSwap(preparationEvent, currentTransition.viewTransition);
const swapEvent = await doSwap(
preparationEvent,
currentTransition.viewTransition,
animateFallbackOld
);
moveToLocation(swapEvent.to, swapEvent.from, options, pageTitleForBrowserHistory, historyState);
triggerEvent(TRANSITION_AFTER_SWAP);
if (fallback === "animate") {
@@ -252,7 +267,7 @@ async function transition(direction, from, to, options, historyState) {
if (preparationEvent.formData) {
init.method = "POST";
const form = preparationEvent.sourceElement instanceof HTMLFormElement ? preparationEvent.sourceElement : preparationEvent.sourceElement instanceof HTMLElement && "form" in preparationEvent.sourceElement ? preparationEvent.sourceElement.form : preparationEvent.sourceElement?.closest("form");
init.body = form?.attributes.getNamedItem("enctype")?.value === "application/x-www-form-urlencoded" ? new URLSearchParams(preparationEvent.formData) : preparationEvent.formData;
init.body = from !== void 0 && Reflect.get(HTMLFormElement.prototype, "attributes", form).getNamedItem("enctype")?.value === "application/x-www-form-urlencoded" ? new URLSearchParams(preparationEvent.formData) : preparationEvent.formData;
}
const response = await fetchHTML(href, init);
if (response === null) {
@@ -326,7 +341,9 @@ async function transition(direction, from, to, options, historyState) {
skipTransition: () => {
currentTransition.transitionSkipped = true;
document.documentElement.removeAttribute(OLD_NEW_ATTR);
}
},
types: /* @__PURE__ */ new Set()
// empty by default
};
}
currentTransition.viewTransition?.updateCallbackDone.finally(async () => {
@@ -417,6 +434,7 @@ if (inBrowser) {
}
}
for (const script of document.getElementsByTagName("script")) {
detectScriptExecuted(script);
script.dataset.astroExec = "";
}
}