mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-11 17:29:44 +00:00
more types fixed
This commit is contained in:
parent
67807b229d
commit
0c9d9d5373
@ -3,16 +3,16 @@
|
|||||||
* It's designed to allow all components to access a shared state.
|
* 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.
|
* 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 { getContext, setContext } from "svelte"
|
||||||
import type { Writable } from "svelte/store"
|
import type { Writable } from "svelte/store"
|
||||||
|
|
||||||
export const APP_CONFIG_CONTEXT_KEY = Symbol("appConfig")
|
export const APP_CONFIG_CONTEXT_KEY = Symbol("appConfig")
|
||||||
|
|
||||||
export function getAppConfigContext(): Writable<AppConfig> {
|
export function getAppConfigContext(): Writable<AppConfigState> {
|
||||||
return getContext(APP_CONFIG_CONTEXT_KEY)
|
return getContext(APP_CONFIG_CONTEXT_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setAppConfigContext(appConfig: Writable<AppConfig>) {
|
export function setAppConfigContext(appConfig: Writable<AppConfigState>) {
|
||||||
setContext(APP_CONFIG_CONTEXT_KEY, appConfig)
|
setContext(APP_CONFIG_CONTEXT_KEY, appConfig)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { AppState } from "@/types/appState"
|
import type { AppState } from "@kksh/types"
|
||||||
import { getContext, setContext } from "svelte"
|
import { getContext, setContext } from "svelte"
|
||||||
import type { Writable } from "svelte/store"
|
import type { Writable } from "svelte/store"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import Fuse from "fuse.js"
|
|||||||
import { derived, get, writable } from "svelte/store"
|
import { derived, get, writable } from "svelte/store"
|
||||||
import { appState } from "./appState"
|
import { appState } from "./appState"
|
||||||
|
|
||||||
export const fuse = new Fuse<AppInfo>([], {
|
const fuse = new Fuse<AppInfo>([], {
|
||||||
includeScore: true,
|
includeScore: true,
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
keys: ["name"]
|
keys: ["name"]
|
||||||
|
@ -6,7 +6,7 @@ import Fuse from "fuse.js"
|
|||||||
import { derived, get, writable, type Writable } from "svelte/store"
|
import { derived, get, writable, type Writable } from "svelte/store"
|
||||||
import { appState } from "./appState"
|
import { appState } from "./appState"
|
||||||
|
|
||||||
export const fuse = new Fuse<QuickLink>([], {
|
const fuse = new Fuse<QuickLink>([], {
|
||||||
includeScore: true,
|
includeScore: true,
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
keys: ["name"]
|
keys: ["name"]
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "bundler"
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true
|
||||||
},
|
},
|
||||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
// 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
|
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||||
|
@ -29,6 +29,7 @@ export const TitleBarStyleEnum = {
|
|||||||
transparent: "transparent",
|
transparent: "transparent",
|
||||||
overlay: "overlay"
|
overlay: "overlay"
|
||||||
}
|
}
|
||||||
|
export type TitleBarStyle = v.InferOutput<typeof TitleBarStyle>
|
||||||
export const TitleBarStyle = v.picklist(Object.values(TitleBarStyleEnum))
|
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.
|
// 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
|
// This lowercase title bar style schema is used to validate and set the type so TypeScript won't complaint
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
"./install": "./src/install.ts"
|
"./install": "./src/install.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "latest"
|
"@types/bun": "latest",
|
||||||
|
"@types/semver": "^7.5.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kksh/api": "workspace:*",
|
"@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",
|
"@tauri-apps/plugin-upload": "^2.2.1",
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"uuid": "^11.0.3"
|
"uuid": "^11.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
|
@ -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"
|
import { WebviewWindow } from "@tauri-apps/api/webviewWindow"
|
||||||
|
|
||||||
export function launchNewExtWindow(windowLabel: string, url: string, windowConfig?: WindowConfig) {
|
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,
|
skipTaskbar: windowConfig?.skipTaskbar ?? undefined,
|
||||||
shadow: windowConfig?.shadow ?? undefined,
|
shadow: windowConfig?.shadow ?? undefined,
|
||||||
// theme: windowConfig?.theme ?? undefined,
|
// theme: windowConfig?.theme ?? undefined,
|
||||||
titleBarStyle: windowConfig?.titleBarStyle ?? undefined,
|
titleBarStyle:
|
||||||
|
(windowConfig?.titleBarStyle as keyof typeof TitleBarStyleEnum | undefined) ?? undefined,
|
||||||
hiddenTitle: windowConfig?.hiddenTitle ?? undefined,
|
hiddenTitle: windowConfig?.hiddenTitle ?? undefined,
|
||||||
tabbingIdentifier: windowConfig?.tabbingIdentifier ?? undefined,
|
tabbingIdentifier: windowConfig?.tabbingIdentifier ?? undefined,
|
||||||
maximizable: windowConfig?.maximizable ?? undefined,
|
maximizable: windowConfig?.maximizable ?? undefined,
|
||||||
|
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
@ -19,7 +19,7 @@ importers:
|
|||||||
version: 4.2.0(svelte@5.20.5)
|
version: 4.2.0(svelte@5.20.5)
|
||||||
'@kksh/sdk':
|
'@kksh/sdk':
|
||||||
specifier: ^0.0.2
|
specifier: ^0.0.2
|
||||||
version: link:../kunkun-services/packages/sdk
|
version: 0.0.2(typescript@5.7.3)
|
||||||
'@supabase/supabase-js':
|
'@supabase/supabase-js':
|
||||||
specifier: ^2.49.1
|
specifier: ^2.49.1
|
||||||
version: 2.49.1
|
version: 2.49.1
|
||||||
@ -546,7 +546,7 @@ importers:
|
|||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../api
|
version: link:../api
|
||||||
'@std/semver':
|
'@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'
|
version: '@jsr/std__semver@1.0.3'
|
||||||
'@tauri-apps/plugin-upload':
|
'@tauri-apps/plugin-upload':
|
||||||
specifier: ^2.2.1
|
specifier: ^2.2.1
|
||||||
@ -558,12 +558,15 @@ importers:
|
|||||||
specifier: ^5.0.0
|
specifier: ^5.0.0
|
||||||
version: 5.5.4
|
version: 5.5.4
|
||||||
uuid:
|
uuid:
|
||||||
specifier: ^11.0.3
|
specifier: ^11.1.0
|
||||||
version: 11.0.3
|
version: 11.1.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/bun':
|
'@types/bun':
|
||||||
specifier: latest
|
specifier: latest
|
||||||
version: 1.2.6
|
version: 1.2.6
|
||||||
|
'@types/semver':
|
||||||
|
specifier: ^7.5.8
|
||||||
|
version: 7.5.8
|
||||||
|
|
||||||
packages/extensions/demo-worker-template-ext:
|
packages/extensions/demo-worker-template-ext:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -2993,6 +2996,11 @@ packages:
|
|||||||
react: ^18.2.0
|
react: ^18.2.0
|
||||||
react-dom: ^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':
|
'@kksh/svelte5@0.1.15':
|
||||||
resolution: {integrity: sha512-Cr/gSWsnRtQIQLpQAkGBODujWn5g4LlhDp865skRV95tkrOuAwbbWGjG5+oWx1fK+fiDu+rhe2UCqw61SW2B/Q==}
|
resolution: {integrity: sha512-Cr/gSWsnRtQIQLpQAkGBODujWn5g4LlhDp865skRV95tkrOuAwbbWGjG5+oWx1fK+fiDu+rhe2UCqw61SW2B/Q==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -14600,6 +14608,10 @@ snapshots:
|
|||||||
- '@types/react-dom'
|
- '@types/react-dom'
|
||||||
- tailwindcss
|
- 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)':
|
'@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:
|
dependencies:
|
||||||
'@tanstack/table-core': 8.21.2
|
'@tanstack/table-core': 8.21.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user