docs(canvas): explain menu focus and toolbar update boundaries

This commit is contained in:
2026-11-12 16:24:09 +08:00
parent c34d0b7ce0
commit 97fefaa519
7 changed files with 14 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@ export type IconSource = "all" | "lucide" | "tabler";
* 筛选同时满足来源和分类;common看common标记,other指没有分类,all跳过对应限制。
* 保留目录原顺序,不计算相关性分数,也不限制结果数量;虚拟列表由调用方实现。 */
export function searchIcons(query: string, category = "all", source: IconSource = "all") {
// 每次扫描全部目录并归一化检索串,无预建倒排索引;返回新数组但条目仍共享静态记录引用。
const needle = query.trim().toLowerCase().replace(/[-_\s]/g, "");
return iconCatalog.filter((icon) => (source === "all" || icon.source === source)
&& (category === "all" || (category === "common" ? icon.common : category === "other" ? !icon.categories.length : icon.categories.includes(category)))