main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
function chooseLayerType(valueName) {
if (valueName === "layout")
return "group";
if (valueName === "enter" || valueName === "new")
return "new";
if (valueName === "exit" || valueName === "old")
return "old";
return "group";
}
export { chooseLayerType };

32
node_modules/motion-dom/dist/es/view/utils/css.mjs generated vendored Normal file
View File

@@ -0,0 +1,32 @@
let pendingRules = {};
let style = null;
const css = {
set: (selector, values) => {
pendingRules[selector] = values;
},
commit: () => {
if (!style) {
style = document.createElement("style");
style.id = "motion-view";
}
let cssText = "";
for (const selector in pendingRules) {
const rule = pendingRules[selector];
cssText += `${selector} {\n`;
for (const [property, value] of Object.entries(rule)) {
cssText += ` ${property}: ${value};\n`;
}
cssText += "}\n";
}
style.textContent = cssText;
document.head.appendChild(style);
pendingRules = {};
},
remove: () => {
if (style && style.parentElement) {
style.parentElement.removeChild(style);
}
},
};
export { css };

View File

@@ -0,0 +1,8 @@
function getViewAnimationLayerInfo(pseudoElement) {
const match = pseudoElement.match(/::view-transition-(old|new|group|image-pair)\((.*?)\)/);
if (!match)
return null;
return { layer: match[2], type: match[1] };
}
export { getViewAnimationLayerInfo };

View File

@@ -0,0 +1,12 @@
function filterViewAnimations(animation) {
const { effect } = animation;
if (!effect)
return false;
return (effect.target === document.documentElement &&
effect.pseudoElement?.startsWith("::view-transition"));
}
function getViewAnimations() {
return document.getAnimations().filter(filterViewAnimations);
}
export { getViewAnimations };

View File

@@ -0,0 +1,5 @@
function hasTarget(target, targets) {
return targets.has(target) && Object.keys(targets.get(target)).length > 0;
}
export { hasTarget };