feat: hide main window when close requested (#59)

* feat: hide main window when close requested

* fix: jsr test

* fix: fix nuxt tailwind version, the latest verison has bug

* update pnpm lock
This commit is contained in:
Huakun Shen 2025-01-13 18:33:31 -05:00 committed by GitHub
parent 9cda312523
commit d73ae6542c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 103 additions and 66 deletions

View File

@ -17,16 +17,14 @@ const templateNames = ["template", "react", "vue", "nuxt", "svelte", "sveltekit"
fs.rmdirSync(testDir, { recursive: true })
fs.mkdirpSync(testDir)
await Promise.all(
templateNames.map(async (templateName) => {
const folderName = `${templateName}-ext`
await $`node ${indexjsPath} --outdir ${testDir} --name ${folderName} --template ${templateName}`
const templateDir = path.join(testDir, folderName)
await $`rm -rf node_modules`.cwd(templateDir) // this doesn't work within bun test
await $`pnpm install`.cwd(templateDir) // this doesn't work within bun test
await $`pnpm run build`.cwd(templateDir)
})
)
for (const templateName of templateNames) {
const folderName = `${templateName}-ext`
await $`node ${indexjsPath} --outdir ${testDir} --name ${folderName} --template ${templateName}`
const templateDir = path.join(testDir, folderName)
await $`rm -rf node_modules`.cwd(templateDir) // this doesn't work within bun test
await $`pnpm install`.cwd(templateDir) // this doesn't work within bun test
const out = await $`pnpm run build`.cwd(templateDir)
}
test("Build Artifact Existence", () => {
templateNames.forEach(async (templateName) => {

View File

@ -110,7 +110,9 @@ pub fn run() {
.plugin(tauri_plugin_keyring::init())
.plugin(tauri_plugin_network::init())
.plugin(tauri_plugin_system_info::init())
.invoke_handler(tauri::generate_handler![commands::keyring::get_stronghold_key]);
.invoke_handler(tauri::generate_handler![
commands::keyring::get_stronghold_key
]);
let app = builder
.register_uri_scheme_protocol("appicon", |_app, request| {
@ -307,7 +309,29 @@ pub fn run() {
app.run(|_app_handle, event| match event {
// tauri::RunEvent::Exit => todo!(),
// tauri::RunEvent::ExitRequested { code, api, .. } => todo!(),
// tauri::RunEvent::WindowEvent { label, event, .. } => todo!(),
tauri::RunEvent::WindowEvent { label, event, .. } => {
if label == "main" {
match event {
// tauri::WindowEvent::Resized(physical_size) => todo!(),
// tauri::WindowEvent::Moved(physical_position) => todo!(),
tauri::WindowEvent::CloseRequested { api, .. } => {
api.prevent_close();
log::info!("main window close requested, hiding");
let window = _app_handle.get_webview_window("main").unwrap();
window.hide().unwrap();
}
// tauri::WindowEvent::Destroyed => todo!(),
// tauri::WindowEvent::Focused(_) => todo!(),
// tauri::WindowEvent::ScaleFactorChanged {
// scale_factor,
// new_inner_size,
// } => todo!(),
// tauri::WindowEvent::DragDrop(drag_drop_event) => todo!(),
// tauri::WindowEvent::ThemeChanged(theme) => todo!(),
_ => {}
}
}
}
// tauri::RunEvent::WebviewEvent { label, event, .. } => todo!(),
// tauri::RunEvent::Ready => todo!(),
// tauri::RunEvent::Resumed => todo!(),

View File

@ -0,0 +1 @@
export { cn } from "./tailwind"

View File

@ -0,0 +1,29 @@
import { getCurrentWindow } from "@tauri-apps/api/window"
import { dev } from "$app/environment"
/**
* Initialize the app
*/
export function init() {
const window = getCurrentWindow()
if (window.label === "main") {
initMainWindow()
}
if (!dev) {
document.addEventListener("contextmenu", function (event) {
event.preventDefault()
console.warn("contextmenu disabled in release mode", event)
})
}
}
export function initMainWindow() {
// const window = getCurrentWindow()
// if (window.label === "main") {
// window.onCloseRequested((event) => {
// event.preventDefault()
// window.hide()
// })
// }
}

View File

@ -1,17 +1,12 @@
<script lang="ts">
import { onMount } from "svelte"
import "../app.css"
import { init } from "@/utils/init"
import { ModeWatcher, ThemeWrapper } from "@kksh/svelte5"
import { dev } from "$app/environment"
import { Toaster } from "svelte-sonner"
onMount(() => {
if (!dev) {
document.addEventListener("contextmenu", function (event) {
event.preventDefault()
console.warn("contextmenu disabled in release mode", event)
})
}
init()
})
let { children } = $props()

View File

@ -52,7 +52,7 @@ describe("Validate Jsr package as Kunkun extension", () => {
jsrPackage: {
scope: "kunkun",
name: "ext-image-processing",
version: "0.0.6"
version: "0.0.18"
},
githubUsername: "Huakun"
})
@ -66,7 +66,7 @@ describe("Validate Jsr package as Kunkun extension", () => {
jsrPackage: {
scope: "kunkun",
name: "ext-image-processing",
version: "0.0.6"
version: "0.0.18"
},
githubUsername: "HuakunShen"
})

View File

@ -43,7 +43,7 @@
"dependencies": {
"@kksh/api": "workspace:*",
"@kksh/vue": "0.1.3",
"@nuxtjs/tailwindcss": "^6.12.1",
"@nuxtjs/tailwindcss": "6.12.1",
"nuxt": "^3.12.4",
"tailwindcss": "^3.4.7",
"vite": "^5.4.9",

78
pnpm-lock.yaml generated
View File

@ -802,8 +802,8 @@ importers:
specifier: 0.1.3
version: 0.1.3(@popperjs/core@2.11.8)(@vue/devtools-api@7.6.4)(tailwindcss@3.4.15)(vue@3.5.13(typescript@5.6.3))
'@nuxtjs/tailwindcss':
specifier: ^6.12.1
version: 6.12.2(magicast@0.3.5)(rollup@4.30.1)
specifier: 6.12.1
version: 6.12.1(magicast@0.3.5)(rollup@4.30.1)
nuxt:
specifier: ^3.12.4
version: 3.14.159(@parcel/watcher@2.5.0)(@types/node@22.10.5)(eslint@9.17.0(jiti@2.4.0))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.30.1)(terser@5.36.0)(typescript@5.6.3)(vite@5.4.11(@types/node@22.10.5)(terser@5.36.0))(vue-tsc@2.1.10(typescript@5.6.3))
@ -1716,17 +1716,17 @@ packages:
resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==}
engines: {node: '>=16.13'}
'@csstools/selector-resolve-nested@3.0.0':
resolution: {integrity: sha512-ZoK24Yku6VJU1gS79a5PFmC8yn3wIapiKmPgun0hZgEI5AOqgH2kiPRsPz1qkGv4HL+wuDLH83yQyk6inMYrJQ==}
engines: {node: '>=18'}
'@csstools/selector-resolve-nested@1.1.0':
resolution: {integrity: sha512-uWvSaeRcHyeNenKg8tp17EVDRkpflmdyvbE0DHo6D/GdBb6PDnCYYU6gRpXhtICMGMcahQmj2zGxwFM/WC8hCg==}
engines: {node: ^14 || ^16 || >=18}
peerDependencies:
postcss-selector-parser: ^7.0.0
postcss-selector-parser: ^6.0.13
'@csstools/selector-specificity@5.0.0':
resolution: {integrity: sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==}
engines: {node: '>=18'}
'@csstools/selector-specificity@3.1.1':
resolution: {integrity: sha512-a7cxGcJ2wIlMFLlh8z2ONm+715QkPHiyJcxwQlKOz/03GPw1COpfhcmC9wm4xlZfp//jWHNNMwzjtqHXVWU9KA==}
engines: {node: ^14 || ^16 || >=18}
peerDependencies:
postcss-selector-parser: ^7.0.0
postcss-selector-parser: ^6.0.13
'@dependents/detective-less@5.0.0':
resolution: {integrity: sha512-D/9dozteKcutI5OdxJd8rU+fL6XgaaRg60sPPJWkT33OCiRfkCu5wO5B/yXTaaL2e6EB0lcCBGe5E0XscZCvvQ==}
@ -2756,8 +2756,8 @@ packages:
peerDependencies:
vue: ^3.3.4
'@nuxtjs/tailwindcss@6.12.2':
resolution: {integrity: sha512-qPJiFH67CkTj/2kBGBzqXihOD1rQXMsbVS4vdQvfBxOBLPfGhU1yw7AATdhPl2BBjO2krjJLuZj39t7dnDYOwg==}
'@nuxtjs/tailwindcss@6.12.1':
resolution: {integrity: sha512-UKmaPRVpxlFqLorhL6neEba2tySlsj6w6yDb7jzS6A0AAjyBQ6k3BQqWO+AaTy2iQLX7eR+1yj3/w43HzY8RtA==}
'@octokit/auth-token@5.1.1':
resolution: {integrity: sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==}
@ -8850,9 +8850,9 @@ packages:
peerDependencies:
postcss: ^8.2.14
postcss-nesting@13.0.1:
resolution: {integrity: sha512-VbqqHkOBOt4Uu3G8Dm8n6lU5+9cJFxiuty9+4rcoyRPO9zZS1JIs6td49VIoix3qYqELHlJIn46Oih9SAKo+yQ==}
engines: {node: '>=18'}
postcss-nesting@12.1.5:
resolution: {integrity: sha512-N1NgI1PDCiAGWPTYrwqm8wpjv0bgDmkYHH72pNsqTCv9CObxjxftdYu6AKtGN+pnJa7FQjMm3v4sp8QJbFsYdQ==}
engines: {node: ^14 || ^16 || >=18}
peerDependencies:
postcss: ^8.4
@ -8948,10 +8948,6 @@ packages:
resolution: {integrity: sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==}
engines: {node: '>=4'}
postcss-selector-parser@7.0.0:
resolution: {integrity: sha512-9RbEr1Y7FFfptd/1eEdntyjMwLeghW1bHX9GWjXo19vx4ytPQhANltvVxDggzJl7mnWM+dX28kb6cyS/4iQjlQ==}
engines: {node: '>=4'}
postcss-svgo@7.0.1:
resolution: {integrity: sha512-0WBUlSL4lhD9rA5k1e5D8EN5wCEyZD6HJk0jIvRxl+FDVOMlJ7DePHYWGGVc5QRqrJ3/06FTXM0bxjmJpmTPSA==}
engines: {node: ^18.12.0 || ^20.9.0 || >= 18}
@ -11928,13 +11924,13 @@ snapshots:
dependencies:
mime: 3.0.0
'@csstools/selector-resolve-nested@3.0.0(postcss-selector-parser@7.0.0)':
'@csstools/selector-resolve-nested@1.1.0(postcss-selector-parser@6.1.2)':
dependencies:
postcss-selector-parser: 7.0.0
postcss-selector-parser: 6.1.2
'@csstools/selector-specificity@5.0.0(postcss-selector-parser@7.0.0)':
'@csstools/selector-specificity@3.1.1(postcss-selector-parser@6.1.2)':
dependencies:
postcss-selector-parser: 7.0.0
postcss-selector-parser: 6.1.2
'@dependents/detective-less@5.0.0':
dependencies:
@ -13141,17 +13137,16 @@ snapshots:
- vti
- vue-tsc
'@nuxtjs/tailwindcss@6.12.2(magicast@0.3.5)(rollup@4.30.1)':
'@nuxtjs/tailwindcss@6.12.1(magicast@0.3.5)(rollup@4.30.1)':
dependencies:
'@nuxt/kit': 3.14.159(magicast@0.3.5)(rollup@4.30.1)
autoprefixer: 10.4.20(postcss@8.4.49)
consola: 3.2.3
defu: 6.1.4
h3: 1.13.0
klona: 2.0.6
pathe: 1.1.2
postcss: 8.4.49
postcss-nesting: 13.0.1(postcss@8.4.49)
postcss-nesting: 12.1.5(postcss@8.4.49)
tailwind-config-viewer: 2.0.4(tailwindcss@3.4.17)
tailwindcss: 3.4.17
ufo: 1.5.4
@ -17729,8 +17724,8 @@ snapshots:
'@typescript-eslint/parser': 8.15.0(eslint@8.57.1)(typescript@5.6.3)
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)
eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1)
eslint-plugin-react: 7.37.2(eslint@8.57.1)
eslint-plugin-react-hooks: 5.0.0(eslint@8.57.1)
@ -17758,37 +17753,37 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1):
eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.0(supports-color@9.4.0)
enhanced-resolve: 5.17.1
eslint: 8.57.1
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-bun-module: 1.2.1
is-glob: 4.0.3
optionalDependencies:
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
transitivePeerDependencies:
- '@typescript-eslint/parser'
- eslint-import-resolver-node
- eslint-import-resolver-webpack
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1):
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.15.0(eslint@8.57.1)(typescript@5.6.3)
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1)
eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1)
transitivePeerDependencies:
- supports-color
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1):
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.8
@ -17799,7 +17794,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.15.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@ -20217,12 +20212,12 @@ snapshots:
postcss: 8.4.49
postcss-selector-parser: 6.1.2
postcss-nesting@13.0.1(postcss@8.4.49):
postcss-nesting@12.1.5(postcss@8.4.49):
dependencies:
'@csstools/selector-resolve-nested': 3.0.0(postcss-selector-parser@7.0.0)
'@csstools/selector-specificity': 5.0.0(postcss-selector-parser@7.0.0)
'@csstools/selector-resolve-nested': 1.1.0(postcss-selector-parser@6.1.2)
'@csstools/selector-specificity': 3.1.1(postcss-selector-parser@6.1.2)
postcss: 8.4.49
postcss-selector-parser: 7.0.0
postcss-selector-parser: 6.1.2
postcss-normalize-charset@7.0.0(postcss@8.4.49):
dependencies:
@ -20304,11 +20299,6 @@ snapshots:
cssesc: 3.0.0
util-deprecate: 1.0.2
postcss-selector-parser@7.0.0:
dependencies:
cssesc: 3.0.0
util-deprecate: 1.0.2
postcss-svgo@7.0.1(postcss@8.4.49):
dependencies:
postcss: 8.4.49