migrate paraglide to v2

This commit is contained in:
Huakun Shen 2025-03-28 07:50:05 -04:00
parent 9cf06b1835
commit d31528636d
No known key found for this signature in database
39 changed files with 1645 additions and 753 deletions

View File

@ -1,9 +1,10 @@
{
"recommendations": [
"svelte.svelte-vscode",
"tauri-apps.tauri-vscode",
"rust-lang.rust-analyzer",
"denoland.vscode-deno",
"tamasfe.even-better-toml"
]
"recommendations": [
"svelte.svelte-vscode",
"tauri-apps.tauri-vscode",
"rust-lang.rust-analyzer",
"denoland.vscode-deno",
"tamasfe.even-better-toml",
"inlang.vs-code-extension"
]
}

View File

@ -1,2 +1,2 @@
src-tauri
src/lib/paraglide/**
src/lib/paraglide/**

View File

@ -11,12 +11,13 @@
"lint": "prettier --check . && eslint .",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"tauri": "tauri"
"tauri": "tauri",
"machine-translate": "inlang machine translate --project project.inlang"
},
"license": "MIT",
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
"@inlang/paraglide-sveltekit": "0.16.0",
"@inlang/paraglide-sveltekit": "0.16.1",
"@kksh/extension": "workspace:*",
"@kksh/svelte5": "^0.1.15",
"@kksh/ui": "workspace:*",
@ -30,28 +31,28 @@
"@tauri-apps/plugin-stronghold": "^2.2.0",
"@tauri-store/svelte": "^2.1.1",
"dompurify": "^3.2.4",
"eslint": "^9.21.0",
"eslint": "^9.23.0",
"fuse.js": "^7.1.0",
"gsap": "^3.12.7",
"kkrpc": "^0.2.2",
"lz-string": "^1.5.0",
"pretty-bytes": "^6.1.1",
"semver": "^7.7.1",
"svelte-inspect-value": "^0.3.0",
"svelte-inspect-value": "^0.5.0",
"svelte-sonner": "^0.3.28",
"sveltekit-superforms": "^2.23.1",
"sveltekit-superforms": "^2.24.0",
"tauri-plugin-clipboard-api": "^2.1.11",
"tauri-plugin-shellx-api": "^2.0.16",
"tauri-plugin-svelte": "1.2.1",
"tauri-plugin-svelte": "1.2.2",
"tauri-plugin-user-input-api": "workspace:*",
"uuid": "^11.1.0"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@inlang/paraglide-js": "1.11.8",
"@inlang/paraglide-js": "2.0.6",
"@kksh/types": "workspace:*",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.17.3",
"@sveltejs/kit": "^2.20.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.1",
@ -76,8 +77,9 @@
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"tslib": "^2.8.1",
"typescript": "^5.6.3",
"typescript-eslint": "^8.25.0",
"vite": "^6.2.0"
"typescript": "^5.8.2",
"typescript-eslint": "^8.28.0",
"vite": "^6.2.3",
"@inlang/cli": "^3.0.8"
}
}

View File

@ -1 +1 @@
9800f324a732adb2ed22a4b600a0025820caaba8c4d886b0949b04616bba4726
YXlr9bPxPwU80SiXPp

View File

@ -1,15 +1,12 @@
{
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": ["en", "zh", "ru", "pt", "vi", "de"],
"baseLocale": "en",
"locales": ["en", "de", "zh", "pt", "ru", "vi"],
"modules": [
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"
],
"plugin.inlang.messageFormat": {
"pathPattern": "./messages/{languageTag}.json"
"pathPattern": "./messages/{locale}.json"
}
}

View File

@ -1,13 +1,21 @@
<!doctype html>
<html lang="%paraglide.lang%" dir="%paraglide.textDirection%">
<head>
<html lang="%lang%">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Kunkun Desktop App</title>
%sveltekit.head%
</head>
%sveltekit.head% </head
>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View File

@ -1,6 +1,15 @@
// file initialized by the Paraglide-SvelteKit CLI - Feel free to edit it
import { sequence } from "@sveltejs/kit/hooks"
import { i18n } from "$lib/i18n"
import type { Handle } from "@sveltejs/kit"
import { paraglideMiddleware } from "$lib/paraglide/server"
// add your own hooks as part of the sequence here
export const handle = sequence(i18n.handle())
// creating a handle to use the paraglide middleware
const paraglideHandle: Handle = ({ event, resolve }) =>
paraglideMiddleware(event.request, ({ request: localizedRequest, locale }) => {
event.request = localizedRequest
return resolve(event, {
transformPageChunk: ({ html }) => {
return html.replace("%lang%", locale)
}
})
})
export const handle: Handle = paraglideHandle

View File

@ -1,4 +1,6 @@
// file initialized by the Paraglide-SvelteKit CLI - Feel free to edit it
import { i18n } from "$lib/i18n"
import type { Reroute } from "@sveltejs/kit"
import { deLocalizeUrl } from "$lib/paraglide/runtime"
export const reroute = i18n.reroute()
export const reroute: Reroute = (request) => {
return deLocalizeUrl(request.url).pathname
}

View File

@ -1,4 +1,3 @@
import { i18n } from "@/i18n"
import { appConfig, appState, auth, extensions } from "@/stores"
import { checkUpdateAndInstall } from "@/utils/updater"
import { setTransparentTitlebar } from "@kksh/api/commands"
@ -28,7 +27,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "Go to Extension Store",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/extension/store"))
goto("/app/extension/store")
}
},
{
@ -39,7 +38,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
},
description: "",
function: async () => {
goto(i18n.resolveRoute("/app/auth"))
goto("/app/auth")
}
},
{
@ -101,7 +100,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
},
description: "",
function: async () => {
goto(i18n.resolveRoute("/app/extension/file-transfer"))
goto("/app/extension/file-transfer")
appState.clearSearchTerm()
}
},
@ -115,7 +114,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/settings/add-dev-extension"))
goto("/app/settings/add-dev-extension")
}
},
{
@ -140,7 +139,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
function: async () => {
// const appStateStore = useAppStateStore()
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/settings/set-dev-ext-path"))
goto("/app/settings/set-dev-ext-path")
}
},
{
@ -170,7 +169,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/help/deno-install"))
goto("/app/help/deno-install")
},
keywords: ["help", "deno", "install"]
},
@ -183,7 +182,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/help/ffmpeg-install"))
goto("/app/help/ffmpeg-install")
},
keywords: ["help", "ffmpeg", "install"]
},
@ -196,7 +195,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/help/brew-install"))
goto("/app/help/brew-install")
},
keywords: ["help", "brew", "install", "homebrew"]
},
@ -209,7 +208,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/help/onboarding"))
goto("/app/help/onboarding")
},
flags: {
dev: true,
@ -225,7 +224,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/extension/permission-inspector"))
goto("/app/extension/permission-inspector")
},
keywords: ["extension"]
},
@ -238,7 +237,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/troubleshooters/extension-loading"))
goto("/app/troubleshooters/extension-loading")
},
keywords: ["extension", "troubleshooter"]
},
@ -251,7 +250,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "Create a Quicklink",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/extension/create-quick-link"))
goto("/app/extension/create-quick-link")
}
},
{
@ -285,7 +284,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
},
description: "Open Settings",
function: async () => {
goto(i18n.resolveRoute("/app/settings"))
goto("/app/settings")
appState.clearSearchTerm()
}
},
@ -345,7 +344,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
},
description: "Dance",
function: async () => {
goto(i18n.resolveRoute("/app/dance"))
goto("/app/dance")
}
},
{
@ -386,7 +385,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
description: "Clipboard History",
function: async () => {
appState.clearSearchTerm()
goto(i18n.resolveRoute("/app/extension/clipboard"))
goto("/app/extension/clipboard")
}
},
{
@ -423,7 +422,7 @@ export const rawBuiltinCmds: BuiltinCmd[] = [
},
description: "MDNS Debugger",
function: async () => {
goto(i18n.resolveRoute("/app/troubleshooters/mdns-debugger"))
goto("/app/troubleshooters/mdns-debugger")
},
flags: {
developer: true

View File

@ -1,4 +1,3 @@
import { i18n } from "@/i18n"
import { appState } from "@/stores"
import { winExtMap } from "@/stores/winExtMap"
import { helperAPI } from "@/utils/helper"
@ -73,7 +72,7 @@ export async function onTemplateUiCmdSelect(
} else {
return winExtMap
.registerExtensionWithWindow({ windowLabel: "main", extPath: ext.extPath })
.then(() => goto(i18n.resolveRoute(url)))
.then(() => goto(url))
}
}
@ -202,7 +201,7 @@ export async function onCustomUiCmdSelect(
url2 = `/app/extension/ui-iframe?url=${encodeURIComponent(newUrl)}&extPath=${encodeURIComponent(ext.extPath)}`
setIframeExtParams(ext.extPath, newUrl)
}
goto(i18n.resolveRoute(url2))
goto(url2)
}
appState.clearSearchTerm()
}

View File

@ -1,14 +1,8 @@
<script lang="ts">
import HotkeyPick from "@/components/standalone/settings/hotkey-pick.svelte"
import { LanguageMap } from "@/constants"
import { i18n, switchToLanguage } from "@/i18n"
import * as m from "@/paraglide/messages"
import {
availableLanguageTags,
languageTag,
setLanguageTag,
type AvailableLanguageTag
} from "@/paraglide/runtime"
import { getLocale, locales, setLocale, type Locale } from "@/paraglide/runtime"
import { appConfig } from "@/stores"
import { Select, Switch } from "@kksh/svelte5"
import type { LoadingAnimation } from "@kksh/types"
@ -16,14 +10,14 @@
import { onMount } from "svelte"
import { toast } from "svelte-sonner"
const languages = availableLanguageTags.map((lang) => ({
const languages = locales.map((lang) => ({
value: lang,
label: LanguageMap[lang as keyof typeof LanguageMap] ?? lang
}))
let loadingAnimation = $state<LoadingAnimation>("spinning-circle")
const loadingAnimations = ["spinning-circle", "kunkun-dancing"] as const
let launchAtLogin = $state(false)
let language = $state(languageTag())
let language = $state(getLocale())
onMount(() => {
autoStart.isEnabled().then((enabled) => {
launchAtLogin = enabled
@ -95,7 +89,7 @@
<Select.Item
onclick={() => {
appConfig.setLanguage(lang.value)
switchToLanguage(lang.value as AvailableLanguageTag)
setLocale(lang.value)
}}
value={lang.value}
label={lang.label}>{lang.label}</Select.Item

View File

@ -1,7 +1,6 @@
<script lang="ts">
import DragNDrop from "@/components/common/DragNDrop.svelte"
import DevExtPathForm from "@/components/standalone/settings/DevExtPathForm.svelte"
import { i18n } from "@/i18n"
import * as m from "@/paraglide/messages"
import { appConfig, appState, extensions } from "@/stores"
import { goBackOnEscape } from "@/utils/key"
@ -91,7 +90,7 @@
async function pickExtFiles() {
if (!$appConfig.devExtensionPath) {
toast.warning("Please set the dev extension path in the settings")
return goto(i18n.resolveRoute("/app/settings/set-dev-ext-path"))
return goto("/app/settings/set-dev-ext-path")
}
appState.setLockHideOnBlur(true)
const selected = await openFileSelector({

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { i18n } from "@/i18n"
import { appConfig, extensions } from "@/stores"
import { Input } from "@kksh/svelte5"
import { Form } from "@kksh/ui"
@ -18,7 +17,7 @@
toast.warning(
"Please set the dev extension path in the settings to install tarball extension"
)
return goto(i18n.resolveRoute("/app/settings/set-dev-ext-path"))
return goto("/app/settings/set-dev-ext-path")
}
await extensions
.installFromNpmPackageName(data.name, $appConfig.devExtensionPath)

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { i18n } from "@/i18n"
import * as m from "@/paraglide/messages"
import { appConfig, extensions } from "@/stores"
import { Input } from "@kksh/svelte5"
@ -21,7 +20,7 @@
toast.warning(
"Please set the dev extension path in the settings to install tarball extension"
)
return goto(i18n.resolveRoute("/app/settings/set-dev-ext-path"))
return goto("/app/settings/set-dev-ext-path")
}
await extensions
.installFromTarballUrl(data.url, $appConfig.devExtensionPath)

View File

@ -1,17 +0,0 @@
// file initialized by the Paraglide-SvelteKit CLI - Feel free to edit it
import { createI18n } from "@inlang/paraglide-sveltekit"
import { goto } from "$app/navigation"
import { page } from "$app/state"
import * as runtime from "$lib/paraglide/runtime.js"
import { tick } from "svelte"
export const i18n = createI18n(runtime)
export function switchToLanguage(newLanguage: runtime.AvailableLanguageTag) {
runtime.setLanguageTag(newLanguage)
const canonicalPath = i18n.route(page.url.pathname)
const localisedPath = i18n.resolveRoute(canonicalPath, newLanguage)
tick().then(() => {
goto(localisedPath)
})
}

View File

@ -1,4 +1,3 @@
import { i18n } from "@/i18n"
import { emitRefreshDevExt } from "@/utils/tauri-events"
import {
DEEP_LINK_PATH_AUTH_CONFIRM,
@ -58,15 +57,15 @@ export async function handleKunkunProtocol(parsedUrl: URL) {
const parsed = v.parse(StorePathSearchParams, params)
openMainWindow()
if (parsed.identifier) {
goto(i18n.resolveRoute(`/app/extension/store/${parsed.identifier}`))
goto(`/app/extension/store/${parsed.identifier}`)
} else {
goto(i18n.resolveRoute("/app/extension/store"))
goto("/app/extension/store")
}
} else if (href.startsWith(DEEP_LINK_PATH_REFRESH_DEV_EXTENSION)) {
emitRefreshDevExt()
} else if (href.startsWith(DEEP_LINK_PATH_AUTH_CONFIRM)) {
openMainWindow()
goto(i18n.resolveRoute(`/app/auth/confirm?${parsedUrl.searchParams.toString()}`))
goto(`/app/auth/confirm?${parsedUrl.searchParams.toString()}`)
} else {
console.error("Invalid path:", pathname)
toast.error("Invalid path", {

View File

@ -1,19 +1,17 @@
/**
* This file contains APIs for helper
*/
import { i18n } from "@/i18n"
import type { IHelper } from "@kksh/api"
import { goto } from "$app/navigation"
export const helperAPI: IHelper = {
guideInstallDeno: function (): Promise<void> {
return goto(i18n.resolveRoute("/app/help/deno-install"))
return goto("/app/help/deno-install")
},
guideInstallFfmpeg: function (): Promise<void> {
return goto(i18n.resolveRoute("/app/help/ffmpeg-install"))
return goto("/app/help/ffmpeg-install")
},
guideInstallHomebrew: function (): Promise<void> {
return goto(i18n.resolveRoute("/app/help/brew-install"))
return goto("/app/help/brew-install")
}
}

View File

@ -1,4 +1,3 @@
import { i18n } from "@/i18n"
import { appState } from "@/stores"
import { keys } from "@/stores/keys"
import { toggleDevTools } from "@kksh/api/commands"
@ -82,7 +81,7 @@ export async function globalKeyDownHandler(e: KeyboardEvent) {
) {
if (e.key === ",") {
e.preventDefault()
goto(i18n.resolveRoute("/app/settings"))
goto("/app/settings")
}
}
// Toggle Devtools with control + shift + I

View File

@ -1,4 +1,4 @@
import { i18n } from "@/i18n"
// import { i18n } from "@/i18n"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { goto } from "$app/navigation"
import { isInMainWindow } from "./window"
@ -8,7 +8,7 @@ export function goBack() {
}
export function goHome() {
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
export function goHomeOrCloseDependingOnWindow() {

View File

@ -1,22 +1,30 @@
<script lang="ts">
import { ParaglideJS } from "@inlang/paraglide-sveltekit"
import { i18n } from "$lib/i18n"
// import { ParaglideJS } from "@inlang/paraglide-sveltekit"
// import { i18n } from "$lib/i18n"
import "../app.css"
import FullScreenLoading from "@/components/common/FullScreenLoading.svelte"
import { appState } from "@/stores/appState"
import { ModeWatcher, ThemeWrapper } from "@kksh/svelte5"
import { page } from "$app/state"
import { locales, localizeHref } from "$lib/paraglide/runtime"
import { Toaster } from "svelte-sonner"
let { children } = $props()
</script>
<ParaglideJS {i18n}>
<ModeWatcher />
<Toaster richColors closeButton />
<ThemeWrapper>
{#if $appState.fullScreenLoading}
<FullScreenLoading class="bg-background absolute inset-0 z-50" />
{/if}
{@render children()}
</ThemeWrapper>
</ParaglideJS>
<div style="display:none">
{#each locales as locale}
<a href={localizeHref(page.url.pathname, { locale })}>{locale}</a>
{/each}
</div>
<!-- <ParaglideJS {i18n}> -->
<ModeWatcher />
<Toaster richColors closeButton />
<ThemeWrapper>
{#if $appState.fullScreenLoading}
<FullScreenLoading class="bg-background absolute inset-0 z-50" />
{/if}
{@render children()}
</ThemeWrapper>
<!-- </ParaglideJS> -->

View File

@ -1,15 +1,5 @@
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
import { browser } from "$app/environment"
// Tauri doesn't have a Node.js server to do proper SSR
// so we will use adapter-static to prerender the app (SSG)
// See: https://v2.tauri.app/start/frontend/sveltekit/ for more info
export const prerender = true
export const ssr = false
export const load = () => {
if (browser) {
const win = getCurrentWebviewWindow()
return { win }
}
}

View File

@ -1,7 +1,6 @@
<script lang="ts">
import AppContext from "@/components/context/AppContext.svelte"
import { i18n, switchToLanguage } from "@/i18n"
import { setLanguageTag, type AvailableLanguageTag } from "@/paraglide/runtime"
import { setLocale, type Locale } from "@/paraglide/runtime"
import { appConfig, appState, extensions, quickLinks, winExtMap } from "@/stores"
import { appsLoader } from "@/stores/apps"
import { initDeeplink } from "@/utils/deeplink"
@ -65,8 +64,8 @@
appConfig.init().then(() => {
initApp()
console.log("appConfig.language", $appConfig.language)
setLanguageTag($appConfig.language as AvailableLanguageTag)
switchToLanguage($appConfig.language as AvailableLanguageTag)
// setLanguageTag($appConfig.language as AvailableLanguageTag)
setLocale($appConfig.language as Locale)
})
appsLoader.init()
if (isInMainWindow()) {

View File

@ -1,5 +1,6 @@
import { getExtensionsFolder, IS_IN_TAURI } from "@/constants"
import * as path from "@tauri-apps/api/path"
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
import { error } from "@tauri-apps/plugin-log"
import { setStoreCollectionPath } from "@tauri-store/svelte"
import type { LayoutLoad } from "./$types"
@ -7,5 +8,6 @@ import type { LayoutLoad } from "./$types"
export const load: LayoutLoad = async () => {
const appDataPath = await path.appDataDir()
await setStoreCollectionPath(await path.join(appDataPath, "kk-config"))
return { extsInstallDir: IS_IN_TAURI ? await getExtensionsFolder() : "", appDataPath }
const win = getCurrentWebviewWindow()
return { extsInstallDir: IS_IN_TAURI ? await getExtensionsFolder() : "", appDataPath, win }
}

View File

@ -4,7 +4,6 @@
import { builtinCmds } from "@/cmds/builtin"
import { systemCommands, systemCommandsFiltered } from "@/cmds/system"
import AppsCmds from "@/components/main/AppsCmds.svelte"
import { i18n } from "@/i18n"
import * as m from "@/paraglide/messages"
import {
appConfig,
@ -84,7 +83,7 @@
console.log("appConfig.get().onBoarded", appConfig.get().onBoarded)
if (!appConfig.get().onBoarded) {
setTimeout(() => {
goto(i18n.resolveRoute("/app/help/onboarding"))
goto("/app/help/onboarding")
}, 300)
}
}
@ -189,7 +188,7 @@
<span class="flex items-center">⌃+<ArrowBigUpIcon class="h-4 w-4" />+R </span>
</DropdownMenu.Shortcut>
</DropdownMenu.Item>
<DropdownMenu.Item onclick={() => goto(i18n.resolveRoute("/app/settings"))}>
<DropdownMenu.Item onclick={() => goto("/app/settings")}>
<SettingsIcon class="mr-2 h-4 w-4 text-green-500" />
{m.home_command_input_dropdown_open_preference()}
<DropdownMenu.Shortcut>

View File

@ -1,9 +1,6 @@
<script lang="ts">
import { i18n } from "@/i18n.js"
import { auth } from "@/stores"
import { supabase } from "@/supabase"
import { goHomeOnEscape } from "@/utils/key"
import { goBack, goHome } from "@/utils/route"
import { Avatar, Button } from "@kksh/svelte5"
import { goto } from "$app/navigation"
import { ArrowLeft } from "lucide-svelte"
@ -45,7 +42,7 @@
function onSignOut() {
auth
.signOut()
.then(() => goto(i18n.resolveRoute("/app/auth")))
.then(() => goto("/app/auth"))
.catch((err) => toast.error("Failed to sign out", { description: err.message }))
}
</script>
@ -56,8 +53,7 @@
variant="outline"
size="icon"
onclick={() => {
console.log("go Home")
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}}
>
<ArrowLeft class="size-4" />

View File

@ -1,12 +1,11 @@
<script lang="ts">
import { i18n } from "@/i18n"
import { Error, Layouts } from "@kksh/ui"
import { goto } from "$app/navigation"
import { page } from "$app/stores"
function handleKeyDown(event: KeyboardEvent) {
if (event.key === "Enter") {
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
}
</script>
@ -18,7 +17,7 @@
title="Fail to Load Extension"
class="w-fit max-w-screen-sm border-2 border-red-500"
message={$page.error?.message ?? "Unknown Error"}
onGoBack={() => goto(i18n.resolveRoute("/app/"))}
onGoBack={() => goto("/app/")}
rawJsonError={JSON.stringify($page, null, 2)}
/>
</Layouts.Center>

View File

@ -1,8 +1,7 @@
<script lang="ts">
import { getExtensionsFolder } from "@/constants.js"
import { i18n } from "@/i18n.js"
import { extensions, installedStoreExts } from "@/stores/extensions.js"
import { DBExtension, ExtensionStoreListItem, ExtPackageJson, ExtPublish } from "@kksh/api/models"
import { ExtPackageJson } from "@kksh/api/models"
import { postExtensionsIncrementDownloads } from "@kksh/sdk"
import { Button } from "@kksh/svelte5"
import { cn } from "@kksh/svelte5/utils"
@ -154,7 +153,7 @@
function handleKeydown(e: KeyboardEvent) {
if (e.key === "Escape") {
if (!delayedImageDialogOpen) {
goto(i18n.resolveRoute("/app/extension/store"))
goto("/app/extension/store")
}
}
}
@ -166,7 +165,7 @@
size="icon"
class={cn("fixed left-3 top-3 z-50", Constants.CLASSNAMES.BACK_BUTTON)}
data-flip-id={Constants.CLASSNAMES.BACK_BUTTON}
onclick={() => goto(i18n.resolveRoute("/app/extension/store"))}
onclick={() => goto("/app/extension/store")}
>
<ArrowLeftIcon />
</Button>

View File

@ -1,6 +1,4 @@
<script lang="ts">
import DanceTransition from "@/components/dance/dance-transition.svelte"
import { i18n } from "@/i18n"
import { appConfig, appState, winExtMap } from "@/stores"
import { helperAPI } from "@/utils/helper"
import { paste } from "@/utils/hotkey"
@ -62,7 +60,7 @@
const iframeUiAPI: IUiCustomServer2 = {
goBack: async () => {
if (isInMainWindow()) {
goto(i18n.resolveRoute("/app/"))
goto("/app/")
} else {
data.win?.close()
}

View File

@ -1,6 +1,4 @@
import { KunkunIframeExtParams } from "@/cmds/ext"
import { i18n } from "@/i18n"
import { appState } from "@/stores/appState"
import { db, unregisterExtensionWindow } from "@kksh/api/commands"
import type { Ext as ExtInfoInDB, ExtPackageJsonExtra } from "@kksh/api/models"
import { loadExtensionManifestFromDisk } from "@kksh/extension"
@ -61,7 +59,7 @@ export const load: PageLoad = async ({
toast.error("Error loading extension manifest", {
description: `${err}`
})
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
const loadedExt = _loadedExt!
const extInfoInDB = await db.getUniqueExtensionByPath(loadedExt.extPath)
@ -69,7 +67,7 @@ export const load: PageLoad = async ({
toast.error("Unexpected Error", {
description: `Extension ${loadedExt.kunkun.identifier} not found in database. Run Troubleshooter.`
})
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
return { extPath, url: extUrl, loadedExt, extInfoInDB: extInfoInDB! }
}

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { i18n } from "@/i18n.js"
import { appState } from "@/stores/appState.js"
import { keys } from "@/stores/keys"
import { winExtMap } from "@/stores/winExtMap.js"
@ -79,7 +78,7 @@
let curViewNodeName = $state<NodeNameEnum | FormNodeNameEnum | null>(null)
async function goBack() {
if (isInMainWindow()) {
goto(i18n.resolveRoute("/app/"))
goto("/app/")
} else {
appWin.close()
}

View File

@ -1,5 +1,4 @@
import { KunkunTemplateExtParams } from "@/cmds/ext"
import { i18n } from "@/i18n"
import { db, unregisterExtensionWindow } from "@kksh/api/commands"
import type { Ext as ExtInfoInDB, ExtPackageJsonExtra } from "@kksh/api/models"
import { loadExtensionManifestFromDisk } from "@kksh/extension"
@ -40,7 +39,7 @@ export const load: PageLoad = async ({ url }) => {
toast.error("Error loading extension manifest", {
description: `${err}`
})
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
const loadedExt = _loadedExt!
const extInfoInDB = await db.getUniqueExtensionByPath(loadedExt.extPath)
@ -48,7 +47,7 @@ export const load: PageLoad = async ({ url }) => {
toast.error("Unexpected Error", {
description: `Extension ${loadedExt.kunkun.identifier} not found in database. Run Troubleshooter.`
})
goto(i18n.resolveRoute("/app/"))
goto("/app/")
}
const pkgJsonPath = await join(extPath!, "package.json")
if (!(await exists(extPath!))) {

View File

@ -2,7 +2,6 @@
import GeneralSettings from "@/components/standalone/general-settings.svelte"
import DenoInstall from "@/components/standalone/help/deno-install.svelte"
import FFmpegInstall from "@/components/standalone/help/ffmpeg-install.svelte"
import { i18n } from "@/i18n"
import { appConfig } from "@/stores/appConfig"
import { Button } from "@kksh/svelte5"
import { goto } from "$app/navigation"
@ -27,7 +26,7 @@
$effect(() => {
if (step > Step.GeneralSettings) {
appConfig.setOnBoarded(true)
goto(i18n.resolveRoute("/app"))
goto("/app")
}
// if (step === Step.DenoInstall) {
// if (denoPath) {
@ -39,7 +38,7 @@
// }
// } else if (step > Step.FFmpegInstall) {
// appConfig.setOnBoarded(true)
// goto(i18n.resolveRoute("/app"))
// goto("/app")
// }
})
</script>

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { i18n } from "@/i18n"
import * as m from "@/paraglide/messages"
import { goHome } from "@/utils/route"
import { Button, Sidebar } from "@kksh/svelte5"
@ -15,37 +14,37 @@
const items = [
{
title: m.settings_menu_general(),
url: i18n.resolveRoute("/app/settings"),
url: "/app/settings",
icon: Cog
},
{
title: m.settings_menu_app_search_paths(),
url: i18n.resolveRoute("/app/settings/app-search-paths"),
url: "/app/settings/app-search-paths",
icon: FolderSearch
},
// {
// title: m.settings_menu_developer(),
// url: i18n.resolveRoute("/app/settings/developer"),
// url: "/app/settings/developer",
// icon: SquareTerminal
// },
{
title: m.settings_menu_extensions(),
url: i18n.resolveRoute("/app/settings/extensions"),
url: "/app/settings/extensions",
icon: Blocks
},
{
title: m.settings_menu_set_dev_ext(),
url: i18n.resolveRoute("/app/settings/set-dev-ext-path"),
url: "/app/settings/set-dev-ext-path",
icon: Route
},
{
title: m.settings_menu_add_dev_ext(),
url: i18n.resolveRoute("/app/settings/add-dev-extension"),
url: "/app/settings/add-dev-extension",
icon: FileCode2
},
{
title: m.settings_menu_about(),
url: i18n.resolveRoute("/app/settings/about"),
url: "/app/settings/about",
icon: Info
}
]

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { i18n } from "@/i18n"
import * as m from "@/paraglide/messages"
import { goHome } from "@/utils/route"
import { Button, Sidebar } from "@kksh/svelte5"
@ -13,17 +12,17 @@
const items = [
{
title: m.troubleshooters_sidebar_extension_loading_title(),
url: i18n.resolveRoute("/app/troubleshooters/extension-loading"),
url: "/app/troubleshooters/extension-loading",
icon: Loader
},
{
title: m.troubleshooters_sidebar_extension_window_title(),
url: i18n.resolveRoute("/app/troubleshooters/extension-window"),
url: "/app/troubleshooters/extension-window",
icon: AppWindow
},
{
title: m.troubleshooters_sidebar_mdns_debugger_title(),
url: i18n.resolveRoute("/app/troubleshooters/mdns-debugger"),
url: "/app/troubleshooters/mdns-debugger",
icon: Network
}
]

View File

@ -1,4 +1,5 @@
import { paraglide } from "@inlang/paraglide-sveltekit/vite"
// import { paraglide } from "@inlang/paraglide-sveltekit/vite"
import { paraglideVitePlugin } from "@inlang/paraglide-js"
import { sveltekit } from "@sveltejs/kit/vite"
import { defineConfig } from "vite"
@ -7,7 +8,15 @@ const host = process.env.TAURI_DEV_HOST
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [paraglide({ project: "./project.inlang", outdir: "./src/lib/paraglide" }), sveltekit()],
plugins: [
sveltekit(),
paraglideVitePlugin({
project: "./project.inlang",
outdir: "./src/lib/paraglide",
strategy: ["url", "cookie", "baseLocale"],
disableAsyncLocalStorage: true
})
],
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors

822
deno.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
"prettier": "^3.5.2",
"prettier-plugin-svelte": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.11",
"svelte": "^5.20.5",
"svelte-check": "^4.1.4",
"svelte": "^5.25.3",
"svelte-check": "^4.1.5",
"turbo": "^2.4.4",
"typescript": "^5.0.0",
"verify-package-export": "^0.0.3"

View File

@ -1,4 +1,3 @@
## Permission Table
<table>
@ -7,7 +6,6 @@
<th>Description</th>
</tr>
<tr>
<td>

1235
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff