first commit

This commit is contained in:
2026-07-21 14:54:36 +10:00
commit e79c793b9c
134 changed files with 14427 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import type { NativePlatformAdapter, NativeRouterRuntime } from '@native-vue-router/core'
export interface ElectronCommandLine {
appendSwitch(name: string, value?: string): void
}
export function disableElectronHistoryGestures(commandLine: ElectronCommandLine) {
commandLine.appendSwitch('disable-features', 'OverscrollHistoryNavigation')
}
declare global {
interface Window {
nativeVueHost?: {
onBack(callback: () => void): () => void
onForward?(callback: () => void): () => void
}
}
}
export function createElectronRendererAdapter(): NativePlatformAdapter {
return {
name: 'electron',
install(runtime: NativeRouterRuntime) {
const removeBack = window.nativeVueHost?.onBack(() => {
if (runtime.canGoBack.value) void runtime.pop()
})
const removeForward = window.nativeVueHost?.onForward?.(() => runtime.router.forward())
return () => {
removeBack?.()
removeForward?.()
}
},
}
}