feat: add Unsplash search hook and API proxy routes

- Implemented `useUnsplashSearch` hook for searching Unsplash photos with debounce.
- Created Unsplash API client functions for searching photos and triggering downloads.
- Added proxy routes for Unsplash API to handle search requests and background image uploads.
- Introduced accessibility utilities for WCAG compliance checks and motion preference management.
- Developed theme sharing module for encoding and decoding theme configurations as base64url strings.
This commit is contained in:
catlog22
2026-02-08 20:01:28 +08:00
parent 87daccdc48
commit 166211dcd4
52 changed files with 5798 additions and 142 deletions

View File

@@ -224,10 +224,26 @@
"content": "Content Search",
"files": "File Search",
"symbol": "Symbol Search",
"semantic": "Semantic Search (LSP)",
"mode": "Mode",
"mode.semantic": "Semantic (default)",
"mode.exact": "Exact (FTS)",
"mode.fuzzy": "Fuzzy",
"semanticMode": "Search Mode",
"semanticMode.fusion": "Fusion Search",
"semanticMode.vector": "Vector Search",
"semanticMode.structural": "Structural Search",
"fusionStrategy": "Fusion Strategy",
"fusionStrategy.rrf": "RRF (default)",
"fusionStrategy.dense_rerank": "Dense Rerank",
"fusionStrategy.binary": "Binary",
"fusionStrategy.hybrid": "Hybrid",
"fusionStrategy.staged": "Staged",
"lspStatus": "LSP Status",
"lspAvailable": "Semantic search available",
"lspUnavailable": "Semantic search unavailable",
"lspNoVector": "Vector index required",
"lspNoSemantic": "Semantic dependencies required",
"query": "Query",
"queryPlaceholder": "Enter search query...",
"button": "Search",

View File

@@ -132,6 +132,10 @@
"ask_question": {
"name": "ask_question",
"desc": "Ask interactive questions through A2UI interface"
},
"smart_search": {
"name": "smart_search",
"desc": "Intelligent code search with fuzzy and semantic modes"
}
},
"paths": {

View File

@@ -34,5 +34,87 @@
"enhanced": "Enhanced",
"hoverGlow": "Enable hover glow effects",
"bgAnimation": "Enable background gradient animation"
},
"accessibility": {
"contrastWarning": "Some color combinations may not meet WCAG AA contrast requirements:",
"fixSuggestion": "Suggested fix: adjust {target} from {original} to {suggested} (ratio: {ratio}:1)",
"applyFix": "Apply Fix",
"dismiss": "Dismiss"
},
"motion": {
"label": "Motion Preference",
"system": "System",
"reduce": "Reduce",
"enable": "Enable"
},
"slot": {
"title": "Theme Slots",
"default": "Default",
"custom1": "Custom 1",
"custom2": "Custom 2",
"copy": "Copy Slot",
"rename": "Rename",
"delete": "Delete",
"undoDelete": "Slot deleted. Undo?",
"undo": "Undo",
"limitReached": "Maximum of {limit} theme slots reached",
"deleteConfirm": "Delete this theme slot?",
"cannotDeleteDefault": "Cannot delete the default slot",
"renameEmpty": "Slot name cannot be empty",
"copyOf": "Copy of {name}",
"active": "Active"
},
"styleTier": {
"label": "Style Tier",
"soft": "Soft",
"standard": "Standard",
"highContrast": "High Contrast",
"softDesc": "Reduced saturation, gentle colors",
"standardDesc": "Default balanced appearance",
"highContrastDesc": "Enhanced readability, sharper colors"
},
"background": {
"title": "Background Image",
"mode": {
"gradientOnly": "Gradient",
"imageOnly": "Image",
"imageGradient": "Image+Gradient"
},
"searchPlaceholder": "Search Unsplash photos...",
"customUrlPlaceholder": "Custom image URL...",
"apply": "Apply",
"removeImage": "Remove",
"effects": "Visual Effects",
"blur": "Blur",
"darken": "Darken",
"saturation": "Saturation",
"frostedGlass": "Frosted glass effect on content",
"grain": "Noise texture overlay",
"vignette": "Vignette (dark edges)",
"searchError": "Failed to search photos. Check if Unsplash API is configured.",
"noResults": "No photos found",
"prev": "Prev",
"next": "Next",
"loadFailed": "Image failed to load, fallback to gradient",
"upload": "Upload local image",
"uploading": "Uploading...",
"uploadError": "Upload failed",
"fileTooLarge": "File too large (max 10MB)",
"invalidType": "Only JPG, PNG, WebP, GIF supported"
},
"share": {
"label": "Theme Sharing",
"copyCode": "Copy Theme Code",
"copied": "Theme code copied to clipboard",
"import": "Import Theme",
"paste": "Paste theme code here...",
"preview": "Import Preview",
"apply": "Apply Theme",
"cancel": "Cancel",
"invalidCode": "Invalid theme code. Please check and try again.",
"incompatibleVersion": "This theme code is from an incompatible version and cannot be imported.",
"versionWarning": "This theme code is from a different version. Some settings may not be accurate.",
"importSuccess": "Theme imported successfully",
"noSlotAvailable": "No available theme slot. Delete a custom slot first."
}
}

View File

@@ -224,10 +224,26 @@
"content": "内容搜索",
"files": "文件搜索",
"symbol": "符号搜索",
"semantic": "语义搜索 (LSP)",
"mode": "模式",
"mode.semantic": "语义(默认)",
"mode.exact": "精确FTS",
"mode.fuzzy": "模糊",
"semanticMode": "搜索模式",
"semanticMode.fusion": "融合搜索",
"semanticMode.vector": "向量搜索",
"semanticMode.structural": "结构搜索",
"fusionStrategy": "融合策略",
"fusionStrategy.rrf": "RRF默认",
"fusionStrategy.dense_rerank": "Dense Rerank",
"fusionStrategy.binary": "Binary",
"fusionStrategy.hybrid": "Hybrid",
"fusionStrategy.staged": "Staged",
"lspStatus": "LSP 状态",
"lspAvailable": "语义搜索可用",
"lspUnavailable": "语义搜索不可用",
"lspNoVector": "需要先建立向量索引",
"lspNoSemantic": "需要先安装语义依赖",
"query": "查询",
"queryPlaceholder": "输入搜索查询...",
"button": "搜索",
@@ -294,6 +310,7 @@
"installing": "安装中..."
},
"watcher": {
"title": "文件监听器",
"status": {
"running": "运行中",
"stopped": "已停止"

View File

@@ -132,6 +132,10 @@
"ask_question": {
"name": "ask_question",
"desc": "通过 A2UI 界面发起交互式问答"
},
"smart_search": {
"name": "smart_search",
"desc": "智能代码搜索,支持模糊和语义搜索模式"
}
},
"paths": {

View File

@@ -34,5 +34,87 @@
"enhanced": "增强",
"hoverGlow": "启用悬停光晕效果",
"bgAnimation": "启用背景渐变动画"
},
"accessibility": {
"contrastWarning": "部分颜色组合可能不符合 WCAG AA 对比度要求:",
"fixSuggestion": "建议修复: 将{target}从 {original} 调整为 {suggested} (对比度: {ratio}:1)",
"applyFix": "应用修复",
"dismiss": "忽略"
},
"motion": {
"label": "动效偏好",
"system": "跟随系统",
"reduce": "减少动效",
"enable": "启用动效"
},
"slot": {
"title": "主题槽位",
"default": "默认",
"custom1": "自定义 1",
"custom2": "自定义 2",
"copy": "复制槽位",
"rename": "重命名",
"delete": "删除",
"undoDelete": "槽位已删除,是否撤销?",
"undo": "撤销",
"limitReached": "最多只能创建 {limit} 个主题槽位",
"deleteConfirm": "确定删除此主题槽位?",
"cannotDeleteDefault": "无法删除默认槽位",
"renameEmpty": "槽位名称不能为空",
"copyOf": "{name}的副本",
"active": "使用中"
},
"styleTier": {
"label": "风格档位",
"soft": "柔和",
"standard": "标准",
"highContrast": "高对比",
"softDesc": "降低饱和度,柔和色彩",
"standardDesc": "默认均衡外观",
"highContrastDesc": "增强可读性,色彩更鲜明"
},
"background": {
"title": "背景图片",
"mode": {
"gradientOnly": "仅渐变",
"imageOnly": "仅图片",
"imageGradient": "图片+渐变"
},
"searchPlaceholder": "搜索 Unsplash 图片...",
"customUrlPlaceholder": "自定义图片 URL...",
"apply": "应用",
"removeImage": "移除",
"effects": "视觉效果",
"blur": "模糊",
"darken": "暗化",
"saturation": "饱和度",
"frostedGlass": "内容区毛玻璃效果",
"grain": "噪点纹理叠加",
"vignette": "暗角效果",
"searchError": "搜索图片失败,请检查 Unsplash API 是否已配置。",
"noResults": "未找到图片",
"prev": "上一页",
"next": "下一页",
"loadFailed": "图片加载失败,已回退到渐变模式",
"upload": "上传本地图片",
"uploading": "上传中...",
"uploadError": "上传失败",
"fileTooLarge": "文件过大(最大 10MB",
"invalidType": "仅支持 JPG、PNG、WebP、GIF"
},
"share": {
"label": "主题分享",
"copyCode": "复制主题代码",
"copied": "主题代码已复制到剪贴板",
"import": "导入主题",
"paste": "在此粘贴主题代码...",
"preview": "导入预览",
"apply": "应用主题",
"cancel": "取消",
"invalidCode": "无效的主题代码,请检查后重试。",
"incompatibleVersion": "此主题代码来自不兼容的版本,无法导入。",
"versionWarning": "此主题代码来自不同版本,部分设置可能不准确。",
"importSuccess": "主题导入成功",
"noSlotAvailable": "没有可用的主题槽位,请先删除一个自定义槽位。"
}
}