full site update
This commit is contained in:
39
node_modules/astro/dist/transitions/swap-functions.js
generated
vendored
39
node_modules/astro/dist/transitions/swap-functions.js
generated
vendored
@@ -1,26 +1,30 @@
|
||||
const PERSIST_ATTR = "data-astro-transition-persist";
|
||||
const NON_OVERRIDABLE_ASTRO_ATTRS = ["data-astro-transition", "data-astro-transition-fallback"];
|
||||
const scriptsAlreadyRan = /* @__PURE__ */ new Set();
|
||||
function detectScriptExecuted(script) {
|
||||
const key = script.src ? new URL(script.src, location.href).href : script.textContent;
|
||||
if (scriptsAlreadyRan.has(key)) return true;
|
||||
scriptsAlreadyRan.add(key);
|
||||
return false;
|
||||
}
|
||||
function deselectScripts(doc) {
|
||||
for (const s1 of document.scripts) {
|
||||
for (const s2 of doc.scripts) {
|
||||
if (
|
||||
// Check if the script should be rerun regardless of it being the same
|
||||
!s2.hasAttribute("data-astro-rerun") && // Inline
|
||||
(!s1.src && s1.textContent === s2.textContent || // External
|
||||
s1.src && s1.type === s2.type && s1.src === s2.src)
|
||||
) {
|
||||
s2.dataset.astroExec = "";
|
||||
break;
|
||||
}
|
||||
for (const s2 of doc.scripts) {
|
||||
if (
|
||||
// Check if the script should be rerun regardless of it being the same
|
||||
!s2.hasAttribute("data-astro-rerun") && // Check if the script has already been executed
|
||||
detectScriptExecuted(s2)
|
||||
) {
|
||||
s2.dataset.astroExec = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
function swapRootAttributes(doc) {
|
||||
const html = document.documentElement;
|
||||
const astroAttributes = [...html.attributes].filter(
|
||||
({ name }) => (html.removeAttribute(name), name.startsWith("data-astro-"))
|
||||
function swapRootAttributes(newDoc) {
|
||||
const currentRoot = document.documentElement;
|
||||
const nonOverridableAstroAttributes = [...currentRoot.attributes].filter(
|
||||
({ name }) => (currentRoot.removeAttribute(name), NON_OVERRIDABLE_ASTRO_ATTRS.includes(name))
|
||||
);
|
||||
[...doc.documentElement.attributes, ...astroAttributes].forEach(
|
||||
({ name, value }) => html.setAttribute(name, value)
|
||||
[...newDoc.documentElement.attributes, ...nonOverridableAstroAttributes].forEach(
|
||||
({ name, value }) => currentRoot.setAttribute(name, value)
|
||||
);
|
||||
}
|
||||
function swapHeadElements(doc) {
|
||||
@@ -106,6 +110,7 @@ const swap = (doc) => {
|
||||
};
|
||||
export {
|
||||
deselectScripts,
|
||||
detectScriptExecuted,
|
||||
restoreFocus,
|
||||
saveFocus,
|
||||
swap,
|
||||
|
Reference in New Issue
Block a user