- 将所有图片路径从绝对路径改为使用 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>
29 lines
891 B
JavaScript
29 lines
891 B
JavaScript
import { isVariantLabel } from './is-variant-label.mjs';
|
|
import { variantProps } from './variant-props.mjs';
|
|
|
|
const numVariantProps = variantProps.length;
|
|
function getVariantContext(visualElement) {
|
|
if (!visualElement)
|
|
return undefined;
|
|
if (!visualElement.isControllingVariants) {
|
|
const context = visualElement.parent
|
|
? getVariantContext(visualElement.parent) || {}
|
|
: {};
|
|
if (visualElement.props.initial !== undefined) {
|
|
context.initial = visualElement.props.initial;
|
|
}
|
|
return context;
|
|
}
|
|
const context = {};
|
|
for (let i = 0; i < numVariantProps; i++) {
|
|
const name = variantProps[i];
|
|
const prop = visualElement.props[name];
|
|
if (isVariantLabel(prop) || prop === false) {
|
|
context[name] = prop;
|
|
}
|
|
}
|
|
return context;
|
|
}
|
|
|
|
export { getVariantContext };
|