From 97cd20906f1316c070bbe37b86d9757376ef844e Mon Sep 17 00:00:00 2001 From: Huakun Date: Wed, 26 Feb 2025 04:47:43 -0500 Subject: [PATCH] Feature: add extension api (hide and paste) (#210) * feat: add paste API to extension API * feat(desktop): enhance clipboard and hotkey utilities - Add `hideAndPaste` utility function to simplify window hiding and clipboard pasting - Adjust key press and sleep timings for more reliable input simulation - Implement window focus listener in clipboard extension - Bind input element reference for automatic focus management * feat(permissions): enhance clipboard permission handling - Update clipboard permission schema to include paste permission - Modify clipboard API to check for paste permission before executing - Refactor permission map and schema for more flexible permission management * feat(desktop): refactor extension command search and rendering - Add `svelte-inspect-value` for debugging - Implement new `ExtCmds` component to replace `ExtCmdsGroup` - Enhance extension command search with separate Fuse.js instances for installed and dev extensions - Simplify extension command filtering and rendering logic - Add derived stores for extension commands with improved type safety * feat(desktop): improve extension command search filtering * bump @kksh/api version * feat(permissions): add clipboard paste permission description --- apps/cli/CHANGELOG.md | 7 + apps/cli/package.json | 2 +- apps/create-kunkun/CHANGELOG.md | 7 + apps/create-kunkun/package.json | 2 +- apps/desktop/package.json | 1 + apps/desktop/src/lib/cmds/ext.ts | 8 ++ apps/desktop/src/lib/stores/extensions.ts | 124 ++++++++---------- apps/desktop/src/lib/utils/hotkey.ts | 18 ++- apps/desktop/src/routes/app/+page.svelte | 84 ++++-------- .../app/extension/clipboard/+page.svelte | 26 ++-- .../app/extension/ui-iframe/+page.svelte | 28 +++- .../app/extension/ui-worker/+page.svelte | 10 +- deno.lock | 5 +- packages/api/CHANGELOG.md | 6 + packages/api/package.json | 2 +- packages/api/src/api/client.ts | 20 ++- packages/api/src/api/server/clipboard.ts | 18 +++ packages/api/src/api/server/index.ts | 10 +- packages/api/src/dev/index.ts | 2 +- packages/api/src/headless/index.ts | 2 +- packages/api/src/permissions/description.ts | 1 + .../api/src/permissions/permission-map.ts | 16 ++- packages/api/src/permissions/schema.ts | 8 +- packages/api/src/ui/custom/index.ts | 2 +- packages/api/src/ui/template/index.ts | 2 +- .../demo-worker-template-ext/CHANGELOG.md | 7 + .../demo-worker-template-ext/package.json | 2 +- .../demo-worker-template-ext/src/index.ts | 1 + .../extensions/ext-sveltekit-exp/CHANGELOG.md | 7 + .../extensions/ext-sveltekit-exp/package.json | 3 +- .../ext-sveltekit-exp/src/routes/+page.svelte | 72 ++-------- .../template-ext-headless/CHANGELOG.md | 7 + .../template-ext-headless/package.json | 2 +- .../templates/template-ext-next/CHANGELOG.md | 7 + .../templates/template-ext-next/package.json | 2 +- .../templates/template-ext-nuxt/CHANGELOG.md | 7 + .../templates/template-ext-nuxt/package.json | 2 +- .../templates/template-ext-react/CHANGELOG.md | 7 + .../templates/template-ext-react/package.json | 2 +- .../template-ext-svelte/CHANGELOG.md | 7 + .../template-ext-svelte/package.json | 2 +- .../template-ext-sveltekit/CHANGELOG.md | 7 + .../template-ext-sveltekit/package.json | 2 +- .../templates/template-ext-vue/CHANGELOG.md | 7 + .../templates/template-ext-vue/package.json | 2 +- .../template-ext-worker/CHANGELOG.md | 7 + .../template-ext-worker/package.json | 2 +- .../ui/src/components/main/ExtCmds.svelte | 71 ++++++++++ packages/ui/src/components/main/index.ts | 1 + pnpm-lock.yaml | 25 +++- 50 files changed, 427 insertions(+), 245 deletions(-) create mode 100644 packages/api/src/api/server/clipboard.ts create mode 100644 packages/ui/src/components/main/ExtCmds.svelte diff --git a/apps/cli/CHANGELOG.md b/apps/cli/CHANGELOG.md index f505834..7b810f9 100644 --- a/apps/cli/CHANGELOG.md +++ b/apps/cli/CHANGELOG.md @@ -1,5 +1,12 @@ # kksh +## 0.1.3 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.1.2 ### Patch Changes diff --git a/apps/cli/package.json b/apps/cli/package.json index ec53676..5ea43d4 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -1,7 +1,7 @@ { "name": "kksh", "module": "dist/cli.js", - "version": "0.1.2", + "version": "0.1.3", "type": "module", "bin": { "kksh": "./dist/cli.js", diff --git a/apps/create-kunkun/CHANGELOG.md b/apps/create-kunkun/CHANGELOG.md index 151ca30..4c6d1c1 100644 --- a/apps/create-kunkun/CHANGELOG.md +++ b/apps/create-kunkun/CHANGELOG.md @@ -1,5 +1,12 @@ # create-kunkun +## 0.1.49 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.1.48 ### Patch Changes diff --git a/apps/create-kunkun/package.json b/apps/create-kunkun/package.json index d58623f..64777b5 100644 --- a/apps/create-kunkun/package.json +++ b/apps/create-kunkun/package.json @@ -1,7 +1,7 @@ { "name": "create-kunkun", "type": "module", - "version": "0.1.48", + "version": "0.1.49", "bin": { "create-kunkun": "dist/index.mjs" }, diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 09813ea..306f4d0 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -37,6 +37,7 @@ "lz-string": "^1.5.0", "pretty-bytes": "^6.1.1", "semver": "^7.6.3", + "svelte-inspect-value": "^0.2.2", "svelte-sonner": "^0.3.28", "sveltekit-superforms": "^2.22.1", "tauri-plugin-clipboard-api": "^2.1.11", diff --git a/apps/desktop/src/lib/cmds/ext.ts b/apps/desktop/src/lib/cmds/ext.ts index 147e648..dd35023 100644 --- a/apps/desktop/src/lib/cmds/ext.ts +++ b/apps/desktop/src/lib/cmds/ext.ts @@ -2,6 +2,8 @@ import { i18n } from "@/i18n" import { appState } from "@/stores" import { winExtMap } from "@/stores/winExtMap" import { helperAPI } from "@/utils/helper" +import { paste } from "@/utils/hotkey" +import { sleep } from "@/utils/time" import { trimSlash } from "@/utils/url" import { constructExtensionSupportDir } from "@kksh/api" import { db, spawnExtensionFileServer } from "@kksh/api/commands" @@ -12,6 +14,7 @@ import { launchNewExtWindow, loadExtensionManifestFromDisk } from "@kksh/extensi import type { IKunkunFullServerAPI } from "@kunkunapi/src/api/server" import { convertFileSrc } from "@tauri-apps/api/core" import * as path from "@tauri-apps/api/path" +import { getCurrentWindow } from "@tauri-apps/api/window" import * as fs from "@tauri-apps/plugin-fs" import { platform } from "@tauri-apps/plugin-os" import { goto } from "$app/navigation" @@ -101,6 +104,11 @@ export async function onHeadlessCmdSelect( getSpawnedProcesses: async () => { console.log("getSpawnedProcesses") return [] + }, + paste: async () => { + await getCurrentWindow().hide() + await sleep(200) + return paste() } } ) diff --git a/apps/desktop/src/lib/stores/extensions.ts b/apps/desktop/src/lib/stores/extensions.ts index 8b1f202..96b1c5f 100644 --- a/apps/desktop/src/lib/stores/extensions.ts +++ b/apps/desktop/src/lib/stores/extensions.ts @@ -1,21 +1,12 @@ -import { getExtensionsFolder } from "@/constants" import { db } from "@kksh/api/commands" -import type { ExtPackageJson, ExtPackageJsonExtra } from "@kksh/api/models" +import type { CustomUiCmd, ExtPackageJsonExtra, HeadlessCmd, TemplateUiCmd } from "@kksh/api/models" import * as extAPI from "@kksh/extension" -import { commandScore } from "@kksh/ui/utils" import * as path from "@tauri-apps/api/path" -import * as fs from "@tauri-apps/plugin-fs" import Fuse from "fuse.js" -import { derived, get, writable, type Readable, type Writable } from "svelte/store" +import { derived, get, writable, type Writable } from "svelte/store" import { appConfig } from "./appConfig" import { appState } from "./appState" -export const fuse = new Fuse([], { - includeScore: true, - threshold: 0.2, - keys: ["name"] -}) - function createExtensionsStore(): Writable & { init: () => Promise getExtensionsFromStore: () => ExtPackageJsonExtra[] @@ -47,7 +38,6 @@ function createExtensionsStore(): Writable & { function init() { return extAPI.loadAllExtensionsFromDb().then((exts) => { store.set(exts) - fuse.setCollection(exts) }) } @@ -235,62 +225,62 @@ function createExtensionsStore(): Writable & { } export const extensions = createExtensionsStore() +export const installedStoreExts = derived(extensions, ($extensions) => { + const extContainerPath = get(appConfig).extensionsInstallDir + if (!extContainerPath) return [] + return $extensions.filter((ext) => !extAPI.isExtPathInDev(extContainerPath, ext.extPath)) +}) +export const devStoreExts = derived(extensions, ($extensions) => { + const extContainerPath = get(appConfig).extensionsInstallDir + if (!extContainerPath) return [] + return $extensions.filter((ext) => extAPI.isExtPathInDev(extContainerPath, ext.extPath)) +}) -export const installedStoreExts: Readable = derived( - extensions, - ($extensionsStore) => { - const extContainerPath = get(appConfig).extensionsInstallDir - if (!extContainerPath) return [] - return $extensionsStore.filter((ext) => !extAPI.isExtPathInDev(extContainerPath, ext.extPath)) - } -) -export const devStoreExts: Readable = derived( - extensions, - ($extensionsStore) => { - const extContainerPath = get(appConfig).extensionsInstallDir - if (!extContainerPath) return [] - return $extensionsStore.filter((ext) => extAPI.isExtPathInDev(extContainerPath, ext.extPath)) - } -) +export type StoreExtCmd = (CustomUiCmd | TemplateUiCmd | HeadlessCmd) & { + ext: ExtPackageJsonExtra +} -export const installedStoreExtsFiltered = derived( - [installedStoreExts, appState], - ([$installedStoreExts, $appState]) => { - return $appState.searchTerm - ? fuse.search($appState.searchTerm).map((result) => result.item) - : $installedStoreExts - } -) +export const cmdsFuse = new Fuse([], { + includeScore: true, + threshold: 0.2, + keys: ["name"] +}) +export const devCmdsFuse = new Fuse([], { + includeScore: true, + threshold: 0.2, + keys: ["name"] +}) -export const devStoreExtsFiltered = derived( - [devStoreExts, appState], - ([$devStoreExts, $appState]) => { - return $appState.searchTerm - ? fuse.search($appState.searchTerm).map((result) => result.item) - : $devStoreExts - } -) +export const storeExtCmds = derived(installedStoreExts, ($exts) => { + const cmds = $exts.flatMap((ext) => { + return [ + ...(ext.kunkun.customUiCmds ?? []), + ...(ext.kunkun.templateUiCmds ?? []), + ...(ext.kunkun.headlessCmds ?? []) + ].map((cmd) => ({ ...cmd, ext })) + }) + cmdsFuse.setCollection(cmds) + return cmds +}) +export const devStoreExtCmds = derived(devStoreExts, ($exts) => { + const cmds = $exts.flatMap((ext) => { + return [ + ...(ext.kunkun.customUiCmds ?? []), + ...(ext.kunkun.templateUiCmds ?? []), + ...(ext.kunkun.headlessCmds ?? []) + ].map((cmd) => ({ ...cmd, ext })) + }) + devCmdsFuse.setCollection(cmds) + return cmds +}) -// export const installedStoreExtsFiltered = derived( -// [installedStoreExts, appState], -// ([$installedStoreExts, $appState]) => { -// return $installedStoreExts.filter( -// (ext) => commandScore(ext.kunkun.name, $appState.searchTerm) > 0.5 -// ) -// } -// ) - -// export const devStoreExtsFiltered = derived( -// [devStoreExts, appState], -// ([$devStoreExts, $appState]) => { -// return $devStoreExts.filter((ext) => { -// console.log( -// "commandScore", -// ext.kunkun.name, -// $appState.searchTerm, -// commandScore(ext.kunkun.name, $appState.searchTerm) -// ) -// return commandScore(ext.kunkun.name, $appState.searchTerm) > 0.1 -// }) -// } -// ) +export const storeSearchExtCmds = derived([storeExtCmds, appState], ([$extCmds, $appState]) => { + return $appState.searchTerm + ? cmdsFuse.search($appState.searchTerm).map((result) => result.item) + : $extCmds +}) +export const devSearchExtCmds = derived([devStoreExtCmds, appState], ([$extCmds, $appState]) => { + return $appState.searchTerm + ? devCmdsFuse.search($appState.searchTerm).map((result) => result.item) + : $extCmds +}) diff --git a/apps/desktop/src/lib/utils/hotkey.ts b/apps/desktop/src/lib/utils/hotkey.ts index 468b415..6dad44d 100644 --- a/apps/desktop/src/lib/utils/hotkey.ts +++ b/apps/desktop/src/lib/utils/hotkey.ts @@ -1,4 +1,5 @@ -import { getAllWindows } from "@tauri-apps/api/window" +import { app } from "@tauri-apps/api" +import { getAllWindows, getCurrentWindow, type Window } from "@tauri-apps/api/window" import { isRegistered, register, unregister } from "@tauri-apps/plugin-global-shortcut" import { debug, info, warn } from "@tauri-apps/plugin-log" import * as os from "@tauri-apps/plugin-os" @@ -78,12 +79,12 @@ export async function applyKeyComb(keys: userInput.Key[]) { // await Promise.all(keys.map((key) => userInput.key("KeyPress", key))) for (const key of keys) { await userInput.key("KeyPress", key) - await sleep(20) + await sleep(100) } - await sleep(100) + await sleep(150) for (const key of keys) { await userInput.key("KeyRelease", key) - await sleep(20) + await sleep(100) } } @@ -101,3 +102,12 @@ export async function paste() { console.error("Unsupported platform: " + _platform) } } + +export async function hideAndPaste(win?: Window) { + return app + .hide() + .then(() => sleep(60)) + .then(() => (win ?? getCurrentWindow()).hide()) + .then(() => sleep(60)) + .then(() => paste()) +} diff --git a/apps/desktop/src/routes/app/+page.svelte b/apps/desktop/src/routes/app/+page.svelte index afc36b4..a4a4309 100644 --- a/apps/desktop/src/routes/app/+page.svelte +++ b/apps/desktop/src/routes/app/+page.svelte @@ -10,16 +10,12 @@ appConfig, appConfigLoaded, appsFiltered, - // appsFiltered, - appsLoader, appState, - devStoreExts, - devStoreExtsFiltered, - installedStoreExts, - installedStoreExtsFiltered, - quickLinks, - quickLinksFiltered - // quickLinksFiltered + devSearchExtCmds, + devStoreExtCmds, + quickLinksFiltered, + storeExtCmds, + storeSearchExtCmds } from "@/stores" import { cmdQueries } from "@/stores/cmdQuery" import { isKeyboardEventFromInputElement } from "@/utils/dom" @@ -29,13 +25,12 @@ import { BuiltinCmds, CustomCommandInput, - ExtCmdsGroup, + ExtCmds, GlobalCommandPaletteFooter, QuickLinks, SystemCmds } from "@kksh/ui/main" import { cn } from "@kksh/ui/utils" - import { Channel, invoke } from "@tauri-apps/api/core" import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow" import { getCurrentWindow, Window } from "@tauri-apps/api/window" import { platform } from "@tauri-apps/plugin-os" @@ -43,7 +38,7 @@ import { goto } from "$app/navigation" import { ArrowBigUpIcon, CircleXIcon, EllipsisVerticalIcon, RefreshCcwIcon } from "lucide-svelte" import { onMount } from "svelte" - import * as shell from "tauri-plugin-shellx-api" + import { Inspect } from "svelte-inspect-value" const win = getCurrentWindow() let inputEle: HTMLInputElement | null = $state(null) @@ -84,43 +79,6 @@ } }) }) - - async function spawn() { - const cmd = shell.Command.create("deno", ["run", "/Users/hk/Dev/kunkun/deno.ts"]) - cmd.stdout.on("data", (data) => { - console.log("stdout", data) - }) - const child = await cmd.spawn() - console.log("child", child) - setTimeout(() => { - child - .kill() - .then(() => { - console.log("child killed") - }) - .catch((err) => { - console.error("child kill error", err) - }) - }, 5000) - // invoke("plugin:shellx|spawn", { - // program: "deno", - // args: ["run", "/Users/hk/Dev/kunkun/deno.ts"], - // options: {}, - // onEvent: new Channel>() - // }).then((pid) => { - // console.log("spawned process (shell server) pid:", pid) - // setTimeout(() => { - // console.log("killing process (shell server) pid:", pid) - // killPid(pid) - // .then(() => { - // console.log("killed process (shell server) pid:", pid) - // }) - // .catch((err) => { - // console.error("kill process (shell server) pid:", pid, err) - // }) - // }, 3000) - // }) - } + {/snippet} - No results found. - {#if $appConfig.extensionsInstallDir && $devStoreExtsFiltered.length > 0} - 0} + {/if} - - {#if $appConfig.extensionsInstallDir && $installedStoreExtsFiltered.length > 0} - 0} + {/if} diff --git a/apps/desktop/src/routes/app/extension/clipboard/+page.svelte b/apps/desktop/src/routes/app/extension/clipboard/+page.svelte index bac90d4..a484187 100644 --- a/apps/desktop/src/routes/app/extension/clipboard/+page.svelte +++ b/apps/desktop/src/routes/app/extension/clipboard/+page.svelte @@ -1,15 +1,13 @@
- - +
diff --git a/packages/templates/template-ext-headless/CHANGELOG.md b/packages/templates/template-ext-headless/CHANGELOG.md index 5d39a3d..b275d93 100644 --- a/packages/templates/template-ext-headless/CHANGELOG.md +++ b/packages/templates/template-ext-headless/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-worker +## 0.0.10 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.9 ### Patch Changes diff --git a/packages/templates/template-ext-headless/package.json b/packages/templates/template-ext-headless/package.json index 6a5977c..0f494f1 100644 --- a/packages/templates/template-ext-headless/package.json +++ b/packages/templates/template-ext-headless/package.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-headless", - "version": "0.0.9", + "version": "0.0.10", "license": "MIT", "type": "module", "kunkun": { diff --git a/packages/templates/template-ext-next/CHANGELOG.md b/packages/templates/template-ext-next/CHANGELOG.md index eccb16d..e2d6284 100644 --- a/packages/templates/template-ext-next/CHANGELOG.md +++ b/packages/templates/template-ext-next/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-next +## 0.1.9 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.1.8 ### Patch Changes diff --git a/packages/templates/template-ext-next/package.json b/packages/templates/template-ext-next/package.json index 3369ce3..aa0b54d 100644 --- a/packages/templates/template-ext-next/package.json +++ b/packages/templates/template-ext-next/package.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-next", - "version": "0.1.8", + "version": "0.1.9", "license": "MIT", "kunkun": { "name": "TODO: Change Display Name", diff --git a/packages/templates/template-ext-nuxt/CHANGELOG.md b/packages/templates/template-ext-nuxt/CHANGELOG.md index 67677c8..e73f969 100644 --- a/packages/templates/template-ext-nuxt/CHANGELOG.md +++ b/packages/templates/template-ext-nuxt/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-nuxt +## 0.0.11 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.10 ### Patch Changes diff --git a/packages/templates/template-ext-nuxt/package.json b/packages/templates/template-ext-nuxt/package.json index 956211b..5b61dd8 100644 --- a/packages/templates/template-ext-nuxt/package.json +++ b/packages/templates/template-ext-nuxt/package.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-nuxt", - "version": "0.0.10", + "version": "0.0.11", "type": "module", "license": "MIT", "kunkun": { diff --git a/packages/templates/template-ext-react/CHANGELOG.md b/packages/templates/template-ext-react/CHANGELOG.md index dfb09c1..5905f32 100644 --- a/packages/templates/template-ext-react/CHANGELOG.md +++ b/packages/templates/template-ext-react/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-react +## 0.0.10 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.9 ### Patch Changes diff --git a/packages/templates/template-ext-react/package.json b/packages/templates/template-ext-react/package.json index 4d1a451..fe0be18 100644 --- a/packages/templates/template-ext-react/package.json +++ b/packages/templates/template-ext-react/package.json @@ -2,7 +2,7 @@ "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-react", "license": "MIT", - "version": "0.0.9", + "version": "0.0.10", "type": "module", "kunkun": { "name": "TODO: Change Display Name", diff --git a/packages/templates/template-ext-svelte/CHANGELOG.md b/packages/templates/template-ext-svelte/CHANGELOG.md index e876965..d369ae8 100644 --- a/packages/templates/template-ext-svelte/CHANGELOG.md +++ b/packages/templates/template-ext-svelte/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-svelte +## 0.0.10 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.9 ### Patch Changes diff --git a/packages/templates/template-ext-svelte/package.json b/packages/templates/template-ext-svelte/package.json index c64b9a7..768d462 100644 --- a/packages/templates/template-ext-svelte/package.json +++ b/packages/templates/template-ext-svelte/package.json @@ -2,7 +2,7 @@ "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-svelte", "license": "MIT", - "version": "0.0.9", + "version": "0.0.10", "type": "module", "kunkun": { "name": "TODO: Change Display Name", diff --git a/packages/templates/template-ext-sveltekit/CHANGELOG.md b/packages/templates/template-ext-sveltekit/CHANGELOG.md index 2f7490a..4dc0140 100644 --- a/packages/templates/template-ext-sveltekit/CHANGELOG.md +++ b/packages/templates/template-ext-sveltekit/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-sveltekit +## 0.0.11 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.10 ### Patch Changes diff --git a/packages/templates/template-ext-sveltekit/package.json b/packages/templates/template-ext-sveltekit/package.json index 7908360..1bd9ab2 100644 --- a/packages/templates/template-ext-sveltekit/package.json +++ b/packages/templates/template-ext-sveltekit/package.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-sveltekit", - "version": "0.0.10", + "version": "0.0.11", "license": "MIT", "kunkun": { "name": "TODO: Change Display Name", diff --git a/packages/templates/template-ext-vue/CHANGELOG.md b/packages/templates/template-ext-vue/CHANGELOG.md index d18ebff..06498ac 100644 --- a/packages/templates/template-ext-vue/CHANGELOG.md +++ b/packages/templates/template-ext-vue/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-vue +## 0.0.8 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.7 ### Patch Changes diff --git a/packages/templates/template-ext-vue/package.json b/packages/templates/template-ext-vue/package.json index 132e30e..7ae222a 100644 --- a/packages/templates/template-ext-vue/package.json +++ b/packages/templates/template-ext-vue/package.json @@ -1,7 +1,7 @@ { "name": "template-ext-vue", "license": "MIT", - "version": "0.0.7", + "version": "0.0.8", "type": "module", "scripts": { "dev": "vite", diff --git a/packages/templates/template-ext-worker/CHANGELOG.md b/packages/templates/template-ext-worker/CHANGELOG.md index 5d39a3d..b275d93 100644 --- a/packages/templates/template-ext-worker/CHANGELOG.md +++ b/packages/templates/template-ext-worker/CHANGELOG.md @@ -1,5 +1,12 @@ # template-ext-worker +## 0.0.10 + +### Patch Changes + +- Updated dependencies + - @kksh/api@0.1.5 + ## 0.0.9 ### Patch Changes diff --git a/packages/templates/template-ext-worker/package.json b/packages/templates/template-ext-worker/package.json index a26c20a..80a4d18 100644 --- a/packages/templates/template-ext-worker/package.json +++ b/packages/templates/template-ext-worker/package.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/@kksh/api/dist/schema.json", "name": "template-ext-worker", - "version": "0.0.9", + "version": "0.0.10", "license": "MIT", "type": "module", "kunkun": { diff --git a/packages/ui/src/components/main/ExtCmds.svelte b/packages/ui/src/components/main/ExtCmds.svelte new file mode 100644 index 0000000..cacf869 --- /dev/null +++ b/packages/ui/src/components/main/ExtCmds.svelte @@ -0,0 +1,71 @@ + + + + +{#snippet cmd(cmd: Cmd)} + { + onExtCmdSelect(cmd.ext, cmd, { isDev, hmr }) + }} + value={`${isDev ? "dev-ext" : "ext"}-${cmd.name}`} + > + + + {cmd.name} + + + {#if isDev} + Dev + {/if} + {#if hmr} + HMR + {/if} + + +{/snippet} + + + + {#each extCmds as _extCmd} + {@render cmd(_extCmd)} + {/each} + diff --git a/packages/ui/src/components/main/index.ts b/packages/ui/src/components/main/index.ts index a66c3ee..b67b084 100644 --- a/packages/ui/src/components/main/index.ts +++ b/packages/ui/src/components/main/index.ts @@ -4,4 +4,5 @@ export { default as GlobalCommandPaletteFooter } from "./GlobalCommandPaletteFoo export { default as ExtCmdsGroup } from "./ExtCmdsGroup.svelte" export { default as SystemCmds } from "./SystemCmds.svelte" export { default as QuickLinks } from "./QuickLinks.svelte" +export { default as ExtCmds } from "./ExtCmds.svelte" export * from "./types" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f00511..1e54018 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -266,6 +266,9 @@ importers: semver: specifier: ^7.6.3 version: 7.6.3 + svelte-inspect-value: + specifier: ^0.2.2 + version: 0.2.2(svelte@5.16.6) svelte-sonner: specifier: ^0.3.28 version: 0.3.28(svelte@5.16.6) @@ -7967,6 +7970,10 @@ packages: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true + highlight.js@11.11.1: + resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==} + engines: {node: '>=12.0.0'} + hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} @@ -10676,6 +10683,11 @@ packages: svelte: optional: true + svelte-inspect-value@0.2.2: + resolution: {integrity: sha512-Ly4QcIDoPo2O81CdIhx600bBaQdla65VXvXEMA9So947In8773Ey56k6A1WTsZiljAabxZFChBRqOt9nOYczuA==} + peerDependencies: + svelte: ^5.19.0 + svelte-markdown@0.4.1: resolution: {integrity: sha512-pOlLY6EruKJaWI9my/2bKX8PdTeP5CM0s4VMmwmC2prlOkjAf+AOmTM4wW/l19Y6WZ87YmP8+ZCJCCwBChWjYw==} peerDependencies: @@ -20361,6 +20373,8 @@ snapshots: he@1.2.0: {} + highlight.js@11.11.1: {} + hookable@5.5.3: {} hosted-git-info@7.0.2: @@ -22827,12 +22841,12 @@ snapshots: runed@0.20.0(svelte@5.16.6): dependencies: - esm-env: 1.2.1 + esm-env: 1.2.2 svelte: 5.16.6 runed@0.22.0(svelte@5.16.6): dependencies: - esm-env: 1.2.1 + esm-env: 1.2.2 svelte: 5.16.6 runed@0.23.2(svelte@5.16.6): @@ -23286,6 +23300,13 @@ snapshots: optionalDependencies: svelte: 5.16.6 + svelte-inspect-value@0.2.2(svelte@5.16.6): + dependencies: + esm-env: 1.2.2 + fast-deep-equal: 3.1.3 + highlight.js: 11.11.1 + svelte: 5.16.6 + svelte-markdown@0.4.1(svelte@5.16.6): dependencies: '@types/marked': 5.0.2