Files
ai-course/node_modules/motion-dom/dist/es/view/queue.mjs
KQL ce6aa207e9 fix: 修复图片路径以适配GitHub Pages base path
- 将所有图片路径从绝对路径改为使用 process.env.PUBLIC_URL
- 修复 HomePage.tsx 中所有图片引用
- 修复 CoursePage.tsx 中所有图片引用
- 确保图片在 GitHub Pages 上正确加载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:24:45 +08:00

53 lines
1.7 KiB
JavaScript

import { removeItem } from 'motion-utils';
import { microtask } from '../frameloop/microtask.mjs';
import { startViewAnimation } from './start.mjs';
let builders = [];
let current = null;
function next() {
current = null;
const [nextBuilder] = builders;
if (nextBuilder)
start(nextBuilder);
}
function start(builder) {
removeItem(builders, builder);
current = builder;
startViewAnimation(builder).then((animation) => {
builder.notifyReady(animation);
animation.finished.finally(next);
});
}
function processQueue() {
/**
* Iterate backwards over the builders array. We can ignore the
* "wait" animations. If we have an interrupting animation in the
* queue then we need to batch all preceeding animations into it.
* Currently this only batches the update functions but will also
* need to batch the targets.
*/
for (let i = builders.length - 1; i >= 0; i--) {
const builder = builders[i];
const { interrupt } = builder.options;
if (interrupt === "immediate") {
const batchedUpdates = builders.slice(0, i + 1).map((b) => b.update);
const remaining = builders.slice(i + 1);
builder.update = () => {
batchedUpdates.forEach((update) => update());
};
// Put the current builder at the front, followed by any "wait" builders
builders = [builder, ...remaining];
break;
}
}
if (!current || builders[0]?.options.interrupt === "immediate") {
next();
}
}
function addToQueue(builder) {
builders.push(builder);
microtask.render(processQueue);
}
export { addToQueue };