feat: 更新 ESLint 和 Prettier 配置,增强代码质量管理
- 在 .gitignore 中添加 public/audio/* 以忽略音频文件。 - 更新 bun.lock,添加 eslint-config-prettier 和 eslint-plugin-prettier 依赖,确保 ESLint 与 Prettier 的兼容性。 - 修改 eslint.config.ts,整合 Prettier 规则,优化代码风格一致性。 - 在 package.json 中添加 lint:fix 和 format 脚本,简化代码格式化和修复流程。 - 更新 tailwind.config.ts 和其他组件文件,统一代码风格,提升可读性。
This commit is contained in:
1 parent
5d00adc1a5
commit
76c67b492e
216 files changed
+12454
-13976
No files matched your search
@@ -3,17 +3,17 @@
|
||||
* 用于 Spotlight 和 Overlay 组件
|
||||
*/
|
||||
export interface BlockingDiv {
|
||||
top: number;
|
||||
left: number;
|
||||
width: string | number;
|
||||
height: string | number;
|
||||
top: number
|
||||
left: number
|
||||
width: string | number
|
||||
height: string | number
|
||||
}
|
||||
|
||||
export interface Rect {
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
top: number
|
||||
left: number
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,24 +28,24 @@ export function getBlockingDivs(
|
||||
viewportWidth: number,
|
||||
viewportHeight: number
|
||||
): BlockingDiv[] {
|
||||
if (rects.length === 0) return [];
|
||||
if (rects.length === 0) return []
|
||||
|
||||
const blocks: BlockingDiv[] = [];
|
||||
const blocks: BlockingDiv[] = []
|
||||
|
||||
// 找出所有孔的边界
|
||||
const minTop = Math.min(...rects.map((r) => r.top));
|
||||
const maxBottom = Math.max(...rects.map((r) => r.top + r.height));
|
||||
const minLeft = Math.min(...rects.map((r) => r.left));
|
||||
const maxRight = Math.max(...rects.map((r) => r.left + r.width));
|
||||
const minTop = Math.min(...rects.map((r) => r.top))
|
||||
const maxBottom = Math.max(...rects.map((r) => r.top + r.height))
|
||||
const minLeft = Math.min(...rects.map((r) => r.left))
|
||||
const maxRight = Math.max(...rects.map((r) => r.left + r.width))
|
||||
|
||||
// 顶部大块
|
||||
if (minTop > 0) {
|
||||
blocks.push({
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
height: minTop,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 底部大块
|
||||
@@ -53,9 +53,9 @@ export function getBlockingDivs(
|
||||
blocks.push({
|
||||
top: maxBottom,
|
||||
left: 0,
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
height: viewportHeight - maxBottom,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 左侧大块(中间部分)
|
||||
@@ -65,7 +65,7 @@ export function getBlockingDivs(
|
||||
left: 0,
|
||||
width: minLeft,
|
||||
height: maxBottom - minTop,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 右侧大块(中间部分)
|
||||
@@ -75,20 +75,20 @@ export function getBlockingDivs(
|
||||
left: maxRight,
|
||||
width: viewportWidth - maxRight,
|
||||
height: maxBottom - minTop,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 对于多个孔的情况,填充孔之间的间隙
|
||||
if (rects.length > 1) {
|
||||
// 按位置排序
|
||||
const sortedByTop = [...rects].sort((a, b) => a.top - b.top);
|
||||
const sortedByLeft = [...rects].sort((a, b) => a.left - b.left);
|
||||
const sortedByTop = [...rects].sort((a, b) => a.top - b.top)
|
||||
const sortedByLeft = [...rects].sort((a, b) => a.left - b.left)
|
||||
|
||||
// 填充垂直间隙
|
||||
for (let i = 0; i < sortedByTop.length - 1; i++) {
|
||||
const current = sortedByTop[i]!;
|
||||
const next = sortedByTop[i + 1]!;
|
||||
const gap = next.top - (current.top + current.height);
|
||||
const current = sortedByTop[i]!
|
||||
const next = sortedByTop[i + 1]!
|
||||
const gap = next.top - (current.top + current.height)
|
||||
|
||||
if (gap > 0) {
|
||||
blocks.push({
|
||||
@@ -96,15 +96,15 @@ export function getBlockingDivs(
|
||||
left: Math.max(current.left, next.left),
|
||||
width: Math.min(current.width, next.width),
|
||||
height: gap,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 填充水平间隙
|
||||
for (let i = 0; i < sortedByLeft.length - 1; i++) {
|
||||
const current = sortedByLeft[i]!;
|
||||
const next = sortedByLeft[i + 1]!;
|
||||
const gap = next.left - (current.left + current.width);
|
||||
const current = sortedByLeft[i]!
|
||||
const next = sortedByLeft[i + 1]!
|
||||
const gap = next.left - (current.left + current.width)
|
||||
|
||||
if (gap > 0) {
|
||||
blocks.push({
|
||||
@@ -112,10 +112,10 @@ export function getBlockingDivs(
|
||||
left: current.left + current.width,
|
||||
width: gap,
|
||||
height: Math.min(current.height, next.height),
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
return blocks
|
||||
}
|
||||
Reference in new issue
Block a user