diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index aef6aa9..dd3c24a 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -57,6 +57,7 @@ import SymlinkMethodCards from '@modrinth/ui/src/components/flows/drop/SymlinkMe import { useQuery } from '@tanstack/vue-query' import { getVersion } from '@tauri-apps/api/app' import { convertFileSrc, invoke } from '@tauri-apps/api/core' +import { hideAllPoppers } from 'floating-vue' import { listen } from '@tauri-apps/api/event' import { Effect, getCurrentWindow } from '@tauri-apps/api/window' import { fetch as tauriFetch } from '@tauri-apps/plugin-http' @@ -1461,6 +1462,7 @@ function syncDiscordActivity(to: RouteLocationNormalizedLoaded) { } router.afterEach((to, from, failure) => { + hideAllPoppers() if (!failure) void invoke('lightweight_mode_set_route', { route: to.fullPath }) trackEvent('PageView', { path: to.path, diff --git a/tools/icon_work/chk_fv.py b/tools/icon_work/chk_fv.py new file mode 100644 index 0000000..7269de4 --- /dev/null +++ b/tools/icon_work/chk_fv.py @@ -0,0 +1,20 @@ +import glob, os +cands = glob.glob(r"D:\Project\Starlight_Lancher\node_modules\.pnpm\floating-vue*\node_modules\floating-vue\dist\*.mjs") +cands += glob.glob(r"D:\Project\Starlight_Lancher\node_modules\floating-vue\dist\*") +print("候选:", cands[:5]) +found = False +for c in cands: + if not os.path.isfile(c): + continue + try: + t = open(c, encoding="utf-8", errors="replace").read() + except Exception: + continue + if "hideAllTooltips" in t or "disposeTooltips" in t: + print("文件:", c) + print(" 含 hideAllTooltips:", "hideAllTooltips" in t) + print(" 含 disposeTooltips:", "disposeTooltips" in t) + found = True + break +if not found: + print("没找到(可能打包成 cjs/index)") \ No newline at end of file diff --git a/tools/icon_work/fix_tooltip.py b/tools/icon_work/fix_tooltip.py new file mode 100644 index 0000000..773a9bf --- /dev/null +++ b/tools/icon_work/fix_tooltip.py @@ -0,0 +1,18 @@ +p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\App.vue" +t = open(p, encoding="utf-8").read() + +# 1) 加 import(放在 App.vue 的 import 区,紧跟其他 @ 包;找一个锚点) +anchor = "import { listen } from '@tauri-apps/api/event'" +assert anchor in t, "找不到 anchor import" +t = t.replace(anchor, "import { hideAllPoppers } from 'floating-vue'\n" + anchor, 1) + +# 2) router.afterEach 开头加 hideAllPoppers() +old = "router.afterEach((to, from, failure) => {\n\tif (!failure) void invoke('lightweight_mode_set_route', { route: to.fullPath })" +new = "router.afterEach((to, from, failure) => {\n\thideAllPoppers()\n\tif (!failure) void invoke('lightweight_mode_set_route', { route: to.fullPath })" +assert old in t, "找不到 router.afterEach 开头" +t = t.replace(old, new, 1) + +open(p, "w", encoding="utf-8", newline="\n").write(t) +print("done") +print(" 含 hideAllPoppers import:", "import { hideAllPoppers } from 'floating-vue'" in t) +print(" 调用次数:", t.count("hideAllPoppers()")) \ No newline at end of file diff --git a/tools/icon_work/list_fv_exports.py b/tools/icon_work/list_fv_exports.py new file mode 100644 index 0000000..c356b07 --- /dev/null +++ b/tools/icon_work/list_fv_exports.py @@ -0,0 +1,15 @@ +import glob, os, re +cands = glob.glob(r"D:\Project\Starlight_Lancher\node_modules\.pnpm\floating-vue@*\node_modules\floating-vue\dist\*") +cands = [c for c in cands if os.path.isfile(c)] +print("dist 文件:", [os.path.basename(c) for c in cands]) +for c in cands: + t = open(c, encoding="utf-8", errors="replace").read() + # 找 export 里跟 tooltip 相关的 + names = set(re.findall(r"export\s*\{([^}]*)\}", t)) + hits = [n.strip() for grp in names for n in grp.split(",") if "ooltip" in n or "ispose" in n] + if hits: + print(f"\n{os.path.basename(c)} 导出含 tooltip/dispose:", hits[:20]) + # 找 hide/dispose 函数名 + for kw in ("hideAllTooltips", "disposeAllTooltips", "hideAllPoppers", "disposeTooltips", "hideTooltips"): + if kw in t: + print(f" [{os.path.basename(c)}] 含 {kw}") \ No newline at end of file