Files
cover-studio/src/sources/providers.ts
T
im0o 9b82cdeb0c refactor: 背景图层接进主线
- 预设底纹统一走 sources/geometry 的 GEOMETRY_PRESETS(16 条),
  BackgroundMenu 不再自带一份 12 条的定义。
- 删掉 SourcePanel.vue(内容已搬进 BackgroundMenu),连带清掉 unsplash 里
  只为它保留的 legacy 函数面和 index 的对应出口。
- PhotoProviderError 从 unsplash.ts 挪到独立的 errors.ts。原来放在叶子模块里
  是为了绕开和 providers.ts 的循环依赖,独立文件同样绕得开而且不别扭。
- 背景改成和普通图层一样可点选可拖动:用户对背景的核心需求是「调整/缩放/裁剪
  一下」,不可点选就没法在画布上取景;取消选中点画板外的灰底即可。
- useLayers 把背景钉在最底:它拖不上去,别的图层也压不到它下面。
2026-09-05 18:28:58 +08:00

24 lines
968 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { PhotoProvider, PhotoProviderId } from "@/types";
import { pexelsProvider } from "./pexels";
import { unsplashProvider } from "./unsplash";
// 共享错误类定义在 unsplash.ts(依赖最少的叶子模块),这里 re-export 保持桩文件
// 原本的出口路径;pexels.ts 也直接 import 它,避免 providers ↔ 各家模块引成环。
export { PhotoProviderError } from "./errors";
/**
* 图库注册表。
*
* 顺序即界面上标签页的顺序。**Pexels 在前**:Unsplash demo key 每小时只有 50 次
* 请求,开发期点几下就没了;Pexels 是每小时 200 次、每月 2 万次。
* 界面只认 `PhotoProvider` 接口遍历这里,不写 `if (provider === "pexels")`。
*/
export const PHOTO_PROVIDERS: readonly PhotoProvider[] = [
pexelsProvider,
unsplashProvider,
];
export function providerById(id: PhotoProviderId): PhotoProvider | undefined {
return PHOTO_PROVIDERS.find((p) => p.id === id);
}