mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-05-24 13:45:03 +00:00
Compare commits
4 Commits
1823ab2448
...
acc1e7ffae
Author | SHA1 | Date | |
---|---|---|---|
![]() |
acc1e7ffae | ||
![]() |
0c9d9d5373 | ||
![]() |
67807b229d | ||
![]() |
e413121cd1 |
@ -1,3 +1,4 @@
|
||||
import { IconType } from "@kksh/api/models"
|
||||
import { getExtensionsLatestPublishByIdentifier } from "@kksh/sdk"
|
||||
|
||||
const latestPublish = await getExtensionsLatestPublishByIdentifier({
|
||||
@ -6,3 +7,7 @@ const latestPublish = await getExtensionsLatestPublishByIdentifier({
|
||||
}
|
||||
})
|
||||
console.log(latestPublish)
|
||||
// latestPublish
|
||||
|
||||
// console.log(typeof IconEnum.Iconify)
|
||||
console.log(IconType.options)
|
||||
|
@ -12,7 +12,7 @@ import { onQuickLinkSelect } from "./quick-links"
|
||||
|
||||
const onExtCmdSelect: OnExtCmdSelect = (
|
||||
ext: ExtPackageJsonExtra,
|
||||
cmd: CustomUiCmd | TemplateUiCmd,
|
||||
cmd: CustomUiCmd | TemplateUiCmd | HeadlessCmd,
|
||||
{ isDev, hmr }: { isDev: boolean; hmr: boolean }
|
||||
) => {
|
||||
switch (cmd.type) {
|
||||
|
@ -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<AppConfig> {
|
||||
export function getAppConfigContext(): Writable<AppConfigState> {
|
||||
return getContext(APP_CONFIG_CONTEXT_KEY)
|
||||
}
|
||||
|
||||
export function setAppConfigContext(appConfig: Writable<AppConfig>) {
|
||||
export function setAppConfigContext(appConfig: Writable<AppConfigState>) {
|
||||
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 type { Writable } from "svelte/store"
|
||||
|
||||
|
@ -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<AppInfo>([], {
|
||||
const fuse = new Fuse<AppInfo>([], {
|
||||
includeScore: true,
|
||||
threshold: 0.2,
|
||||
keys: ["name"]
|
||||
|
@ -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<QuickLink>([], {
|
||||
const fuse = new Fuse<QuickLink>([], {
|
||||
includeScore: true,
|
||||
threshold: 0.2,
|
||||
keys: ["name"]
|
||||
|
@ -82,7 +82,7 @@
|
||||
})
|
||||
if (error)
|
||||
return toast.error("Fail to get latest extension", {
|
||||
description: error as string
|
||||
description: error.error
|
||||
})
|
||||
const installExtras = await getInstallExtras(data?.metadata)
|
||||
return extensions
|
||||
@ -100,7 +100,7 @@
|
||||
})
|
||||
if (error)
|
||||
return toast.error("Fail to get latest extension", {
|
||||
description: error
|
||||
description: error.error
|
||||
})
|
||||
|
||||
const installExtras = await getInstallExtras(data?.metadata)
|
||||
@ -164,7 +164,7 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={onkeydown} />
|
||||
<svelte:window {onkeydown} />
|
||||
{#snippet leftSlot()}
|
||||
<Button
|
||||
variant="outline"
|
||||
|
@ -21,7 +21,6 @@ export const load: PageLoad = (): Promise<{
|
||||
if (error) {
|
||||
toast.error(`Failed to load extension store: ${error} (${response.status})`)
|
||||
goHome()
|
||||
return
|
||||
}
|
||||
const storeExtsMap = Object.fromEntries(storeExtList.map((ext) => [ext.identifier, ext]))
|
||||
const installedExtsMap = derived(installedStoreExts, ($exts) =>
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { getExtensionsFolder } from "@/constants.js"
|
||||
import { i18n } from "@/i18n.js"
|
||||
import { extensions, installedStoreExts } from "@/stores/extensions.js"
|
||||
import { ExtensionStoreListItem, ExtPackageJson, ExtPublish } from "@kksh/api/models"
|
||||
import { DBExtension, ExtensionStoreListItem, ExtPackageJson, ExtPublish } from "@kksh/api/models"
|
||||
import { postExtensionsIncrementDownloads } from "@kksh/sdk"
|
||||
import { Button } from "@kksh/svelte5"
|
||||
import { cn } from "@kksh/svelte5/utils"
|
||||
@ -19,8 +19,8 @@
|
||||
import { getInstallExtras } from "./helper"
|
||||
|
||||
const { data } = $props()
|
||||
const extPublish: ExtPublish = $derived(data.extPublish)
|
||||
const ext: ExtensionStoreListItem = $derived(data.ext)
|
||||
const extPublish = $derived(data.extPublish)
|
||||
const ext = $derived(data.ext)
|
||||
const manifest = $derived(data.manifest)
|
||||
const installedExt = storeDerived(installedStoreExts, ($e) => {
|
||||
return $e.find((e) => e.kunkun.identifier === extPublish.identifier)
|
||||
|
@ -1,28 +1,16 @@
|
||||
import { appState, extensions } from "@/stores"
|
||||
import {
|
||||
ExtensionStoreListItem,
|
||||
ExtPublish,
|
||||
KunkunExtManifest,
|
||||
type ExtPackageJsonExtra
|
||||
} from "@kksh/api/models"
|
||||
import {
|
||||
getExtensionsByIdentifier,
|
||||
getExtensionsLatestPublishByIdentifier,
|
||||
type GetExtensionsByIdentifierResponse,
|
||||
type GetExtensionsLatestPublishByIdentifierResponse,
|
||||
type GetExtensionsLatestPublishByIdentifierResponses
|
||||
} from "@kksh/sdk"
|
||||
import { appState } from "@/stores"
|
||||
import { DBExtension, ExtPublish, KunkunExtManifest } from "@kksh/api/models"
|
||||
import { getExtensionsByIdentifier, getExtensionsLatestPublishByIdentifier } from "@kksh/sdk"
|
||||
import { error } from "@sveltejs/kit"
|
||||
import { toast } from "svelte-sonner"
|
||||
import * as v from "valibot"
|
||||
import type { PageLoad } from "./$types"
|
||||
|
||||
export const load: PageLoad = ({
|
||||
params
|
||||
}): Promise<{
|
||||
// extPublish: GetExtensionsLatestPublishByIdentifierResponses['200']
|
||||
ext: GetExtensionsByIdentifierResponse
|
||||
manifest: GetExtensionsLatestPublishByIdentifierResponse["manifest"]
|
||||
extPublish: ExtPublish
|
||||
ext: DBExtension
|
||||
manifest: KunkunExtManifest
|
||||
params: {
|
||||
identifier: string
|
||||
}
|
||||
@ -35,27 +23,29 @@ export const load: PageLoad = ({
|
||||
})
|
||||
.then(async ({ data: extPublish, error: err, response }) => {
|
||||
if (err || !extPublish) {
|
||||
console.error(err)
|
||||
return error(400, {
|
||||
return error(response.status, {
|
||||
message: "Failed to get extension publish"
|
||||
})
|
||||
}
|
||||
const { data: ext, error: extError } = await getExtensionsByIdentifier({
|
||||
const {
|
||||
data: ext,
|
||||
error: extError,
|
||||
response: extRes
|
||||
} = await getExtensionsByIdentifier({
|
||||
path: {
|
||||
identifier: params.identifier
|
||||
}
|
||||
})
|
||||
if (extError) {
|
||||
if (extError || !ext) {
|
||||
console.error(extError)
|
||||
return error(400, {
|
||||
message: "Failed to get extension"
|
||||
return error(extRes.status, {
|
||||
message: extError.error || "Failed to get extension"
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
// extPublish,
|
||||
extPublish: v.parse(ExtPublish, extPublish),
|
||||
ext,
|
||||
manifest: extPublish.manifest,
|
||||
manifest: v.parse(KunkunExtManifest, extPublish.manifest),
|
||||
params
|
||||
}
|
||||
})
|
||||
|
@ -1,11 +1,9 @@
|
||||
import type { ExtPublishMetadata } from "@kunkunapi/src/models"
|
||||
|
||||
export async function getInstallExtras(
|
||||
extMetadata?: {
|
||||
export async function getInstallExtras(extMetadata?: {
|
||||
sourceType?: string
|
||||
source?: string
|
||||
}
|
||||
): Promise<{ overwritePackageJson?: string }> {
|
||||
}): Promise<{ overwritePackageJson?: string }> {
|
||||
const extras: { overwritePackageJson?: string } = {}
|
||||
if (extMetadata?.sourceType) {
|
||||
if (extMetadata?.sourceType === "jsr") {
|
||||
|
@ -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
|
||||
|
@ -28,8 +28,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@changesets/cli": "^2.28.1",
|
||||
"@hey-api/client-fetch": "^0.8.3",
|
||||
"@iconify/svelte": "^4.2.0",
|
||||
"@kksh/sdk": "^0.0.1",
|
||||
"@kksh/sdk": "^0.0.3",
|
||||
"@supabase/supabase-js": "^2.49.1",
|
||||
"@tauri-apps/api": "^2.3.0",
|
||||
"@tauri-apps/cli": "^2.3.1",
|
||||
|
@ -1,91 +1,78 @@
|
||||
import {
|
||||
any,
|
||||
array,
|
||||
boolean,
|
||||
date,
|
||||
enum_,
|
||||
function_,
|
||||
nullable,
|
||||
number,
|
||||
object,
|
||||
optional,
|
||||
record,
|
||||
string,
|
||||
type InferOutput
|
||||
} from "valibot"
|
||||
import * as v from "valibot"
|
||||
import { Icon } from "./icon"
|
||||
|
||||
/**
|
||||
* Map window label to extension
|
||||
*/
|
||||
export const ExtensionLabelMap = record(
|
||||
string("Window label"),
|
||||
object({
|
||||
path: string("Path to the extension"),
|
||||
processes: array(number()),
|
||||
dist: optional(nullable(string()))
|
||||
export const ExtensionLabelMap = v.record(
|
||||
v.string("Window label"),
|
||||
v.object({
|
||||
path: v.string("Path to the extension"),
|
||||
processes: v.array(v.number()),
|
||||
dist: v.optional(v.nullable(v.string()))
|
||||
})
|
||||
)
|
||||
export type ExtensionLabelMap = InferOutput<typeof ExtensionLabelMap>
|
||||
export type ExtensionLabelMap = v.InferOutput<typeof ExtensionLabelMap>
|
||||
|
||||
export const Ext = object({
|
||||
extId: number(),
|
||||
identifier: string(),
|
||||
version: string(),
|
||||
enabled: boolean(),
|
||||
installed_at: string(),
|
||||
path: nullable(string()),
|
||||
data: nullable(any())
|
||||
export const Ext = v.object({
|
||||
extId: v.number(),
|
||||
identifier: v.string(),
|
||||
version: v.string(),
|
||||
enabled: v.boolean(),
|
||||
installed_at: v.string(),
|
||||
path: v.optional(v.nullable(v.string())),
|
||||
data: v.optional(v.any())
|
||||
})
|
||||
export type Ext = InferOutput<typeof Ext>
|
||||
export type Ext = v.InferOutput<typeof Ext>
|
||||
|
||||
export enum CmdTypeEnum {
|
||||
HeadlessWorker = "headless_worker",
|
||||
Builtin = "builtin",
|
||||
System = "system",
|
||||
UiWorker = "ui_worker",
|
||||
UiIframe = "ui_iframe",
|
||||
QuickLink = "quick_link",
|
||||
Remote = "remote"
|
||||
export const CmdTypeEnum = {
|
||||
HeadlessWorker: "headless_worker",
|
||||
Builtin: "builtin",
|
||||
System: "system",
|
||||
UiWorker: "ui_worker",
|
||||
UiIframe: "ui_iframe",
|
||||
QuickLink: "quick_link",
|
||||
Remote: "remote"
|
||||
}
|
||||
|
||||
export const CmdType = enum_(CmdTypeEnum)
|
||||
export type CmdType = InferOutput<typeof CmdType>
|
||||
export const ExtCmd = object({
|
||||
cmdId: number(),
|
||||
extId: number(),
|
||||
name: string(),
|
||||
export const CmdType = v.picklist(Object.values(CmdTypeEnum))
|
||||
|
||||
export type CmdType = v.InferOutput<typeof CmdType>
|
||||
export const ExtCmd = v.object({
|
||||
cmdId: v.number(),
|
||||
extId: v.number(),
|
||||
name: v.string(),
|
||||
type: CmdType,
|
||||
data: string(),
|
||||
alias: nullable(optional(string())),
|
||||
hotkey: nullable(optional(string())),
|
||||
enabled: boolean()
|
||||
data: v.string(),
|
||||
alias: v.optional(v.nullable(v.string())),
|
||||
hotkey: v.optional(v.nullable(v.string())),
|
||||
enabled: v.boolean()
|
||||
})
|
||||
export type ExtCmd = InferOutput<typeof ExtCmd>
|
||||
export type ExtCmd = v.InferOutput<typeof ExtCmd>
|
||||
|
||||
export const QuickLinkCmd = object({
|
||||
export const QuickLinkCmd = v.object({
|
||||
...ExtCmd.entries,
|
||||
data: object({ link: string(), icon: Icon })
|
||||
data: v.object({ link: v.string(), icon: Icon })
|
||||
})
|
||||
export type QuickLinkCmd = InferOutput<typeof QuickLinkCmd>
|
||||
export type QuickLinkCmd = v.InferOutput<typeof QuickLinkCmd>
|
||||
|
||||
export const ExtData = object({
|
||||
dataId: number(),
|
||||
extId: number(),
|
||||
dataType: string(),
|
||||
data: optional(string()),
|
||||
searchText: optional(string()),
|
||||
createdAt: date(),
|
||||
updatedAt: date()
|
||||
export const ExtData = v.object({
|
||||
dataId: v.number(),
|
||||
extId: v.number(),
|
||||
dataType: v.string(),
|
||||
data: v.optional(v.string()),
|
||||
searchText: v.optional(v.string()),
|
||||
createdAt: v.date(),
|
||||
updatedAt: v.date()
|
||||
})
|
||||
export type ExtData = InferOutput<typeof ExtData>
|
||||
export type ExtData = v.InferOutput<typeof ExtData>
|
||||
|
||||
export const SysCommand = object({
|
||||
name: string(),
|
||||
value: string(),
|
||||
icon: nullable(Icon),
|
||||
keywords: nullable(array(string())),
|
||||
function: function_(),
|
||||
confirmRequired: boolean()
|
||||
export const SysCommand = v.object({
|
||||
name: v.string(),
|
||||
value: v.string(),
|
||||
icon: v.optional(v.nullable(Icon)),
|
||||
keywords: v.optional(v.nullable(v.array(v.string()))),
|
||||
function: v.function_(),
|
||||
confirmRequired: v.boolean()
|
||||
})
|
||||
export type SysCommand = InferOutput<typeof SysCommand>
|
||||
export type SysCommand = v.InferOutput<typeof SysCommand>
|
||||
|
@ -4,22 +4,21 @@ import { NodeName, NodeNameEnum } from "./constants"
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Icon */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
export enum IconEnum {
|
||||
Iconify = "iconify",
|
||||
RemoteUrl = "remote-url",
|
||||
Svg = "svg",
|
||||
Base64PNG = "base64-png",
|
||||
Text = "text"
|
||||
// export enum IconEnum {
|
||||
// Iconify = "iconify",
|
||||
// RemoteUrl = "remote-url",
|
||||
// Svg = "svg",
|
||||
// Base64PNG = "base64-png",
|
||||
// Text = "text"
|
||||
// }
|
||||
export const IconEnum = {
|
||||
Iconify: "iconify",
|
||||
RemoteUrl: "remote-url",
|
||||
Svg: "svg",
|
||||
Base64PNG: "base64-png",
|
||||
Text: "text"
|
||||
}
|
||||
// export const IconType = v.enum(IconEnum)
|
||||
export const IconType = v.union([
|
||||
v.literal(IconEnum.Iconify),
|
||||
v.literal(IconEnum.RemoteUrl),
|
||||
v.literal(IconEnum.Svg),
|
||||
v.literal(IconEnum.Base64PNG),
|
||||
v.literal(IconEnum.Text)
|
||||
])
|
||||
|
||||
export const IconType = v.picklist(Object.values(IconEnum))
|
||||
export type IconType = v.InferOutput<typeof IconType>
|
||||
|
||||
export type Icon = {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { FsPermissionSchema } from "tauri-api-adapter/permissions"
|
||||
import * as v from "valibot"
|
||||
import {
|
||||
AllKunkunPermission,
|
||||
@ -8,29 +7,29 @@ import {
|
||||
OpenPermissionScopedSchema,
|
||||
ShellPermissionScopedSchema
|
||||
} from "../permissions"
|
||||
import { CmdType } from "./extension"
|
||||
import { CmdType, CmdTypeEnum } from "./extension"
|
||||
import { BaseIcon as Icon } from "./icon"
|
||||
|
||||
export enum OSPlatformEnum {
|
||||
linux = "linux",
|
||||
macos = "macos",
|
||||
windows = "windows"
|
||||
export const OSPlatformEnum = {
|
||||
linux: "linux",
|
||||
macos: "macos",
|
||||
windows: "windows"
|
||||
}
|
||||
|
||||
export const OSPlatform = v.enum_(OSPlatformEnum)
|
||||
export const OSPlatform = v.picklist(Object.values(OSPlatformEnum))
|
||||
export type OSPlatform = v.InferOutput<typeof OSPlatform>
|
||||
const allPlatforms = Object.values(OSPlatformEnum)
|
||||
export const TriggerCmd = v.object({
|
||||
type: v.union([v.literal("text"), v.literal("regex")]),
|
||||
value: v.string()
|
||||
})
|
||||
export type TriggerCmd = v.InferOutput<typeof TriggerCmd>
|
||||
export enum TitleBarStyleEnum {
|
||||
"visible" = "visible",
|
||||
"transparent" = "transparent",
|
||||
"overlay" = "overlay"
|
||||
export const TitleBarStyleEnum = {
|
||||
visible: "visible",
|
||||
transparent: "transparent",
|
||||
overlay: "overlay"
|
||||
}
|
||||
export const TitleBarStyle = v.enum_(TitleBarStyleEnum)
|
||||
export type TitleBarStyle = v.InferOutput<typeof TitleBarStyle>
|
||||
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
|
||||
// export const TitleBarStyleAllLower = z.enum(["visible", "transparent", "overlay"]);
|
||||
@ -71,37 +70,33 @@ export const WindowConfig = v.object({
|
||||
export type WindowConfig = v.InferOutput<typeof WindowConfig>
|
||||
export const BaseCmd = v.object({
|
||||
main: v.string("HTML file to load, e.g. dist/index.html"),
|
||||
description: v.optional(v.nullable(v.string("Description of the Command"), ""), ""),
|
||||
description: v.optional(v.nullable(v.string("Description of the Command"), "")),
|
||||
name: v.string("Name of the command"),
|
||||
cmds: v.array(TriggerCmd, "Commands to trigger the UI"),
|
||||
icon: v.optional(Icon),
|
||||
platforms: v.optional(
|
||||
v.nullable(
|
||||
v.array(OSPlatform, "Platforms available on. Leave empty for all platforms."),
|
||||
allPlatforms
|
||||
),
|
||||
allPlatforms
|
||||
v.array(OSPlatform, "Platforms available on. Leave empty for all platforms.")
|
||||
)
|
||||
})
|
||||
export const CustomUiCmd = v.object({
|
||||
...BaseCmd.entries,
|
||||
type: v.optional(CmdType, CmdType.enum.UiIframe),
|
||||
dist: v.string("Dist folder to load, e.g. dist, build, out"),
|
||||
devMain: v.string(
|
||||
"URL to load in development to support live reload, e.g. http://localhost:5173/"
|
||||
),
|
||||
window: v.optional(v.nullable(WindowConfig))
|
||||
window: v.optional(v.nullable(WindowConfig)),
|
||||
type: v.optional(CmdType, CmdTypeEnum.UiIframe)
|
||||
})
|
||||
export type CustomUiCmd = v.InferOutput<typeof CustomUiCmd>
|
||||
|
||||
export const TemplateUiCmd = v.object({
|
||||
...BaseCmd.entries,
|
||||
type: v.optional(CmdType, CmdType.enum.UiWorker),
|
||||
type: v.optional(CmdType, CmdTypeEnum.UiWorker),
|
||||
window: v.optional(v.nullable(WindowConfig))
|
||||
})
|
||||
export const HeadlessCmd = v.object({
|
||||
...BaseCmd.entries,
|
||||
type: v.optional(CmdType, CmdType.enum.HeadlessWorker)
|
||||
type: v.optional(CmdType, CmdTypeEnum.HeadlessWorker)
|
||||
})
|
||||
export type HeadlessCmd = v.InferOutput<typeof HeadlessCmd>
|
||||
export type TemplateUiCmd = v.InferOutput<typeof TemplateUiCmd>
|
||||
|
@ -2,14 +2,14 @@ import * as v from "valibot"
|
||||
import { BaseIcon } from "./icon"
|
||||
import { ExtPackageJson, KunkunExtManifest } from "./manifest"
|
||||
|
||||
export enum ExtPublishSourceTypeEnum {
|
||||
jsr = "jsr",
|
||||
npm = "npm"
|
||||
export const ExtPublishSourceTypeEnum = {
|
||||
jsr: "jsr",
|
||||
npm: "npm"
|
||||
}
|
||||
|
||||
export const ExtPublishMetadata = v.object({
|
||||
source: v.optional(v.string("Source of the extension (e.g. url to package)")),
|
||||
sourceType: v.optional(v.enum(ExtPublishSourceTypeEnum)),
|
||||
sourceType: v.optional(v.picklist(Object.values(ExtPublishSourceTypeEnum))),
|
||||
rekorLogIndex: v.optional(v.string("Rekor log index of the extension")),
|
||||
git: v.optional(
|
||||
v.object({
|
||||
@ -44,13 +44,13 @@ export const ExtensionStoreListItem = v.object({
|
||||
|
||||
export type ExtensionStoreListItem = v.InferOutput<typeof ExtensionStoreListItem>
|
||||
|
||||
export enum PublishStateEnum {
|
||||
public = "public",
|
||||
pending = "pending",
|
||||
under_review = "under_review",
|
||||
private = "private"
|
||||
export const PublishStateEnum = {
|
||||
public: "public",
|
||||
pending: "pending",
|
||||
under_review: "under_review",
|
||||
private: "private"
|
||||
}
|
||||
export const ExtensionPublishState = v.enum(PublishStateEnum)
|
||||
export const ExtensionPublishState = v.picklist(Object.values(PublishStateEnum))
|
||||
|
||||
export const ExtPublish = v.object({
|
||||
id: v.number(),
|
||||
@ -76,7 +76,7 @@ export type ExtPublish = v.InferOutput<typeof ExtPublish>
|
||||
|
||||
export const DBExtension = v.object({
|
||||
api_version: v.string(),
|
||||
author_id: v.nullable(v.string()),
|
||||
author_id: v.string(),
|
||||
created_at: v.string(),
|
||||
downloads: v.number(),
|
||||
icon: BaseIcon,
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { IconEnum, OSPlatformEnum } from "@kksh/api/models"
|
||||
import { IconEnum, OSPlatform, OSPlatformEnum } from "@kksh/api/models"
|
||||
import { IconMultiplexer } from "@kksh/ui"
|
||||
|
||||
const { platforms }: { platforms: OSPlatformEnum[] } = $props()
|
||||
const { platforms }: { platforms: OSPlatform[] } = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex gap-2">
|
||||
|
@ -1,20 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { IconEnum, type KunkunExtManifest } from "@kksh/api/models"
|
||||
import { IconEnum, PermissionUnion, type KunkunExtManifest } from "@kksh/api/models"
|
||||
import { permissionDescriptions } from "@kksh/api/permissions"
|
||||
import { HoverCard, ScrollArea } from "@kksh/svelte5"
|
||||
import { IconMultiplexer, Shiki } from "@kksh/ui"
|
||||
|
||||
const {
|
||||
manifest,
|
||||
permissions,
|
||||
class: className
|
||||
}: {
|
||||
manifest: KunkunExtManifest
|
||||
permissions?: PermissionUnion[]
|
||||
class?: string
|
||||
} = $props()
|
||||
</script>
|
||||
|
||||
<ul class={className}>
|
||||
{#each manifest?.permissions || [] as perm}
|
||||
{#each permissions || [] as perm}
|
||||
<li class="flex h-8 items-center gap-2">
|
||||
<span class="font-mono text-sm">{typeof perm === "string" ? perm : perm.permission}</span>
|
||||
<HoverCard.Root>
|
||||
|
@ -42,6 +42,7 @@
|
||||
imageDialogOpen = $bindable(false)
|
||||
}: {
|
||||
extPublish: ExtPublish
|
||||
// extPublish: GetExtensionsLatestPublishByIdentifierResponse
|
||||
ext: {
|
||||
author_id: string
|
||||
downloads: number
|
||||
@ -256,7 +257,7 @@
|
||||
|
||||
<Separator class="my-3" />
|
||||
<h2 class="text-lg font-bold">Security and Privacy</h2>
|
||||
<PermissionInspector {manifest} />
|
||||
<PermissionInspector permissions={manifest.permissions} />
|
||||
<Separator class="my-3" />
|
||||
<h2 class="text-lg font-bold">Description</h2>
|
||||
|
||||
@ -278,7 +279,7 @@
|
||||
<span class="text-dm">{cmd.name}</span>
|
||||
<h2 class="text-xs">{cmd.description}</h2>
|
||||
</div>
|
||||
<PlatformsIcons platforms={cmd.platforms} />
|
||||
<PlatformsIcons platforms={cmd.platforms ?? []} />
|
||||
</div>
|
||||
<Separator class="my-3" />
|
||||
</li>
|
||||
|
86
pnpm-lock.yaml
generated
86
pnpm-lock.yaml
generated
@ -11,12 +11,15 @@ importers:
|
||||
'@changesets/cli':
|
||||
specifier: ^2.28.1
|
||||
version: 2.28.1
|
||||
'@hey-api/client-fetch':
|
||||
specifier: ^0.8.3
|
||||
version: 0.8.3
|
||||
'@iconify/svelte':
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0(svelte@5.20.5)
|
||||
'@kksh/sdk':
|
||||
specifier: ^0.0.1
|
||||
version: 0.0.1(typescript@5.7.3)
|
||||
specifier: ^0.0.3
|
||||
version: 0.0.3(@hey-api/client-fetch@0.8.3)(typescript@5.7.3)
|
||||
'@supabase/supabase-js':
|
||||
specifier: ^2.49.1
|
||||
version: 2.49.1
|
||||
@ -212,9 +215,6 @@ importers:
|
||||
'@kksh/extension':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/extension
|
||||
'@kksh/sdk':
|
||||
specifier: ^0.0.1
|
||||
version: 0.0.1(typescript@5.6.3)
|
||||
'@kksh/svelte5':
|
||||
specifier: ^0.1.15
|
||||
version: 0.1.15(lucide-svelte@0.474.0(svelte@5.20.5))(svelte-sonner@0.3.28(svelte@5.20.5))(svelte@5.20.5)(sveltekit-superforms@2.23.1(@sveltejs/kit@2.17.3(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.20.5)(vite@6.2.0(@types/node@22.13.1)(jiti@2.4.0)(terser@5.36.0)(yaml@2.6.1)))(svelte@5.20.5)(vite@6.2.0(@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.20.5)(typescript@5.6.3))(typescript@5.6.3)
|
||||
@ -341,7 +341,7 @@ importers:
|
||||
version: 8.25.0(eslint@9.21.0(jiti@2.4.0))(typescript@5.6.3)
|
||||
autoprefixer:
|
||||
specifier: ^10.4.20
|
||||
version: 10.4.20(postcss@8.5.3)
|
||||
version: 10.4.20(postcss@8.4.49)
|
||||
bits-ui:
|
||||
specifier: 1.0.0-next.86
|
||||
version: 1.0.0-next.86(svelte@5.20.5)
|
||||
@ -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:
|
||||
@ -775,25 +778,6 @@ importers:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0(valibot@1.0.0(typescript@5.7.3))
|
||||
|
||||
packages/supabase:
|
||||
dependencies:
|
||||
'@kksh/api':
|
||||
specifier: workspace:*
|
||||
version: link:../api
|
||||
'@supabase/ssr':
|
||||
specifier: ^0.5.2
|
||||
version: 0.5.2(@supabase/supabase-js@2.48.0)
|
||||
'@supabase/supabase-js':
|
||||
specifier: ^2.48.0
|
||||
version: 2.48.0
|
||||
typescript:
|
||||
specifier: ^5.0.0
|
||||
version: 5.5.4
|
||||
devDependencies:
|
||||
'@types/bun':
|
||||
specifier: latest
|
||||
version: 1.2.6
|
||||
|
||||
packages/svelte-animation:
|
||||
dependencies:
|
||||
typescript:
|
||||
@ -1432,7 +1416,7 @@ importers:
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0
|
||||
valibot:
|
||||
specifier: ^1.0.0
|
||||
specifier: ^1.0.0-beta.10
|
||||
version: 1.0.0(typescript@5.7.2)
|
||||
devDependencies:
|
||||
'@rollup/plugin-typescript':
|
||||
@ -2650,6 +2634,9 @@ packages:
|
||||
'@hey-api/client-fetch@0.6.0':
|
||||
resolution: {integrity: sha512-FlhFsVeH8RxJe/nq8xUzxNbiOpe+GadxlD2pfvDyOyLdCTU4o/LRv46ZVWstaW7DgF4nxhI328chy3+AulwVXw==}
|
||||
|
||||
'@hey-api/client-fetch@0.8.3':
|
||||
resolution: {integrity: sha512-EBVa8wwUMyBSeQ32PtCz6u5bFQZIMAufvwCT1ZtpjqT3caJQEza4NokbGU50q1ZVrMsM5Ot6GuDNJOF3TMo26Q==}
|
||||
|
||||
'@hookform/resolvers@3.9.1':
|
||||
resolution: {integrity: sha512-ud2HqmGBM0P0IABqoskKWI6PEf6ZDDBZkFqe2Vnl+mTHCEHzr3ISjjZyCwTjC/qpL25JC9aIDkloQejvMeq0ug==}
|
||||
peerDependencies:
|
||||
@ -3009,9 +2996,10 @@ packages:
|
||||
react: ^18.2.0
|
||||
react-dom: ^18.2.0
|
||||
|
||||
'@kksh/sdk@0.0.1':
|
||||
resolution: {integrity: sha512-G+ZnrPOBmu4IwpcWsgxgK1C6bZrldzEEK1jxM0YgmI8ITLUkDAMnXM1GoQKoRUvcMQPUIQcun2ApLIQPK7uWpA==}
|
||||
'@kksh/sdk@0.0.3':
|
||||
resolution: {integrity: sha512-he5/VSiIfEuXQlGWGxoIurrq/wbddbvZiHbKIGAFTS1DljCHjnAjEajueCkz9M3sbn+WGylS8VSVAFSCWdCfPg==}
|
||||
peerDependencies:
|
||||
'@hey-api/client-fetch': ^0.8.3
|
||||
typescript: ^5
|
||||
|
||||
'@kksh/svelte5@0.1.15':
|
||||
@ -4977,11 +4965,6 @@ packages:
|
||||
'@supabase/realtime-js@2.11.2':
|
||||
resolution: {integrity: sha512-u/XeuL2Y0QEhXSoIPZZwR6wMXgB+RQbJzG9VErA3VghVt7uRfSVsjeqd7m5GhX3JR6dM/WRmLbVR8URpDWG4+w==}
|
||||
|
||||
'@supabase/ssr@0.5.2':
|
||||
resolution: {integrity: sha512-n3plRhr2Bs8Xun1o4S3k1CDv17iH5QY9YcoEvXX3bxV1/5XSasA0mNXYycFmADIdtdE6BG9MRjP5CGIs8qxC8A==}
|
||||
peerDependencies:
|
||||
'@supabase/supabase-js': ^2.43.4
|
||||
|
||||
'@supabase/storage-js@2.7.1':
|
||||
resolution: {integrity: sha512-asYHcyDR1fKqrMpytAS1zjyEfvxuOIp1CIXX7ji4lHHcJKqyk+sLl/Vxgm4sN6u8zvuUtae9e4kDxQP2qrwWBA==}
|
||||
|
||||
@ -6736,10 +6719,6 @@ packages:
|
||||
resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
cookie@0.7.2:
|
||||
resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
cookies@0.9.1:
|
||||
resolution: {integrity: sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
@ -13961,6 +13940,8 @@ snapshots:
|
||||
|
||||
'@hey-api/client-fetch@0.6.0': {}
|
||||
|
||||
'@hey-api/client-fetch@0.8.3': {}
|
||||
|
||||
'@hookform/resolvers@3.9.1(react-hook-form@7.53.2(react@18.3.1))':
|
||||
dependencies:
|
||||
react-hook-form: 7.53.2(react@18.3.1)
|
||||
@ -14628,12 +14609,9 @@ snapshots:
|
||||
- '@types/react-dom'
|
||||
- tailwindcss
|
||||
|
||||
'@kksh/sdk@0.0.1(typescript@5.6.3)':
|
||||
dependencies:
|
||||
typescript: 5.6.3
|
||||
|
||||
'@kksh/sdk@0.0.1(typescript@5.7.3)':
|
||||
'@kksh/sdk@0.0.3(@hey-api/client-fetch@0.8.3)(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@hey-api/client-fetch': 0.8.3
|
||||
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)':
|
||||
@ -17035,12 +17013,6 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@supabase/ssr@0.5.2(@supabase/supabase-js@2.48.0)':
|
||||
dependencies:
|
||||
'@supabase/supabase-js': 2.48.0
|
||||
'@types/cookie': 0.6.0
|
||||
cookie: 0.7.2
|
||||
|
||||
'@supabase/storage-js@2.7.1':
|
||||
dependencies:
|
||||
'@supabase/node-fetch': 2.6.15
|
||||
@ -18871,16 +18843,6 @@ snapshots:
|
||||
postcss: 8.5.1
|
||||
postcss-value-parser: 4.2.0
|
||||
|
||||
autoprefixer@10.4.20(postcss@8.5.3):
|
||||
dependencies:
|
||||
browserslist: 4.24.2
|
||||
caniuse-lite: 1.0.30001676
|
||||
fraction.js: 4.3.7
|
||||
normalize-range: 0.1.2
|
||||
picocolors: 1.1.1
|
||||
postcss: 8.5.3
|
||||
postcss-value-parser: 4.2.0
|
||||
|
||||
available-typed-arrays@1.0.7:
|
||||
dependencies:
|
||||
possible-typed-array-names: 1.0.0
|
||||
@ -19319,8 +19281,6 @@ snapshots:
|
||||
|
||||
cookie@0.6.0: {}
|
||||
|
||||
cookie@0.7.2: {}
|
||||
|
||||
cookies@0.9.1:
|
||||
dependencies:
|
||||
depd: 2.0.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user