From 06b2fff1dcc863017c4f5f96bc635daec49ede7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=82=9C=E6=B5=B7?= Date: Sun, 3 Nov 2024 01:50:13 +0800 Subject: [PATCH] update --- .npmrc | 2 + .nvmrc | 1 - .prettierrc.json | 6 - README.md | 10 +- app-views/index.html | 26 +- app-views/package.json | 14 +- app-views/pnpm-lock.yaml | 315 +++++++++--------- .../src/pages/creator/components/dock.vue | 9 + .../src/pages/creator/components/layout.vue | 32 +- .../src/pages/creator/components/panel.vue | 37 ++ .../src/pages/creator/{panel.vue => page.vue} | 4 +- app-views/src/pages/creator/sub-window.vue | 27 ++ app-views/src/pages/demo/download.vue | 16 +- app-views/src/pages/demo/open-window.vue | 10 +- app-views/src/route.ts | 88 ++--- app-views/src/style.css | 28 +- app-views/vite.config.ts | 42 +-- app/package.json | 23 +- app/src/index.ts | 125 +++---- package.json | 44 +-- pnpm-lock.yaml | 21 +- 21 files changed, 475 insertions(+), 405 deletions(-) delete mode 100644 .nvmrc delete mode 100644 .prettierrc.json create mode 100644 app-views/src/pages/creator/components/panel.vue rename app-views/src/pages/creator/{panel.vue => page.vue} (87%) create mode 100644 app-views/src/pages/creator/sub-window.vue diff --git a/.npmrc b/.npmrc index 34556f7..f7e6ccb 100644 --- a/.npmrc +++ b/.npmrc @@ -3,3 +3,5 @@ ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ registry=https://registry.npmmirror.com #registry=https://registry.npmjs.org + +use-node-version=22.11.0 \ No newline at end of file diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index a05e3d4..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -18.20.2 \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 8bc26bc..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tabWidth": 4, - "semi": true, - "singleQuote": true, - "printWidth": 180 -} diff --git a/README.md b/README.md index 0afa95c..2162346 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,23 @@ # electron ## asar + https://github.com/electron/asar ## electron-builder -https://github.com/electron-userland/electron-builder +https://github.com/electron-userland/electron-builder ## electron-universal -https://github.com/electron/universal +https://github.com/electron/universal ## electron-forge + https://www.electronforge.io/ ## 开发依赖 -所有开发依赖都安装在 root/package.json@devDependencies 中,这样在打包的时候就不会把开发依赖打包进去。 \ No newline at end of file +所有开发依赖都安装在 root/package.json@devDependencies 中,这样在打包的时候就不会把开发依赖打包进去。 + +使用 pnpm ,但是不用 workspaces 功能,为了更好的控制依赖安装的位置。 diff --git a/app-views/index.html b/app-views/index.html index 77f5a1d..ff6bd1b 100644 --- a/app-views/index.html +++ b/app-views/index.html @@ -1,16 +1,16 @@ - - - - - Cocos Creator 4.0 - - -
- - + + + + + Cocos Creator next + + +
+ + diff --git a/app-views/package.json b/app-views/package.json index 484159f..2c96c85 100644 --- a/app-views/package.json +++ b/app-views/package.json @@ -6,16 +6,14 @@ }, "dependencies": { "@ant-design/icons-vue": "^7.0.1", - "ant-design-vue": "^4.2.3", - "lit": "^3.2.0", - "lodash": "^4.17.21", - "vue": "^3.5.3", - "vue-router": "4" + "ant-design-vue": "^4.2.5", + "vue": "^3.5.12", + "vue-router": "4.4.5" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.1.2", + "@vitejs/plugin-vue": "^5.1.4", "unplugin-vue-components": "^0.27.4", - "vite": "^5.4.3", - "vue-tsc": "^2.1.6" + "vite": "^5.4.10", + "vue-tsc": "^2.1.10" } } diff --git a/app-views/pnpm-lock.yaml b/app-views/pnpm-lock.yaml index d45d4e2..2123bc6 100644 --- a/app-views/pnpm-lock.yaml +++ b/app-views/pnpm-lock.yaml @@ -10,35 +10,29 @@ importers: dependencies: '@ant-design/icons-vue': specifier: ^7.0.1 - version: 7.0.1(vue@3.5.3(typescript@5.6.2)) + version: 7.0.1(vue@3.5.12(typescript@5.6.2)) ant-design-vue: - specifier: ^4.2.3 - version: 4.2.3(vue@3.5.3(typescript@5.6.2)) - lit: - specifier: ^3.2.0 - version: 3.2.0 - lodash: - specifier: ^4.17.21 - version: 4.17.21 + specifier: ^4.2.5 + version: 4.2.5(vue@3.5.12(typescript@5.6.2)) vue: - specifier: ^3.5.3 - version: 3.5.3(typescript@5.6.2) + specifier: ^3.5.12 + version: 3.5.12(typescript@5.6.2) vue-router: - specifier: '4' - version: 4.4.3(vue@3.5.3(typescript@5.6.2)) + specifier: 4.4.5 + version: 4.4.5(vue@3.5.12(typescript@5.6.2)) devDependencies: '@vitejs/plugin-vue': - specifier: ^5.1.2 - version: 5.1.3(vite@5.4.4)(vue@3.5.3(typescript@5.6.2)) + specifier: ^5.1.4 + version: 5.1.4(vite@5.4.10)(vue@3.5.12(typescript@5.6.2)) unplugin-vue-components: specifier: ^0.27.4 - version: 0.27.4(@babel/parser@7.25.3)(rollup@4.21.2)(vue@3.5.3(typescript@5.6.2)) + version: 0.27.4(@babel/parser@7.25.3)(rollup@4.21.2)(vue@3.5.12(typescript@5.6.2)) vite: - specifier: ^5.4.3 - version: 5.4.4 + specifier: ^5.4.10 + version: 5.4.10 vue-tsc: - specifier: ^2.1.6 - version: 2.1.6(typescript@5.6.2) + specifier: ^2.1.10 + version: 2.1.10(typescript@5.6.2) packages: @@ -228,12 +222,6 @@ packages: '@jridgewell/sourcemap-codec@1.5.0': resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - '@lit-labs/ssr-dom-shim@1.2.1': - resolution: {integrity: sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ==} - - '@lit/reactive-element@2.0.4': - resolution: {integrity: sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==} - '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -350,64 +338,70 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - '@types/trusted-types@2.0.7': - resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} - - '@vitejs/plugin-vue@5.1.3': - resolution: {integrity: sha512-3xbWsKEKXYlmX82aOHufFQVnkbMC/v8fLpWwh6hWOUrK5fbbtBh9Q/WWse27BFgSy2/e2c0fz5Scgya9h2GLhw==} + '@vitejs/plugin-vue@5.1.4': + resolution: {integrity: sha512-N2XSI2n3sQqp5w7Y/AN/L2XDjBIRGqXko+eDp42sydYSBeJuSm5a1sLf8zakmo8u7tA8NmBgoDLA1HeOESjp9A==} engines: {node: ^18.0.0 || >=20.0.0} peerDependencies: vite: ^5.0.0 vue: ^3.2.25 - '@volar/language-core@2.4.4': - resolution: {integrity: sha512-kO9k4kTLfxpg+6lq7/KAIv3m2d62IHuCL6GbVgYZTpfKvIGoAIlDxK7pFcB/eczN2+ydg/vnyaeZ6SGyZrJw2w==} + '@volar/language-core@2.4.8': + resolution: {integrity: sha512-K/GxMOXGq997bO00cdFhTNuR85xPxj0BEEAy+BaqqayTmy9Tmhfgmq2wpJcVspRhcwfgPoE2/mEJa26emUhG/g==} + + '@volar/source-map@2.4.8': + resolution: {integrity: sha512-jeWJBkC/WivdelMwxKkpFL811uH/jJ1kVxa+c7OvG48DXc3VrP7pplSWPP2W1dLMqBxD+awRlg55FQQfiup4cA==} - '@volar/source-map@2.4.4': - resolution: {integrity: sha512-xG3PZqOP2haG8XG4Pg3PD1UGDAdqZg24Ru8c/qYjYAnmcj6GBR64mstx+bZux5QOyRaJK+/lNM/RnpvBD3489g==} + '@volar/typescript@2.4.8': + resolution: {integrity: sha512-6xkIYJ5xxghVBhVywMoPMidDDAFT1OoQeXwa27HSgJ6AiIKRe61RXLoik+14Z7r0JvnblXVsjsRLmCr42SGzqg==} - '@volar/typescript@2.4.4': - resolution: {integrity: sha512-QQMQRVj0fVHJ3XdRKiS1LclhG0VBXdFYlyuHRQF/xLk2PuJuHNWP26MDZNvEVCvnyUQuUQhIAfylwY5TGPgc6w==} + '@vue/compiler-core@3.5.12': + resolution: {integrity: sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==} '@vue/compiler-core@3.5.3': resolution: {integrity: sha512-adAfy9boPkP233NTyvLbGEqVuIfK/R0ZsBsIOW4BZNfb4BRpRW41Do1u+ozJpsb+mdoy80O20IzAsHaihRb5qA==} + '@vue/compiler-dom@3.5.12': + resolution: {integrity: sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==} + '@vue/compiler-dom@3.5.3': resolution: {integrity: sha512-wnzFArg9zpvk/811CDOZOadJRugf1Bgl/TQ3RfV4nKfSPok4hi0w10ziYUQR6LnnBAUlEXYLUfZ71Oj9ds/+QA==} - '@vue/compiler-sfc@3.5.3': - resolution: {integrity: sha512-P3uATLny2tfyvMB04OQFe7Sczteno7SLFxwrOA/dw01pBWQHB5HL15a8PosoNX2aG/EAMGqnXTu+1LnmzFhpTQ==} + '@vue/compiler-sfc@3.5.12': + resolution: {integrity: sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw==} - '@vue/compiler-ssr@3.5.3': - resolution: {integrity: sha512-F/5f+r2WzL/2YAPl7UlKcJWHrvoZN8XwEBLnT7S4BXwncH25iDOabhO2M2DWioyTguJAGavDOawejkFXj8EM1w==} + '@vue/compiler-ssr@3.5.12': + resolution: {integrity: sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA==} '@vue/compiler-vue2@2.7.16': resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==} - '@vue/devtools-api@6.6.3': - resolution: {integrity: sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==} + '@vue/devtools-api@6.6.4': + resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==} - '@vue/language-core@2.1.6': - resolution: {integrity: sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==} + '@vue/language-core@2.1.10': + resolution: {integrity: sha512-DAI289d0K3AB5TUG3xDp9OuQ71CnrujQwJrQnfuZDwo6eGNf0UoRlPuaVNO+Zrn65PC3j0oB2i7mNmVPggeGeQ==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - '@vue/reactivity@3.5.3': - resolution: {integrity: sha512-2w61UnRWTP7+rj1H/j6FH706gRBHdFVpIqEkSDAyIpafBXYH8xt4gttstbbCWdU3OlcSWO8/3mbKl/93/HSMpw==} + '@vue/reactivity@3.5.12': + resolution: {integrity: sha512-UzaN3Da7xnJXdz4Okb/BGbAaomRHc3RdoWqTzlvd9+WBR5m3J39J1fGcHes7U3za0ruYn/iYy/a1euhMEHvTAg==} - '@vue/runtime-core@3.5.3': - resolution: {integrity: sha512-5b2AQw5OZlmCzSsSBWYoZOsy75N4UdMWenTfDdI5bAzXnuVR7iR8Q4AOzQm2OGoA41xjk53VQKrqQhOz2ktWaw==} + '@vue/runtime-core@3.5.12': + resolution: {integrity: sha512-hrMUYV6tpocr3TL3Ad8DqxOdpDe4zuQY4HPY3X/VRh+L2myQO8MFXPAMarIOSGNu0bFAjh1yBkMPXZBqCk62Uw==} - '@vue/runtime-dom@3.5.3': - resolution: {integrity: sha512-wPR1DEGc3XnQ7yHbmkTt3GoY0cEnVGQnARRdAkDzZ8MbUKEs26gogCQo6AOvvgahfjIcnvWJzkZArQ1fmWjcSg==} + '@vue/runtime-dom@3.5.12': + resolution: {integrity: sha512-q8VFxR9A2MRfBr6/55Q3umyoN7ya836FzRXajPB6/Vvuv0zOPL+qltd9rIMzG/DbRLAIlREmnLsplEF/kotXKA==} - '@vue/server-renderer@3.5.3': - resolution: {integrity: sha512-28volmaZVG2PGO3V3+gBPKoSHvLlE8FGfG/GKXKkjjfxLuj/50B/0OQGakM/g6ehQeqCrZYM4eHC4Ks48eig1Q==} + '@vue/server-renderer@3.5.12': + resolution: {integrity: sha512-I3QoeDDeEPZm8yR28JtY+rk880Oqmj43hreIBVTicisFTx/Dl7JpG72g/X7YF8hnQD3IFhkky5i2bPonwrTVPg==} peerDependencies: - vue: 3.5.3 + vue: 3.5.12 + + '@vue/shared@3.5.12': + resolution: {integrity: sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==} '@vue/shared@3.5.3': resolution: {integrity: sha512-Jp2v8nylKBT+PlOUjun2Wp/f++TfJVFjshLzNtJDdmFJabJa7noGMncqXRM1vXGX+Yo2V7WykQFNxusSim8SCA==} @@ -417,8 +411,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - ant-design-vue@4.2.3: - resolution: {integrity: sha512-kqGyWvZtFlSInFP93Ow6wS8LzEsxxUgpI+ZY5jQQkuX8WAcqdwXCA7IcHMpECW6JB89DZMo2Bw85jUg2SjlgQA==} + alien-signals@0.2.0: + resolution: {integrity: sha512-StlonZhBBrsPPwrDjiPAiVTf/rolxffLxVPT60Qv/t88BZ81BvUVzHgGqEFvJ1ii8HXtm1+zU2Icr59tfWEcag==} + + ant-design-vue@4.2.5: + resolution: {integrity: sha512-dh5CBXSaxJZBFQBd156sOUuZPfxI7pZsNXDYpHNBt/JyKZoYlbetRp/nJmSragS2Oo0mVC23Ote+TQSGc0TX6g==} engines: {node: '>=12.22.0'} peerDependencies: vue: '>=3.2.0' @@ -454,9 +451,6 @@ packages: compute-scroll-into-view@1.0.20: resolution: {integrity: sha512-UCB0ioiyj8CRjtrvaceBLqqhZCVP+1B8+NWQhmdsm0VXOJtobBCf1dBQmebCCo34qZmUwZfIH2MZLqNHazrfjg==} - computeds@0.0.1: - resolution: {integrity: sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==} - confbox@0.1.7: resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} @@ -546,15 +540,6 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - lit-element@4.1.0: - resolution: {integrity: sha512-gSejRUQJuMQjV2Z59KAS/D4iElUhwKpIyJvZ9w+DIagIQjfJnhR20h2Q5ddpzXGS+fF0tMZ/xEYGMnKmaI/iww==} - - lit-html@3.2.0: - resolution: {integrity: sha512-pwT/HwoxqI9FggTrYVarkBKFN9MlTUpLrDHubTmW4SrkL3kkqW5gxwbxMMUnbbRHBC0WTZnYHcjDSCM559VyfA==} - - lit@3.2.0: - resolution: {integrity: sha512-s6tI33Lf6VpDu7u4YqsSX78D28bYQulM+VAzsGch4fx2H0eLZnJsUBsPWmGYSGoKDNbjtRv02rio1o+UdPVwvw==} - local-pkg@0.5.0: resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} engines: {node: '>=14'} @@ -614,6 +599,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -625,6 +613,10 @@ packages: resolution: {integrity: sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==} engines: {node: ^10 || ^12 || >=14} + postcss@8.4.47: + resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} + engines: {node: ^10 || ^12 || >=14} + queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -665,6 +657,10 @@ packages: resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} engines: {node: '>=0.10.0'} + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + stylis@4.3.4: resolution: {integrity: sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now==} @@ -710,8 +706,8 @@ packages: webpack-sources: optional: true - vite@5.4.4: - resolution: {integrity: sha512-RHFCkULitycHVTtelJ6jQLd+KSAAzOgEYorV32R2q++M6COBjKJR6BxqClwp5sf0XaBDjVMuJ9wnNfyAJwjMkA==} + vite@5.4.10: + resolution: {integrity: sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -744,13 +740,13 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} - vue-router@4.4.3: - resolution: {integrity: sha512-sv6wmNKx2j3aqJQDMxLFzs/u/mjA9Z5LCgy6BE0f7yFWMjrPLnS/sPNn8ARY/FXw6byV18EFutn5lTO6+UsV5A==} + vue-router@4.4.5: + resolution: {integrity: sha512-4fKZygS8cH1yCyuabAXGUAsyi1b2/o/OKgu/RUb+znIYOxPRxdkytJEx+0wGcpBE1pX6vUgh5jwWOKRGvuA/7Q==} peerDependencies: vue: ^3.2.0 - vue-tsc@2.1.6: - resolution: {integrity: sha512-f98dyZp5FOukcYmbFpuSCJ4Z0vHSOSmxGttZJCsFeX0M4w/Rsq0s4uKXjcSRsZqsRgQa6z7SfuO+y0HVICE57Q==} + vue-tsc@2.1.10: + resolution: {integrity: sha512-RBNSfaaRHcN5uqVqJSZh++Gy/YUzryuv9u1aFWhsammDJXNtUiJMNoJ747lZcQ68wUQFx6E73y4FY3D8E7FGMA==} hasBin: true peerDependencies: typescript: '>=5.0.0' @@ -761,8 +757,8 @@ packages: peerDependencies: vue: ^3.0.0 - vue@3.5.3: - resolution: {integrity: sha512-xvRbd0HpuLovYbOHXRHlSBsSvmUJbo0pzbkKTApWnQGf3/cu5Z39mQeA5cZdLRVIoNf3zI6MSoOgHUT5i2jO+Q==} + vue@3.5.12: + resolution: {integrity: sha512-CLVZtXtn2ItBIi/zHZ0Sg1Xkb7+PU32bJJ8Bmy7ts3jxXTcbfsEfBivFYYWz1Hur+lalqGAh65Coin0r+HRUfg==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -783,11 +779,11 @@ snapshots: '@ant-design/icons-svg@4.4.2': {} - '@ant-design/icons-vue@7.0.1(vue@3.5.3(typescript@5.6.2))': + '@ant-design/icons-vue@7.0.1(vue@3.5.12(typescript@5.6.2))': dependencies: '@ant-design/colors': 6.0.0 '@ant-design/icons-svg': 4.4.2 - vue: 3.5.3(typescript@5.6.2) + vue: 3.5.12(typescript@5.6.2) '@antfu/utils@0.7.10': {} @@ -886,12 +882,6 @@ snapshots: '@jridgewell/sourcemap-codec@1.5.0': {} - '@lit-labs/ssr-dom-shim@1.2.1': {} - - '@lit/reactive-element@2.0.4': - dependencies: - '@lit-labs/ssr-dom-shim': 1.2.1 - '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -967,25 +957,31 @@ snapshots: '@types/estree@1.0.5': {} - '@types/trusted-types@2.0.7': {} - - '@vitejs/plugin-vue@5.1.3(vite@5.4.4)(vue@3.5.3(typescript@5.6.2))': + '@vitejs/plugin-vue@5.1.4(vite@5.4.10)(vue@3.5.12(typescript@5.6.2))': dependencies: - vite: 5.4.4 - vue: 3.5.3(typescript@5.6.2) + vite: 5.4.10 + vue: 3.5.12(typescript@5.6.2) - '@volar/language-core@2.4.4': + '@volar/language-core@2.4.8': dependencies: - '@volar/source-map': 2.4.4 + '@volar/source-map': 2.4.8 - '@volar/source-map@2.4.4': {} + '@volar/source-map@2.4.8': {} - '@volar/typescript@2.4.4': + '@volar/typescript@2.4.8': dependencies: - '@volar/language-core': 2.4.4 + '@volar/language-core': 2.4.8 path-browserify: 1.0.1 vscode-uri: 3.0.8 + '@vue/compiler-core@3.5.12': + dependencies: + '@babel/parser': 7.25.3 + '@vue/shared': 3.5.12 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.2.0 + '@vue/compiler-core@3.5.3': dependencies: '@babel/parser': 7.25.3 @@ -994,78 +990,87 @@ snapshots: estree-walker: 2.0.2 source-map-js: 1.2.0 + '@vue/compiler-dom@3.5.12': + dependencies: + '@vue/compiler-core': 3.5.12 + '@vue/shared': 3.5.12 + '@vue/compiler-dom@3.5.3': dependencies: '@vue/compiler-core': 3.5.3 '@vue/shared': 3.5.3 - '@vue/compiler-sfc@3.5.3': + '@vue/compiler-sfc@3.5.12': dependencies: '@babel/parser': 7.25.3 - '@vue/compiler-core': 3.5.3 - '@vue/compiler-dom': 3.5.3 - '@vue/compiler-ssr': 3.5.3 - '@vue/shared': 3.5.3 + '@vue/compiler-core': 3.5.12 + '@vue/compiler-dom': 3.5.12 + '@vue/compiler-ssr': 3.5.12 + '@vue/shared': 3.5.12 estree-walker: 2.0.2 magic-string: 0.30.11 - postcss: 8.4.45 + postcss: 8.4.47 source-map-js: 1.2.0 - '@vue/compiler-ssr@3.5.3': + '@vue/compiler-ssr@3.5.12': dependencies: - '@vue/compiler-dom': 3.5.3 - '@vue/shared': 3.5.3 + '@vue/compiler-dom': 3.5.12 + '@vue/shared': 3.5.12 '@vue/compiler-vue2@2.7.16': dependencies: de-indent: 1.0.2 he: 1.2.0 - '@vue/devtools-api@6.6.3': {} + '@vue/devtools-api@6.6.4': {} - '@vue/language-core@2.1.6(typescript@5.6.2)': + '@vue/language-core@2.1.10(typescript@5.6.2)': dependencies: - '@volar/language-core': 2.4.4 + '@volar/language-core': 2.4.8 '@vue/compiler-dom': 3.5.3 '@vue/compiler-vue2': 2.7.16 '@vue/shared': 3.5.3 - computeds: 0.0.1 + alien-signals: 0.2.0 minimatch: 9.0.5 muggle-string: 0.4.1 path-browserify: 1.0.1 optionalDependencies: typescript: 5.6.2 - '@vue/reactivity@3.5.3': + '@vue/reactivity@3.5.12': dependencies: - '@vue/shared': 3.5.3 + '@vue/shared': 3.5.12 - '@vue/runtime-core@3.5.3': + '@vue/runtime-core@3.5.12': dependencies: - '@vue/reactivity': 3.5.3 - '@vue/shared': 3.5.3 + '@vue/reactivity': 3.5.12 + '@vue/shared': 3.5.12 - '@vue/runtime-dom@3.5.3': + '@vue/runtime-dom@3.5.12': dependencies: - '@vue/reactivity': 3.5.3 - '@vue/runtime-core': 3.5.3 - '@vue/shared': 3.5.3 + '@vue/reactivity': 3.5.12 + '@vue/runtime-core': 3.5.12 + '@vue/shared': 3.5.12 csstype: 3.1.3 - '@vue/server-renderer@3.5.3(vue@3.5.3(typescript@5.6.2))': + '@vue/server-renderer@3.5.12(vue@3.5.12(typescript@5.6.2))': dependencies: - '@vue/compiler-ssr': 3.5.3 - '@vue/shared': 3.5.3 - vue: 3.5.3(typescript@5.6.2) + '@vue/compiler-ssr': 3.5.12 + '@vue/shared': 3.5.12 + vue: 3.5.12(typescript@5.6.2) + + '@vue/shared@3.5.12': {} '@vue/shared@3.5.3': {} acorn@8.12.1: {} - ant-design-vue@4.2.3(vue@3.5.3(typescript@5.6.2)): + alien-signals@0.2.0: {} + + ant-design-vue@4.2.5(vue@3.5.12(typescript@5.6.2)): dependencies: '@ant-design/colors': 6.0.0 - '@ant-design/icons-vue': 7.0.1(vue@3.5.3(typescript@5.6.2)) + '@ant-design/icons-vue': 7.0.1(vue@3.5.12(typescript@5.6.2)) '@babel/runtime': 7.25.4 '@ctrl/tinycolor': 3.6.1 '@emotion/hash': 0.9.2 @@ -1084,8 +1089,8 @@ snapshots: shallow-equal: 1.2.1 stylis: 4.3.4 throttle-debounce: 5.0.2 - vue: 3.5.3(typescript@5.6.2) - vue-types: 3.0.2(vue@3.5.3(typescript@5.6.2)) + vue: 3.5.12(typescript@5.6.2) + vue-types: 3.0.2(vue@3.5.12(typescript@5.6.2)) warning: 4.0.3 anymatch@3.1.3: @@ -1123,8 +1128,6 @@ snapshots: compute-scroll-into-view@1.0.20: {} - computeds@0.0.1: {} - confbox@0.1.7: {} core-js@3.38.1: {} @@ -1214,22 +1217,6 @@ snapshots: js-tokens@4.0.0: {} - lit-element@4.1.0: - dependencies: - '@lit-labs/ssr-dom-shim': 1.2.1 - '@lit/reactive-element': 2.0.4 - lit-html: 3.2.0 - - lit-html@3.2.0: - dependencies: - '@types/trusted-types': 2.0.7 - - lit@3.2.0: - dependencies: - '@lit/reactive-element': 2.0.4 - lit-element: 4.1.0 - lit-html: 3.2.0 - local-pkg@0.5.0: dependencies: mlly: 1.7.1 @@ -1281,6 +1268,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.1: {} + picomatch@2.3.1: {} pkg-types@1.2.0: @@ -1295,6 +1284,12 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postcss@8.4.47: + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.1 + source-map-js: 1.2.1 + queue-microtask@1.2.3: {} readdirp@3.6.0: @@ -1343,6 +1338,8 @@ snapshots: source-map-js@1.2.0: {} + source-map-js@1.2.1: {} + stylis@4.3.4: {} throttle-debounce@5.0.2: {} @@ -1357,7 +1354,7 @@ snapshots: ufo@1.5.4: {} - unplugin-vue-components@0.27.4(@babel/parser@7.25.3)(rollup@4.21.2)(vue@3.5.3(typescript@5.6.2)): + unplugin-vue-components@0.27.4(@babel/parser@7.25.3)(rollup@4.21.2)(vue@3.5.12(typescript@5.6.2)): dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.1.0(rollup@4.21.2) @@ -1369,7 +1366,7 @@ snapshots: minimatch: 9.0.5 mlly: 1.7.1 unplugin: 1.14.1 - vue: 3.5.3(typescript@5.6.2) + vue: 3.5.12(typescript@5.6.2) optionalDependencies: '@babel/parser': 7.25.3 transitivePeerDependencies: @@ -1382,7 +1379,7 @@ snapshots: acorn: 8.12.1 webpack-virtual-modules: 0.6.2 - vite@5.4.4: + vite@5.4.10: dependencies: esbuild: 0.21.5 postcss: 8.4.45 @@ -1392,30 +1389,30 @@ snapshots: vscode-uri@3.0.8: {} - vue-router@4.4.3(vue@3.5.3(typescript@5.6.2)): + vue-router@4.4.5(vue@3.5.12(typescript@5.6.2)): dependencies: - '@vue/devtools-api': 6.6.3 - vue: 3.5.3(typescript@5.6.2) + '@vue/devtools-api': 6.6.4 + vue: 3.5.12(typescript@5.6.2) - vue-tsc@2.1.6(typescript@5.6.2): + vue-tsc@2.1.10(typescript@5.6.2): dependencies: - '@volar/typescript': 2.4.4 - '@vue/language-core': 2.1.6(typescript@5.6.2) + '@volar/typescript': 2.4.8 + '@vue/language-core': 2.1.10(typescript@5.6.2) semver: 7.6.3 typescript: 5.6.2 - vue-types@3.0.2(vue@3.5.3(typescript@5.6.2)): + vue-types@3.0.2(vue@3.5.12(typescript@5.6.2)): dependencies: is-plain-object: 3.0.1 - vue: 3.5.3(typescript@5.6.2) + vue: 3.5.12(typescript@5.6.2) - vue@3.5.3(typescript@5.6.2): + vue@3.5.12(typescript@5.6.2): dependencies: - '@vue/compiler-dom': 3.5.3 - '@vue/compiler-sfc': 3.5.3 - '@vue/runtime-dom': 3.5.3 - '@vue/server-renderer': 3.5.3(vue@3.5.3(typescript@5.6.2)) - '@vue/shared': 3.5.3 + '@vue/compiler-dom': 3.5.12 + '@vue/compiler-sfc': 3.5.12 + '@vue/runtime-dom': 3.5.12 + '@vue/server-renderer': 3.5.12(vue@3.5.12(typescript@5.6.2)) + '@vue/shared': 3.5.12 optionalDependencies: typescript: 5.6.2 diff --git a/app-views/src/pages/creator/components/dock.vue b/app-views/src/pages/creator/components/dock.vue index 7bc05bd..45dacab 100644 --- a/app-views/src/pages/creator/components/dock.vue +++ b/app-views/src/pages/creator/components/dock.vue @@ -59,6 +59,15 @@ const layout: Ref = ref({ url: 'http://localhost:5555/#/panel/project' } ] + }, + { + direction: 'column', + panels: [ + { + name: 'console', + url: 'http://localhost:5555/#/panel/console' + } + ] } ], diff --git a/app-views/src/pages/creator/components/layout.vue b/app-views/src/pages/creator/components/layout.vue index ee030e7..9933f3e 100644 --- a/app-views/src/pages/creator/components/layout.vue +++ b/app-views/src/pages/creator/components/layout.vue @@ -6,27 +6,16 @@
-
- - - - - +
+
@@ -62,18 +51,5 @@ const activeKey = ref(layout.panels?.length ? layout.panels[0].name : ''); flex-shrink: 0; background-color: blueviolet; } - - & .ant-tabs, - & .ant-tabs-content-holder, - & .ant-tabs-content { - height: 100%; - } - - iframe { - width: 100%; - height: 100%; - max-width: 100%; - max-height: 100%; - } } \ No newline at end of file diff --git a/app-views/src/pages/creator/components/panel.vue b/app-views/src/pages/creator/components/panel.vue new file mode 100644 index 0000000..af3be53 --- /dev/null +++ b/app-views/src/pages/creator/components/panel.vue @@ -0,0 +1,37 @@ + + + + \ No newline at end of file diff --git a/app-views/src/pages/creator/panel.vue b/app-views/src/pages/creator/page.vue similarity index 87% rename from app-views/src/pages/creator/panel.vue rename to app-views/src/pages/creator/page.vue index 360e156..4209601 100644 --- a/app-views/src/pages/creator/panel.vue +++ b/app-views/src/pages/creator/page.vue @@ -1,5 +1,5 @@ @@ -10,7 +10,7 @@ const { name } = defineProps<{ \ No newline at end of file diff --git a/app-views/src/pages/demo/download.vue b/app-views/src/pages/demo/download.vue index 251c105..c89787f 100644 --- a/app-views/src/pages/demo/download.vue +++ b/app-views/src/pages/demo/download.vue @@ -46,16 +46,16 @@ const taskList = ref([]); function download(link: string) { - window.ipc.send('download-create', link); + window.ipc?.send('download-create', link); } function downloadTogglePause(item: IDownloadItem) { if (item.isPause) { console.log('继续下载') - window.ipc.send('download-create', item.url); + window.ipc?.send('download-create', item.url); } else { console.log('暂停下载') - window.ipc.send('download-pause', item.url); + window.ipc?.send('download-pause', item.url); } } @@ -71,16 +71,16 @@ function onDownloadProgress(_: any, item: IDownloadItem) { } } -window.ipc.on('download-update', onDownloadUpdate); -window.ipc.on('download-progress', onDownloadProgress) +window.ipc?.on('download-update', onDownloadUpdate); +window.ipc?.on('download-progress', onDownloadProgress) onUnmounted(() => { - window.ipc.off('download-update', onDownloadUpdate); - window.ipc.off('download-progress', onDownloadProgress) + window.ipc?.off('download-update', onDownloadUpdate); + window.ipc?.off('download-progress', onDownloadProgress) }) function downloadAndReadHash() { - window.ipc.send('start-write-hash'); + window.ipc?.send('start-write-hash'); } diff --git a/app-views/src/pages/demo/open-window.vue b/app-views/src/pages/demo/open-window.vue index 33885cf..3975bc0 100644 --- a/app-views/src/pages/demo/open-window.vue +++ b/app-views/src/pages/demo/open-window.vue @@ -5,11 +5,11 @@ const isPackaged = ref(false); function openChildWin() { - window.ipc.send('open-child-win') + window.ipc?.send('open-child-win') } async function winOpen() { - const url = await window.ipc.invoke('get-window-url'); + const url = await window.ipc?.invoke('get-window-url'); console.log(url); window.open(url, '子窗口') } @@ -21,14 +21,14 @@ function winOpenOnline() { onMounted(async () => { window.addEventListener('contextmenu', (e) => { e.preventDefault(); - window.ipc.send('show-context-menu'); + window.ipc?.send('show-context-menu'); }); - window.ipc.on('context-menu-command', (e, command) => { + window.ipc?.on('context-menu-command', (e, command) => { console.log(e, command); }); - isPackaged.value = await window.ipc.invoke('app-is-packaged') + isPackaged.value = await window.ipc?.invoke('app-is-packaged') }) diff --git a/app-views/src/route.ts b/app-views/src/route.ts index 809d254..628136a 100644 --- a/app-views/src/route.ts +++ b/app-views/src/route.ts @@ -1,50 +1,58 @@ -import { createRouter, createWebHashHistory } from 'vue-router'; -import type { RouteRecordRaw } from 'vue-router'; +import { createRouter, createWebHashHistory } from "vue-router"; +import type { RouteRecordRaw } from "vue-router"; export const routes: RouteRecordRaw[] = [ - { - path: '/', - name: 'home', - redirect: '/demo/download', - meta: { - hideInNav: true, - }, + { + path: "/", + name: "home", + redirect: "/creator", + meta: { + hideInNav: true, }, - { - path: '/demo/', - component: () => import('./pages/demo/index.vue'), - meta: { - title: '操练场', - }, - children: [ - { - path: 'download', - name: 'download', - component: () => import('./pages/demo/download.vue'), - }, - { - path: 'open-window', - name: 'open-window', - component: () => import('./pages/demo/open-window.vue'), - }, - ], + }, + { + path: "/demo/", + component: () => import("./pages/demo/index.vue"), + meta: { + title: "操练场", }, - { - path: '/creator', - name: 'creator 4.0', - component: () => import('./pages/creator/index.vue'), + children: [ + { + path: "download", + name: "download", + component: () => import("./pages/demo/download.vue"), + }, + { + path: "open-window", + name: "open-window", + component: () => import("./pages/demo/open-window.vue"), + }, + ], + }, + { + path: "/creator", + name: "creator 4.0", + component: () => import("./pages/creator/index.vue"), + }, + { + path: "/panel/:name", + props: true, + component: () => import("./pages/creator/page.vue"), + meta: { + hideInNav: true, }, - { - path: '/panel/:name', - props: true, - component: () => import('./pages/creator/panel.vue'), - meta: { - hideInNav: true, - }, + }, + { + path: "/sub-win/:name/:url", + props: true, + component: () => import("./pages/creator/sub-window.vue"), + meta: { + hideInNav: true, }, + }, ]; export const router = createRouter({ - history: createWebHashHistory(), - routes, + history: createWebHashHistory(), + routes, }); diff --git a/app-views/src/style.css b/app-views/src/style.css index 0a6e417..adea9e0 100644 --- a/app-views/src/style.css +++ b/app-views/src/style.css @@ -1,19 +1,23 @@ :root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } body { - margin: 0; - min-height: 100vh; + margin: 0; + min-height: 100vh; +} + +.ant-tabs-nav { + margin-bottom: 0 !important; } diff --git a/app-views/vite.config.ts b/app-views/vite.config.ts index faf59d4..1451826 100644 --- a/app-views/vite.config.ts +++ b/app-views/vite.config.ts @@ -1,27 +1,27 @@ -import { defineConfig } from 'vite'; -import vue from '@vitejs/plugin-vue'; -import Components from 'unplugin-vue-components/vite'; -import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; +import { defineConfig } from "vite"; +import vue from "@vitejs/plugin-vue"; +import Components from "unplugin-vue-components/vite"; +import { AntDesignVueResolver } from "unplugin-vue-components/resolvers"; // https://vitejs.dev/config/ export default defineConfig({ - root: './', - build: { - outDir: '../app/node_modules/.views', - emptyOutDir: true, - rollupOptions: { - external: ['electron'], - }, + root: "./", + base: "./", + build: { + outDir: "../app/node_modules/.views", + emptyOutDir: true, + rollupOptions: { + external: ["electron"], }, - plugins: [ - vue(), - Components({ - resolvers: [ - AntDesignVueResolver({ - importStyle: false, // css in js - }), - ], + }, + plugins: [ + vue(), + Components({ + resolvers: [ + AntDesignVueResolver({ + importStyle: false, // css in js }), - ], - base: './', + ], + }), + ], }); diff --git a/app/package.json b/app/package.json index a18586f..3d9a9b9 100644 --- a/app/package.json +++ b/app/package.json @@ -1,13 +1,14 @@ { - "name": "electron-app", - "version": "1.0.0", - "type": "module", - "main": "dist/index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { - "axios": "^1.7.4", - "fs-extra": "^11.2.0" - } + "name": "cocos-creator-next", + "version": "1.0.0", + "type": "module", + "main": "dist/index.js", + "scripts": { + "dev": "npx tsc --watch", + "build": "npx tsc" + }, + "dependencies": { + "axios": "^1.7.4", + "fs-extra": "^11.2.0" + } } diff --git a/app/src/index.ts b/app/src/index.ts index 72bfec8..23baada 100644 --- a/app/src/index.ts +++ b/app/src/index.ts @@ -1,87 +1,100 @@ -import { app, BrowserWindow, ipcMain } from 'electron'; -import { join, dirname } from 'node:path'; -import { pathToFileURL, fileURLToPath } from 'node:url'; -import './download/index.js'; -import './download/hash-list.js'; +import { app, BrowserWindow, ipcMain } from "electron"; +import { join, dirname } from "node:path"; +import { pathToFileURL, fileURLToPath } from "node:url"; +import "./download/index.js"; +import "./download/hash-list.js"; -import './menu/index.js'; -import './window-center.js'; +import "./menu/index.js"; +import "./window-center.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); -const isPackaged = app.isPackaged || __dirname.includes('asar'); +const isPackaged = app.isPackaged || __dirname.includes("asar"); if (!isPackaged) { - await import('./devtool.cjs'); + await import("./devtool.cjs"); } let main: BrowserWindow | null = null; const createWindow = () => { - const mainWindow = new BrowserWindow({ - width: 12000, - height: 900, + const mainWindow = new BrowserWindow({ + width: 1200, + height: 900, + webPreferences: { + preload: join(__dirname, "../preload.cjs"), // 只能是 cjs + sandbox: true, + webSecurity: true, + }, + }); + + mainWindow.webContents.setWindowOpenHandler(({ url }) => { + console.log("渲染进程在打开这个地址:", url); + return { + action: "allow", + overrideBrowserWindowOptions: { webPreferences: { - preload: join(__dirname, '../preload.cjs'), // 只能是 cjs - sandbox: true, - webSecurity: true, + preload: join(__dirname, "../preload.cjs"), }, - }); + }, + }; + }); - mainWindow.webContents.setWindowOpenHandler(({ url }) => { - console.log('渲染进程在打开这个地址:', url); - return { - action: 'allow', - overrideBrowserWindowOptions: { - webPreferences: { - preload: join(__dirname, '../preload.cjs'), - }, - }, - }; - }); + main = mainWindow; - main = mainWindow; + // 加载 index.html + if (isPackaged) { + const viewLink = join(__dirname, "../node_modules/.views/index.html"); + mainWindow.loadFile(viewLink); - // 加载 index.html - if (isPackaged) { - const viewLink = join(__dirname, '../node_modules/.views/index.html'); + mainWindow.webContents.on("will-navigate", (event, url) => { + // 如果不是 index.html,则阻止导航并重定向 + if (!url.startsWith(viewLink)) { + event.preventDefault(); mainWindow.loadFile(viewLink); + } + }); - mainWindow.webContents.on('will-navigate', (event, url) => { - // 如果不是 index.html,则阻止导航并重定向 - if (!url.startsWith(viewLink)) { - event.preventDefault(); - mainWindow.loadFile(viewLink); - } - }); - - mainWindow.setTitle('打包模式'); - } else { - mainWindow.loadURL('http://localhost:5555/'); + mainWindow.setTitle("打包模式"); + } else { + mainWindow.loadURL("http://localhost:5555/"); - // 打开开发工具 - mainWindow.webContents.openDevTools(); - mainWindow.setTitle('开发模式'); - } + // 打开开发工具 + mainWindow.webContents.openDevTools(); + mainWindow.setTitle("开发模式"); + } }; +setTimeout(() => { + const win = new BrowserWindow({ + width: 800, + height: 800, + webPreferences: { + preload: join(__dirname, "../preload.cjs"), // 只能是 cjs + sandbox: true, + webSecurity: true, + }, + }); + win.loadURL("http://localhost:5555/#/sub-win/abc/efg"); +}, 1000 * 3); + // 这段程序将会在 Electron 结束初始化 // 和创建浏览器窗口的时候调用 // 部分 API 在 ready 事件触发后才能使用。 app.whenReady().then(() => { - createWindow(); + createWindow(); - app.on('activate', () => { - // 在 macOS 系统内, 如果没有已开启的应用窗口 - // 点击托盘图标时通常会重新创建一个新窗口 - if (BrowserWindow.getAllWindows().length === 0) createWindow(); - }); + app.on("activate", () => { + // 在 macOS 系统内, 如果没有已开启的应用窗口 + // 点击托盘图标时通常会重新创建一个新窗口 + if (BrowserWindow.getAllWindows().length === 0) createWindow(); + }); }); // 除了 macOS 外,当所有窗口都被关闭的时候退出程序。 因此, 通常 // 对应用程序和它们的菜单栏来说应该时刻保持激活状态, // 直到用户使用 Cmd + Q 明确退出 -app.on('window-all-closed', () => { - if (process.platform !== 'darwin') app.quit(); +app.on("window-all-closed", () => { + if (process.platform !== "darwin") app.quit(); }); -ipcMain.handle('app-is-packaged', () => { - return isPackaged; +ipcMain.handle("app-is-packaged", () => { + return isPackaged; }); diff --git a/package.json b/package.json index 65f62fc..48dc08f 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { - "name": "my-electron-app", - "type": "module", - "scripts": { - "preinstall": "npx only-allow pnpm", - "make": "pnpm run web:build && pnpm run app:build && node ./scripts/make.mjs", - "app:dev": "cd ./app && tsc --watch", - "app:build": "cd ./app && tsc", - "web:dev": "cd ./app-views && pnpm run dev", - "web:build": "cd ./app-views && pnpm run build" - }, - "packageManager": "pnpm@9.0.0", - "devDependencies": { - "@electron/asar": "^3.2.8", - "@types/fs-extra": "^11.0.4", - "axios": "^1.7.4", - "electron": "29.0.1", - "electron-devtools-installer": "^3.2.0", - "extract-zip": "^2.0.1", - "fs-extra": "^11.2.0", - "progress": "^2.0.3", - "typescript": "^5.5.4" - } + "name": "my-electron-app", + "type": "module", + "scripts": { + "preinstall": "npx only-allow pnpm", + "make": "pnpm run web:build && pnpm run app:build && node ./scripts/make.mjs", + "app:dev": "cd ./app && pnpm run dev", + "app:build": "cd ./app && pnpm run build", + "web:dev": "cd ./app-views && pnpm run dev", + "web:build": "cd ./app-views && pnpm run build" + }, + "packageManager": "pnpm@9.0.0", + "devDependencies": { + "@electron/asar": "^3.2.8", + "@types/fs-extra": "^11.0.4", + "axios": "^1.7.4", + "electron": "33.0.2", + "electron-devtools-installer": "^3.2.0", + "extract-zip": "^2.0.1", + "fs-extra": "^11.2.0", + "progress": "^2.0.3", + "typescript": "^5.6.3" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 113c9f9..bff25e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^1.7.4 version: 1.7.4 electron: - specifier: 29.0.1 - version: 29.0.1 + specifier: 33.0.2 + version: 33.0.2 electron-devtools-installer: specifier: ^3.2.0 version: 3.2.0 @@ -33,8 +33,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 typescript: - specifier: ^5.5.4 - version: 5.5.4 + specifier: ^5.6.3 + version: 5.6.3 packages: @@ -93,6 +93,7 @@ packages: boolean@3.2.0: resolution: {integrity: sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -160,8 +161,8 @@ packages: electron-devtools-installer@3.2.0: resolution: {integrity: sha512-t3UczsYugm4OAbqvdImMCImIMVdFzJAHgbwHpkl5jmfu1izVgUcP/mnrPqJIpEeCK1uZGpt+yHgWEN+9EwoYhQ==} - electron@29.0.1: - resolution: {integrity: sha512-hsQr9clm8NCAMv4uhHlXThHn52UAgrHgyz3ubBAxZIPuUcpKVDtg4HPmx4hbmHIbYICI5OyLN3Ztp7rS+Dn4Lw==} + electron@33.0.2: + resolution: {integrity: sha512-C2WksfP0COsMHbYXSJG68j6S3TjuGDrw/YT42B526yXalIlNQZ2GeAYKryg6AEMkIp3p8TUfDRD0+HyiyCt/nw==} engines: {node: '>= 12.20.55'} hasBin: true @@ -444,8 +445,8 @@ packages: resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} engines: {node: '>=10'} - typescript@5.5.4: - resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==} + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} hasBin: true @@ -626,7 +627,7 @@ snapshots: tslib: 2.7.0 unzip-crx-3: 0.2.0 - electron@29.0.1: + electron@33.0.2: dependencies: '@electron/get': 2.0.3 '@types/node': 20.16.1 @@ -939,7 +940,7 @@ snapshots: type-fest@0.13.1: optional: true - typescript@5.5.4: {} + typescript@5.6.3: {} undici-types@6.19.8: {}