From dbae56f575aa50b7b0438d58d87c725f24b213a8 Mon Sep 17 00:00:00 2001 From: oeyoews Date: Sat, 27 Jul 2024 16:17:42 +0800 Subject: [PATCH] chore: bump wxt to 19.0 --- .npmrc | 6 + entrypoints/background/index.ts | 1 + entrypoints/{_options => options}/index.html | 0 entrypoints/{_options => options}/index.vue | 0 entrypoints/{_options => options}/main.ts | 0 entrypoints/sidepanel/Sidepanel.vue | 72 ++- package.json | 4 +- pnpm-lock.yaml | 443 ++++++++++--------- 8 files changed, 312 insertions(+), 214 deletions(-) create mode 100644 .npmrc rename entrypoints/{_options => options}/index.html (100%) rename entrypoints/{_options => options}/index.vue (100%) rename entrypoints/{_options => options}/main.ts (100%) diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..870c7c4 --- /dev/null +++ b/.npmrc @@ -0,0 +1,6 @@ +# public-hoist-pattern[]=*@nextui-org/* +# registry=https://registry.npmmirror.com +# NOTE: 不要在 Prod 使用 proxy +# registry=https://registry.npmjs.org/ +# proxy=http://localhost:20172 +package-manager-strict=false \ No newline at end of file diff --git a/entrypoints/background/index.ts b/entrypoints/background/index.ts index 405d2b3..fabd135 100644 --- a/entrypoints/background/index.ts +++ b/entrypoints/background/index.ts @@ -134,6 +134,7 @@ export default defineBackground({ setTimeout(() => { browser.tabs.onUpdated.addListener((tabId, info, tab) => { + // console.log('update'); if (!tab.url || tab.url === 'null') { chrome.sidePanel.setOptions({ tabId, diff --git a/entrypoints/_options/index.html b/entrypoints/options/index.html similarity index 100% rename from entrypoints/_options/index.html rename to entrypoints/options/index.html diff --git a/entrypoints/_options/index.vue b/entrypoints/options/index.vue similarity index 100% rename from entrypoints/_options/index.vue rename to entrypoints/options/index.vue diff --git a/entrypoints/_options/main.ts b/entrypoints/options/main.ts similarity index 100% rename from entrypoints/_options/main.ts rename to entrypoints/options/main.ts diff --git a/entrypoints/sidepanel/Sidepanel.vue b/entrypoints/sidepanel/Sidepanel.vue index e248c64..a8ee913 100644 --- a/entrypoints/sidepanel/Sidepanel.vue +++ b/entrypoints/sidepanel/Sidepanel.vue @@ -31,8 +31,8 @@ import { } from '@/utils/storage'; import { useContent } from '@/hooks/useContent'; -// @ts-expect-error import ContextMenu from '@imengyu/vue3-context-menu'; +import { MenuBar } from '@imengyu/vue3-context-menu'; const isHome = ref(true); const isRead = ref(true); @@ -103,7 +103,7 @@ function onContextMenu(e: MouseEvent) { }, { label: '切换', - onClick: (e: MouseEvent) => actions.darkmode(e), + onClick: (e: any) => actions.darkmode(e), icon: h(WI.FluentDarkTheme24Filled), }, { @@ -329,7 +329,10 @@ async function saveAuth(option: { username: string; password: string }) { } } -const actions: Record = { +const actions: Record< + ICommand, + (e: MouseEvent | KeyboardEvent | undefined) => void +> = { tiddlywiki: () => { isHome.value = !isHome.value; }, @@ -343,7 +346,7 @@ const actions: Record = { copy: () => copyMd(md.value), download: () => saveMarkdown(md.value, title.value!), refresh: () => getContent({ tip: true }), - darkmode: (e: MouseEvent) => toggleDark(e || mousePosition.value), + darkmode: (e: any) => toggleDark(e || mousePosition.value), edit: () => { isRead.value = !isRead.value; }, @@ -359,6 +362,60 @@ const handleCommand = async (cmd: ICommand, components: any, e: MouseEvent) => { // }; // const searchRef = ref | null>(null); +const menuData = { + items: [ + { + label: 'File', + children: [ + { label: 'New' }, + { label: 'Open' }, + { + label: 'Open recent', + children: [ + { label: 'File 1....' }, + { label: 'File 2....' }, + { label: 'File 3....' }, + { label: 'File 4....' }, + { label: 'File 5....' }, + ], + }, + { label: 'Save', divided: true }, + { label: 'Save as...' }, + { label: 'Close' }, + { label: 'Exit' }, + ], + }, + { + label: 'Edit', + children: [ + { label: 'Undo' }, + { label: 'Redo' }, + { label: 'Cut', divided: true }, + { label: 'Copy' }, + { label: 'Find', divided: true }, + { label: 'Replace' }, + ], + }, + { + label: 'View', + children: [ + { label: 'Zoom in' }, + { label: 'Zoom out' }, + { label: 'Reset zoom' }, + { label: 'Full screent', divided: true }, + { label: 'Find', divided: true }, + { label: 'Replace' }, + ], + }, + { + label: 'Help', + children: [{ label: 'About' }], + }, + ], + zIndex: 3, + minWidth: 230, + theme: 'dark', +};