diff --git a/apps/desktop/src/lib/context/appConfig.ts b/apps/desktop/src/lib/context/appConfig.ts index 4537631..5f99a7e 100644 --- a/apps/desktop/src/lib/context/appConfig.ts +++ b/apps/desktop/src/lib/context/appConfig.ts @@ -3,16 +3,16 @@ * It's designed to allow all components to access a shared state. * With context, we can avoid prop drilling, and avoid using stores which makes components hard to encapsulate. */ -import type { AppConfig } from "@/types/appConfig" +import type { AppConfigState } from "@kksh/types" import { getContext, setContext } from "svelte" import type { Writable } from "svelte/store" export const APP_CONFIG_CONTEXT_KEY = Symbol("appConfig") -export function getAppConfigContext(): Writable { +export function getAppConfigContext(): Writable { return getContext(APP_CONFIG_CONTEXT_KEY) } -export function setAppConfigContext(appConfig: Writable) { +export function setAppConfigContext(appConfig: Writable) { setContext(APP_CONFIG_CONTEXT_KEY, appConfig) } diff --git a/apps/desktop/src/lib/context/appState.ts b/apps/desktop/src/lib/context/appState.ts index 12aa792..02acf83 100644 --- a/apps/desktop/src/lib/context/appState.ts +++ b/apps/desktop/src/lib/context/appState.ts @@ -1,4 +1,4 @@ -import type { AppState } from "@/types/appState" +import type { AppState } from "@kksh/types" import { getContext, setContext } from "svelte" import type { Writable } from "svelte/store" diff --git a/apps/desktop/src/lib/stores/apps.ts b/apps/desktop/src/lib/stores/apps.ts index 700b7c7..5f39267 100644 --- a/apps/desktop/src/lib/stores/apps.ts +++ b/apps/desktop/src/lib/stores/apps.ts @@ -7,7 +7,7 @@ import Fuse from "fuse.js" import { derived, get, writable } from "svelte/store" import { appState } from "./appState" -export const fuse = new Fuse([], { +const fuse = new Fuse([], { includeScore: true, threshold: 0.2, keys: ["name"] diff --git a/apps/desktop/src/lib/stores/quick-links.ts b/apps/desktop/src/lib/stores/quick-links.ts index 120ea98..bd263b9 100644 --- a/apps/desktop/src/lib/stores/quick-links.ts +++ b/apps/desktop/src/lib/stores/quick-links.ts @@ -6,7 +6,7 @@ import Fuse from "fuse.js" import { derived, get, writable, type Writable } from "svelte/store" import { appState } from "./appState" -export const fuse = new Fuse([], { +const fuse = new Fuse([], { includeScore: true, threshold: 0.2, keys: ["name"] diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index a2288c7..ac5f854 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -9,7 +9,8 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "moduleResolution": "bundler" + "moduleResolution": "bundler", + "allowImportingTsExtensions": true }, // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias // except $lib which is handled by https://kit.svelte.dev/docs/configuration#files diff --git a/packages/api/src/models/manifest.ts b/packages/api/src/models/manifest.ts index 5c99b2a..055dd88 100644 --- a/packages/api/src/models/manifest.ts +++ b/packages/api/src/models/manifest.ts @@ -29,6 +29,7 @@ export const TitleBarStyleEnum = { transparent: "transparent", overlay: "overlay" } +export type TitleBarStyle = v.InferOutput export const TitleBarStyle = v.picklist(Object.values(TitleBarStyleEnum)) // JS new WebViewWindow only accepts lowercase, while manifest loaded from Rust is capitalized. I run toLowerCase() on the value before passing it to the WebViewWindow. // This lowercase title bar style schema is used to validate and set the type so TypeScript won't complaint diff --git a/packages/extension/package.json b/packages/extension/package.json index 52152af..c04c2f9 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -11,14 +11,15 @@ "./install": "./src/install.ts" }, "devDependencies": { - "@types/bun": "latest" + "@types/bun": "latest", + "@types/semver": "^7.5.8" }, "dependencies": { "@kksh/api": "workspace:*", - "@std/semver": "npm:@jsr/std__semver@^1.0.3", + "@std/semver": "npm:@jsr/std__semver@^1.0.4", "@tauri-apps/plugin-upload": "^2.2.1", "semver": "^7.7.1", - "uuid": "^11.0.3" + "uuid": "^11.1.0" }, "peerDependencies": { "typescript": "^5.0.0" diff --git a/packages/extension/src/window.ts b/packages/extension/src/window.ts index 6ee8d3e..513771f 100644 --- a/packages/extension/src/window.ts +++ b/packages/extension/src/window.ts @@ -1,4 +1,5 @@ -import type { WindowConfig } from "@kksh/api/models" +import type { TitleBarStyle, WindowConfig } from "@kksh/api/models" +import { TitleBarStyleEnum } from "@kksh/api/models" import { WebviewWindow } from "@tauri-apps/api/webviewWindow" export function launchNewExtWindow(windowLabel: string, url: string, windowConfig?: WindowConfig) { @@ -26,7 +27,8 @@ export function launchNewExtWindow(windowLabel: string, url: string, windowConfi skipTaskbar: windowConfig?.skipTaskbar ?? undefined, shadow: windowConfig?.shadow ?? undefined, // theme: windowConfig?.theme ?? undefined, - titleBarStyle: windowConfig?.titleBarStyle ?? undefined, + titleBarStyle: + (windowConfig?.titleBarStyle as keyof typeof TitleBarStyleEnum | undefined) ?? undefined, hiddenTitle: windowConfig?.hiddenTitle ?? undefined, tabbingIdentifier: windowConfig?.tabbingIdentifier ?? undefined, maximizable: windowConfig?.maximizable ?? undefined, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 60dbd78..a2c0d10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,7 +19,7 @@ importers: version: 4.2.0(svelte@5.20.5) '@kksh/sdk': specifier: ^0.0.2 - version: link:../kunkun-services/packages/sdk + version: 0.0.2(typescript@5.7.3) '@supabase/supabase-js': specifier: ^2.49.1 version: 2.49.1 @@ -546,7 +546,7 @@ importers: specifier: workspace:* version: link:../api '@std/semver': - specifier: npm:@jsr/std__semver@^1.0.3 + specifier: npm:@jsr/std__semver@^1.0.4 version: '@jsr/std__semver@1.0.3' '@tauri-apps/plugin-upload': specifier: ^2.2.1 @@ -558,12 +558,15 @@ importers: specifier: ^5.0.0 version: 5.5.4 uuid: - specifier: ^11.0.3 - version: 11.0.3 + specifier: ^11.1.0 + version: 11.1.0 devDependencies: '@types/bun': specifier: latest version: 1.2.6 + '@types/semver': + specifier: ^7.5.8 + version: 7.5.8 packages/extensions/demo-worker-template-ext: dependencies: @@ -2993,6 +2996,11 @@ packages: react: ^18.2.0 react-dom: ^18.2.0 + '@kksh/sdk@0.0.2': + resolution: {integrity: sha512-z6OXrdWs5IvYlf1RFVzY8Drro9Ye/oDViTpmVZp/sOUPExFtNRnJZGBKvTW7zE23jv1AXByVYxRwDjLb4zI6Sg==} + peerDependencies: + typescript: ^5 + '@kksh/svelte5@0.1.15': resolution: {integrity: sha512-Cr/gSWsnRtQIQLpQAkGBODujWn5g4LlhDp865skRV95tkrOuAwbbWGjG5+oWx1fK+fiDu+rhe2UCqw61SW2B/Q==} peerDependencies: @@ -14600,6 +14608,10 @@ snapshots: - '@types/react-dom' - tailwindcss + '@kksh/sdk@0.0.2(typescript@5.7.3)': + dependencies: + typescript: 5.7.3 + '@kksh/svelte5@0.1.15(lucide-svelte@0.469.0(svelte@5.16.6))(svelte-sonner@0.3.28(svelte@5.16.6))(svelte@5.16.6)(sveltekit-superforms@2.23.1(@sveltejs/kit@2.15.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.16.6)(vite@6.0.7(@types/node@22.13.1)(jiti@2.4.0)(terser@5.36.0)(yaml@2.6.1)))(svelte@5.16.6)(vite@6.0.7(@types/node@22.13.1)(jiti@2.4.0)(terser@5.36.0)(yaml@2.6.1)))(@types/json-schema@7.0.15)(svelte@5.16.6)(typescript@5.7.2))(typescript@5.7.2)': dependencies: '@tanstack/table-core': 8.21.2