From 3b9d5b953ac91b2ece7ea420dcba3229b67ef50f Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Sat, 9 Nov 2024 12:10:15 +0100 Subject: [PATCH 01/17] feat: add toggler to hide/display debug panel --- .../devtools/src/components/DebugPanel.vue | 33 ++++++++++ .../src/components/FDebugPanel.ce.vue | 63 +++++++++++++------ .../devtools/src/components/ToggleButton.vue | 3 + 3 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 packages/devtools/src/components/DebugPanel.vue create mode 100644 packages/devtools/src/components/ToggleButton.vue diff --git a/packages/devtools/src/components/DebugPanel.vue b/packages/devtools/src/components/DebugPanel.vue new file mode 100644 index 00000000..e126e707 --- /dev/null +++ b/packages/devtools/src/components/DebugPanel.vue @@ -0,0 +1,33 @@ + + + diff --git a/packages/devtools/src/components/FDebugPanel.ce.vue b/packages/devtools/src/components/FDebugPanel.ce.vue index e2a53851..a82681d6 100644 --- a/packages/devtools/src/components/FDebugPanel.ce.vue +++ b/packages/devtools/src/components/FDebugPanel.ce.vue @@ -1,48 +1,71 @@ diff --git a/packages/devtools/src/components/common/Tabs.vue b/packages/devtools/src/components/common/Tabs.vue new file mode 100644 index 00000000..cf3f2c30 --- /dev/null +++ b/packages/devtools/src/components/common/Tabs.vue @@ -0,0 +1,59 @@ + + + From 2fc33c4bd1f845b0969f1e1547bd16ae67703049 Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Tue, 19 Nov 2024 13:00:02 +0100 Subject: [PATCH 05/17] feat: use Vue instance instead of Web Components --- package-lock.json | 379 +++++++++++------- package.json | 2 +- packages/devtools/src/FDebug.ts | 36 +- .../devtools/src/components/DebugPanel.vue | 106 +++++ packages/devtools/src/components/FDebug.vue | 39 ++ .../src/components/FDebugPanel.ce.vue | 312 -------------- .../devtools/src/components/ToggleButton.vue | 81 ++++ .../components/common/FComponentHeader.vue | 49 +++ .../devtools/src/components/common/Tabs.vue | 63 ++- .../src/components/icons/FComponentIcon.vue | 9 + 10 files changed, 584 insertions(+), 492 deletions(-) create mode 100644 packages/devtools/src/components/FDebug.vue delete mode 100644 packages/devtools/src/components/FDebugPanel.ce.vue diff --git a/package-lock.json b/package-lock.json index 463e97dd..aa3d6cb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "vite": "^5.2.9", "vitepress": "^1.5.0", "vitest": "^2.1.2", - "vue": "^3.4.37", + "vue": "^3.5.13", "vue-tsc": "^2.0.29" } }, @@ -6030,45 +6030,112 @@ } }, "node_modules/@vue/reactivity": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.0.tgz", - "integrity": "sha512-Ew3F5riP3B3ZDGjD3ZKb9uZylTTPSqt8hAf4sGbvbjrjDjrFb3Jm15Tk1/w7WwTE5GbQ2Qhwxx1moc9hr8A/OQ==", + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.13.tgz", + "integrity": "sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==", + "dev": true, "dependencies": { - "@vue/shared": "3.5.0" + "@vue/shared": "3.5.13" } }, + "node_modules/@vue/reactivity/node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true + }, "node_modules/@vue/runtime-core": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.0.tgz", - "integrity": "sha512-mQyW0F9FaNRdt8ghkAs+BMG3iQ7LGgWKOpkzUzR5AI5swPNydHGL5hvVTqFaeMzwecF1g0c86H4yFQsSxJhH1w==", + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.13.tgz", + "integrity": "sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==", + "dev": true, "dependencies": { - "@vue/reactivity": "3.5.0", - "@vue/shared": "3.5.0" + "@vue/reactivity": "3.5.13", + "@vue/shared": "3.5.13" } }, + "node_modules/@vue/runtime-core/node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true + }, "node_modules/@vue/runtime-dom": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.0.tgz", - "integrity": "sha512-NQQXjpdXgyYVJ2M56FJ+lSJgZiecgQ2HhxhnQBN95FymXegRNY/N2htI7vOTwpP75pfxhIeYOJ8mE8sW8KAW6A==", + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.13.tgz", + "integrity": "sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==", + "dev": true, "dependencies": { - "@vue/reactivity": "3.5.0", - "@vue/runtime-core": "3.5.0", - "@vue/shared": "3.5.0", + "@vue/reactivity": "3.5.13", + "@vue/runtime-core": "3.5.13", + "@vue/shared": "3.5.13", "csstype": "^3.1.3" } }, + "node_modules/@vue/runtime-dom/node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true + }, "node_modules/@vue/server-renderer": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.0.tgz", - "integrity": "sha512-HyDIFUg+l7L4PKrEnJlCYWHUOlm6NxZhmSxIefZ5MTYjkIPfDfkwhX7hqxAQHfgIAE1uLMLQZwuNR/ozI0NhZg==", + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.13.tgz", + "integrity": "sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==", + "dev": true, "dependencies": { - "@vue/compiler-ssr": "3.5.0", - "@vue/shared": "3.5.0" + "@vue/compiler-ssr": "3.5.13", + "@vue/shared": "3.5.13" }, "peerDependencies": { - "vue": "3.5.0" + "vue": "3.5.13" + } + }, + "node_modules/@vue/server-renderer/node_modules/@vue/compiler-core": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.13.tgz", + "integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.13", + "entities": "^4.5.0", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.0" } }, + "node_modules/@vue/server-renderer/node_modules/@vue/compiler-dom": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz", + "integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==", + "dev": true, + "dependencies": { + "@vue/compiler-core": "3.5.13", + "@vue/shared": "3.5.13" + } + }, + "node_modules/@vue/server-renderer/node_modules/@vue/compiler-ssr": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz", + "integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==", + "dev": true, + "dependencies": { + "@vue/compiler-dom": "3.5.13", + "@vue/shared": "3.5.13" + } + }, + "node_modules/@vue/server-renderer/node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true + }, + "node_modules/@vue/server-renderer/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "node_modules/@vue/shared": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.0.tgz", @@ -11926,9 +11993,9 @@ } }, "node_modules/postcss": { - "version": "8.4.47", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", - "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", "funding": [ { "type": "opencollective", @@ -11945,7 +12012,7 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.1.0", + "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { @@ -15136,133 +15203,12 @@ } } }, - "node_modules/vitepress/node_modules/@vue/compiler-core": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.12.tgz", - "integrity": "sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==", - "dev": true, - "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" - } - }, - "node_modules/vitepress/node_modules/@vue/compiler-dom": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz", - "integrity": "sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==", - "dev": true, - "dependencies": { - "@vue/compiler-core": "3.5.12", - "@vue/shared": "3.5.12" - } - }, - "node_modules/vitepress/node_modules/@vue/compiler-sfc": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.12.tgz", - "integrity": "sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.25.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.47", - "source-map-js": "^1.2.0" - } - }, - "node_modules/vitepress/node_modules/@vue/compiler-ssr": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.12.tgz", - "integrity": "sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA==", - "dev": true, - "dependencies": { - "@vue/compiler-dom": "3.5.12", - "@vue/shared": "3.5.12" - } - }, - "node_modules/vitepress/node_modules/@vue/reactivity": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.12.tgz", - "integrity": "sha512-UzaN3Da7xnJXdz4Okb/BGbAaomRHc3RdoWqTzlvd9+WBR5m3J39J1fGcHes7U3za0ruYn/iYy/a1euhMEHvTAg==", - "dev": true, - "dependencies": { - "@vue/shared": "3.5.12" - } - }, - "node_modules/vitepress/node_modules/@vue/runtime-core": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.12.tgz", - "integrity": "sha512-hrMUYV6tpocr3TL3Ad8DqxOdpDe4zuQY4HPY3X/VRh+L2myQO8MFXPAMarIOSGNu0bFAjh1yBkMPXZBqCk62Uw==", - "dev": true, - "dependencies": { - "@vue/reactivity": "3.5.12", - "@vue/shared": "3.5.12" - } - }, - "node_modules/vitepress/node_modules/@vue/runtime-dom": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.12.tgz", - "integrity": "sha512-q8VFxR9A2MRfBr6/55Q3umyoN7ya836FzRXajPB6/Vvuv0zOPL+qltd9rIMzG/DbRLAIlREmnLsplEF/kotXKA==", - "dev": true, - "dependencies": { - "@vue/reactivity": "3.5.12", - "@vue/runtime-core": "3.5.12", - "@vue/shared": "3.5.12", - "csstype": "^3.1.3" - } - }, - "node_modules/vitepress/node_modules/@vue/server-renderer": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.12.tgz", - "integrity": "sha512-I3QoeDDeEPZm8yR28JtY+rk880Oqmj43hreIBVTicisFTx/Dl7JpG72g/X7YF8hnQD3IFhkky5i2bPonwrTVPg==", - "dev": true, - "dependencies": { - "@vue/compiler-ssr": "3.5.12", - "@vue/shared": "3.5.12" - }, - "peerDependencies": { - "vue": "3.5.12" - } - }, "node_modules/vitepress/node_modules/@vue/shared": { "version": "3.5.12", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.12.tgz", "integrity": "sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==", "dev": true }, - "node_modules/vitepress/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, - "node_modules/vitepress/node_modules/vue": { - "version": "3.5.12", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.12.tgz", - "integrity": "sha512-CLVZtXtn2ItBIi/zHZ0Sg1Xkb7+PU32bJJ8Bmy7ts3jxXTcbfsEfBivFYYWz1Hur+lalqGAh65Coin0r+HRUfg==", - "dev": true, - "dependencies": { - "@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/shared": "3.5.12" - }, - "peerDependencies": { - "typescript": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/vitest": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.2.tgz", @@ -15334,15 +15280,16 @@ "dev": true }, "node_modules/vue": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.0.tgz", - "integrity": "sha512-1t70favYoFijwfWJ7g81aTd32obGaAnKYE9FNyMgnEzn3F4YncRi/kqAHHKloG0VXTD8vBYMhbgLKCA+Sk6QDw==", + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.13.tgz", + "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", + "dev": true, "dependencies": { - "@vue/compiler-dom": "3.5.0", - "@vue/compiler-sfc": "3.5.0", - "@vue/runtime-dom": "3.5.0", - "@vue/server-renderer": "3.5.0", - "@vue/shared": "3.5.0" + "@vue/compiler-dom": "3.5.13", + "@vue/compiler-sfc": "3.5.13", + "@vue/runtime-dom": "3.5.13", + "@vue/server-renderer": "3.5.13", + "@vue/shared": "3.5.13" }, "peerDependencies": { "typescript": "*" @@ -15439,6 +15386,68 @@ "typescript": ">=5.0.0" } }, + "node_modules/vue/node_modules/@vue/compiler-core": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.13.tgz", + "integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.13", + "entities": "^4.5.0", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.0" + } + }, + "node_modules/vue/node_modules/@vue/compiler-dom": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz", + "integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==", + "dev": true, + "dependencies": { + "@vue/compiler-core": "3.5.13", + "@vue/shared": "3.5.13" + } + }, + "node_modules/vue/node_modules/@vue/compiler-sfc": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.13.tgz", + "integrity": "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/compiler-core": "3.5.13", + "@vue/compiler-dom": "3.5.13", + "@vue/compiler-ssr": "3.5.13", + "@vue/shared": "3.5.13", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.11", + "postcss": "^8.4.48", + "source-map-js": "^1.2.0" + } + }, + "node_modules/vue/node_modules/@vue/compiler-ssr": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz", + "integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==", + "dev": true, + "dependencies": { + "@vue/compiler-dom": "3.5.13", + "@vue/shared": "3.5.13" + } + }, + "node_modules/vue/node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true + }, + "node_modules/vue/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -15759,6 +15768,66 @@ "vue": "3.5.0" } }, + "packages/devtools/node_modules/@vue/reactivity": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.0.tgz", + "integrity": "sha512-Ew3F5riP3B3ZDGjD3ZKb9uZylTTPSqt8hAf4sGbvbjrjDjrFb3Jm15Tk1/w7WwTE5GbQ2Qhwxx1moc9hr8A/OQ==", + "dependencies": { + "@vue/shared": "3.5.0" + } + }, + "packages/devtools/node_modules/@vue/runtime-core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.0.tgz", + "integrity": "sha512-mQyW0F9FaNRdt8ghkAs+BMG3iQ7LGgWKOpkzUzR5AI5swPNydHGL5hvVTqFaeMzwecF1g0c86H4yFQsSxJhH1w==", + "dependencies": { + "@vue/reactivity": "3.5.0", + "@vue/shared": "3.5.0" + } + }, + "packages/devtools/node_modules/@vue/runtime-dom": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.0.tgz", + "integrity": "sha512-NQQXjpdXgyYVJ2M56FJ+lSJgZiecgQ2HhxhnQBN95FymXegRNY/N2htI7vOTwpP75pfxhIeYOJ8mE8sW8KAW6A==", + "dependencies": { + "@vue/reactivity": "3.5.0", + "@vue/runtime-core": "3.5.0", + "@vue/shared": "3.5.0", + "csstype": "^3.1.3" + } + }, + "packages/devtools/node_modules/@vue/server-renderer": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.0.tgz", + "integrity": "sha512-HyDIFUg+l7L4PKrEnJlCYWHUOlm6NxZhmSxIefZ5MTYjkIPfDfkwhX7hqxAQHfgIAE1uLMLQZwuNR/ozI0NhZg==", + "dependencies": { + "@vue/compiler-ssr": "3.5.0", + "@vue/shared": "3.5.0" + }, + "peerDependencies": { + "vue": "3.5.0" + } + }, + "packages/devtools/node_modules/vue": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.0.tgz", + "integrity": "sha512-1t70favYoFijwfWJ7g81aTd32obGaAnKYE9FNyMgnEzn3F4YncRi/kqAHHKloG0VXTD8vBYMhbgLKCA+Sk6QDw==", + "dependencies": { + "@vue/compiler-dom": "3.5.0", + "@vue/compiler-sfc": "3.5.0", + "@vue/runtime-dom": "3.5.0", + "@vue/server-renderer": "3.5.0", + "@vue/shared": "3.5.0" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "packages/event": { "name": "@fibbojs/event", "version": "0.0.11", diff --git a/package.json b/package.json index 3e858c4e..ce489073 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "vite": "^5.2.9", "vitepress": "^1.5.0", "vitest": "^2.1.2", - "vue": "^3.4.37", + "vue": "^3.5.13", "vue-tsc": "^2.0.29" }, "nx": {} diff --git a/packages/devtools/src/FDebug.ts b/packages/devtools/src/FDebug.ts index 1c788a41..a44ef789 100644 --- a/packages/devtools/src/FDebug.ts +++ b/packages/devtools/src/FDebug.ts @@ -1,14 +1,11 @@ -import { defineCustomElement, reactive } from 'vue' +import { createApp, reactive } from 'vue' import type { FScene } from '@fibbojs/core' import type { FScene as FScene2d } from '@fibbojs/2d' import type { FScene as FScene3d } from '@fibbojs/3d' -import FDebugPanel from './components/FDebugPanel.ce.vue' +import FDebugComponent from './components/FDebug.vue' import { FDebug2d } from './FDebug2d' import { FDebug3d } from './FDebug3d' -// Define the custom Web Component from the Vue component -const FDebugPanelElement = defineCustomElement(FDebugPanel) - /** * A helper class to debug a given scene * @example @@ -39,13 +36,18 @@ export class FDebug { // Define the scene this.scene = scene - // Define the custom element in the browser - customElements.define('f-debug-panel', FDebugPanelElement) - // Create and inject the custom element into the DOM - const debugPanel = new FDebugPanelElement({ - title: 'Fibbo', - scene: this.scene, - }) + // Fetch the CSS + fetch(import.meta.url.replace('index.es.js', 'style.css')) + .then(res => res.text()) + .then((css) => { + // Extract the CSS content + css = css + .split('const __vite__css = "')[1] + .split('\\n"')[0] + const style = document.createElement('style') + style.innerHTML = css + document.head.appendChild(style) + }) // Make the component array reactive this.scene.components = reactive(this.scene.components) as any @@ -61,8 +63,16 @@ export class FDebug { this.debugger2d = new FDebug2d(scene as FScene2d) } - // Add the debug panel to the body + // Create a HTML element for the debug panel + const debugPanel = document.createElement('div') + debugPanel.id = 'f-debug' + // Append the debug panel to the body document.body.appendChild(debugPanel) + // Mount the Vue instance + createApp(FDebugComponent, { + title: 'Fibbo', + scene: this.scene, + }).mount('#f-debug') } } diff --git a/packages/devtools/src/components/DebugPanel.vue b/packages/devtools/src/components/DebugPanel.vue index 99ab8f9a..39ca6ce2 100644 --- a/packages/devtools/src/components/DebugPanel.vue +++ b/packages/devtools/src/components/DebugPanel.vue @@ -39,3 +39,109 @@ defineProps({ }, }) + + diff --git a/packages/devtools/src/components/FDebug.vue b/packages/devtools/src/components/FDebug.vue new file mode 100644 index 00000000..28317517 --- /dev/null +++ b/packages/devtools/src/components/FDebug.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/devtools/src/components/FDebugPanel.ce.vue b/packages/devtools/src/components/FDebugPanel.ce.vue deleted file mode 100644 index 66dca1e4..00000000 --- a/packages/devtools/src/components/FDebugPanel.ce.vue +++ /dev/null @@ -1,312 +0,0 @@ - - - - - diff --git a/packages/devtools/src/components/ToggleButton.vue b/packages/devtools/src/components/ToggleButton.vue index d839ee54..79a2d7a5 100644 --- a/packages/devtools/src/components/ToggleButton.vue +++ b/packages/devtools/src/components/ToggleButton.vue @@ -20,3 +20,84 @@ + + diff --git a/packages/devtools/src/components/common/FComponentHeader.vue b/packages/devtools/src/components/common/FComponentHeader.vue index d418ca42..da2f3c15 100644 --- a/packages/devtools/src/components/common/FComponentHeader.vue +++ b/packages/devtools/src/components/common/FComponentHeader.vue @@ -27,3 +27,52 @@ const props = defineProps({ const iconName = useComponentIcon(props.component) + + diff --git a/packages/devtools/src/components/common/Tabs.vue b/packages/devtools/src/components/common/Tabs.vue index cf3f2c30..6afd6f20 100644 --- a/packages/devtools/src/components/common/Tabs.vue +++ b/packages/devtools/src/components/common/Tabs.vue @@ -38,22 +38,63 @@ const selector = ref(null) function selectTab(id: string) { selectedTabId.value = id if (selector.value) { - const tabs = selector.value.parentElement?.querySelectorAll('.f-debug-tabs__tab') - if (tabs) { - const tab = tabs[props.tabs.indexOf(id)] as HTMLElement - selector.value.style.left = `${tab.offsetLeft}px` - } + selector.value.style.width = `calc(${100 / props.tabs.length}% - 12px)` + selector.value.style.left = `calc(${props.tabs.indexOf(id) * (100 / props.tabs.length)}% + 6px)` } } onMounted(() => { if (selector.value) { - const tabs = selector.value.parentElement?.querySelectorAll('.f-debug-tabs__tab') - if (tabs) { - const tab = tabs[0] as HTMLElement - selector.value.style.width = `${tab.offsetWidth}px` - selector.value.style.left = `${tab.offsetLeft}px` - } + selector.value.style.width = `calc(${100 / props.tabs.length}% - 12px)` + selector.value.style.left = `calc(${props.tabs.indexOf(selectedTabId.value) * (100 / props.tabs.length)}% + 6px)` } }) + + diff --git a/packages/devtools/src/components/icons/FComponentIcon.vue b/packages/devtools/src/components/icons/FComponentIcon.vue index 064c5ab5..8e250a69 100644 --- a/packages/devtools/src/components/icons/FComponentIcon.vue +++ b/packages/devtools/src/components/icons/FComponentIcon.vue @@ -36,3 +36,12 @@ defineProps({ }, }) + + From e778e1ace04704a427e704c2a2ea2522aaf397ac Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Tue, 19 Nov 2024 19:59:57 +0100 Subject: [PATCH 06/17] feat(devtools): improve architecture + prepare settings --- .../devtools/src/components/DebugPanel.vue | 147 ------------------ packages/devtools/src/components/FDebug.vue | 4 +- .../src/components/common/DebugPanel.vue | 77 +++++++++ .../src/components/common/FComponents.vue | 102 ++++++++++++ .../src/components/common/Setting.vue | 62 ++++++++ .../src/components/common/Settings.vue | 39 +++++ .../devtools/src/components/common/Tabs.vue | 65 ++++---- .../components/{ => common}/ToggleButton.vue | 0 .../src/components/common/Tooltip.vue | 76 +++++++++ .../src/components/forms/InputCheckbox.vue | 94 +++++++++++ 10 files changed, 491 insertions(+), 175 deletions(-) delete mode 100644 packages/devtools/src/components/DebugPanel.vue create mode 100644 packages/devtools/src/components/common/DebugPanel.vue create mode 100644 packages/devtools/src/components/common/FComponents.vue create mode 100644 packages/devtools/src/components/common/Setting.vue create mode 100644 packages/devtools/src/components/common/Settings.vue rename packages/devtools/src/components/{ => common}/ToggleButton.vue (100%) create mode 100644 packages/devtools/src/components/common/Tooltip.vue create mode 100644 packages/devtools/src/components/forms/InputCheckbox.vue diff --git a/packages/devtools/src/components/DebugPanel.vue b/packages/devtools/src/components/DebugPanel.vue deleted file mode 100644 index 39ca6ce2..00000000 --- a/packages/devtools/src/components/DebugPanel.vue +++ /dev/null @@ -1,147 +0,0 @@ - - - - - diff --git a/packages/devtools/src/components/FDebug.vue b/packages/devtools/src/components/FDebug.vue index 28317517..0bb17d05 100644 --- a/packages/devtools/src/components/FDebug.vue +++ b/packages/devtools/src/components/FDebug.vue @@ -20,8 +20,8 @@ import type { PropType } from 'vue' import { defineProps, ref } from 'vue' import type { FScene } from '@fibbojs/core' -import DebugPanel from './DebugPanel.vue' -import ToggleButton from './ToggleButton.vue' +import DebugPanel from './common/DebugPanel.vue' +import ToggleButton from './common/ToggleButton.vue' const props = defineProps({ title: String, diff --git a/packages/devtools/src/components/common/DebugPanel.vue b/packages/devtools/src/components/common/DebugPanel.vue new file mode 100644 index 00000000..83d2fe7b --- /dev/null +++ b/packages/devtools/src/components/common/DebugPanel.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/packages/devtools/src/components/common/FComponents.vue b/packages/devtools/src/components/common/FComponents.vue new file mode 100644 index 00000000..b1da48c7 --- /dev/null +++ b/packages/devtools/src/components/common/FComponents.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/packages/devtools/src/components/common/Setting.vue b/packages/devtools/src/components/common/Setting.vue new file mode 100644 index 00000000..dafa9f07 --- /dev/null +++ b/packages/devtools/src/components/common/Setting.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/packages/devtools/src/components/common/Settings.vue b/packages/devtools/src/components/common/Settings.vue new file mode 100644 index 00000000..9905b25b --- /dev/null +++ b/packages/devtools/src/components/common/Settings.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/packages/devtools/src/components/common/Tabs.vue b/packages/devtools/src/components/common/Tabs.vue index 6afd6f20..716b4ee9 100644 --- a/packages/devtools/src/components/common/Tabs.vue +++ b/packages/devtools/src/components/common/Tabs.vue @@ -52,37 +52,50 @@ onMounted(() => { diff --git a/packages/devtools/src/components/forms/InputCheckbox.vue b/packages/devtools/src/components/forms/InputCheckbox.vue new file mode 100644 index 00000000..c1f2c300 --- /dev/null +++ b/packages/devtools/src/components/forms/InputCheckbox.vue @@ -0,0 +1,94 @@ + + + + + + From 359250bb2b30996f4dcc639b5d5a418afd6d59a8 Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Tue, 19 Nov 2024 20:28:27 +0100 Subject: [PATCH 07/17] feat(devtools): wire helpers and hitboxes settings --- packages/devtools/src/FDebug3d.ts | 47 ++++++++++++----- packages/devtools/src/State.ts | 52 +++++++++++++++++++ .../src/components/common/Settings.vue | 35 ++++++++++--- .../src/components/common/Tooltip.vue | 2 +- 4 files changed, 115 insertions(+), 21 deletions(-) create mode 100644 packages/devtools/src/State.ts diff --git a/packages/devtools/src/FDebug3d.ts b/packages/devtools/src/FDebug3d.ts index 399620e1..fc9f7b51 100644 --- a/packages/devtools/src/FDebug3d.ts +++ b/packages/devtools/src/FDebug3d.ts @@ -1,4 +1,5 @@ import type { FLight, FScene } from '@fibbojs/3d' +import { State } from './State' /** * A helper class to debug a given 3d scene @@ -23,6 +24,7 @@ export class FDebug3d { /** * When a light is added to the scene, add a helper for it */ + const lightHelpers: any[] = [] scene.onLightAdded((lightParam) => { // Cast light to a 3D FLight const light = lightParam as FLight @@ -40,26 +42,45 @@ export class FDebug3d { return // Add the helper to the scene scene.scene.add(helper as any) + // Add the helper to the list of helpers + lightHelpers.push(helper) }) /** * Display debug lines on each frame */ scene.onFrame(() => { - // Remove previous debug lines - const previousLines = scene.scene.getObjectByName('DEBUG_LINES') - if (previousLines) - scene.scene.remove(previousLines) + if (State.hitboxes) { + // Remove previous debug lines + const previousLines = scene.scene.getObjectByName('DEBUG_LINES') + if (previousLines) + scene.scene.remove(previousLines) - // Render new debug lines - const { vertices, colors } = scene.world.debugRender() - const geometry = new scene.THREE.BufferGeometry() - geometry.setAttribute('position', new scene.THREE.Float32BufferAttribute(vertices, 3)) - geometry.setAttribute('color', new scene.THREE.Float32BufferAttribute(colors, 3)) - const material = new scene.THREE.LineBasicMaterial({ vertexColors: true }) - const lines = new scene.THREE.LineSegments(geometry, material) - lines.name = 'DEBUG_LINES' - scene.scene.add(lines) + // Render new debug lines + const { vertices, colors } = scene.world.debugRender() + const geometry = new scene.THREE.BufferGeometry() + geometry.setAttribute('position', new scene.THREE.Float32BufferAttribute(vertices, 3)) + geometry.setAttribute('color', new scene.THREE.Float32BufferAttribute(colors, 3)) + const material = new scene.THREE.LineBasicMaterial({ vertexColors: true }) + const lines = new scene.THREE.LineSegments(geometry, material) + lines.name = 'DEBUG_LINES' + scene.scene.add(lines) + } + }) + + State.onHitboxesChange((newState) => { + if (!newState) { + // Remove previous debug lines + const previousLines = scene.scene.getObjectByName('DEBUG_LINES') + if (previousLines) + scene.scene.remove(previousLines) + } + }) + + State.onHelpersChange((newState) => { + gridHelper.visible = newState + axesHelper.visible = newState + lightHelpers.forEach(helper => helper.visible = newState) }) } } diff --git a/packages/devtools/src/State.ts b/packages/devtools/src/State.ts new file mode 100644 index 00000000..bfc97861 --- /dev/null +++ b/packages/devtools/src/State.ts @@ -0,0 +1,52 @@ +export class State { + // Properties + private static __HITBOXES__: boolean = false + private static __HELPERS__: boolean = true + private static __GLASSMORPHISM__: boolean = true + + // Callbacks + private static __CALLBACKS_ON_HITBOXES_CHANGE__: ((newState: boolean) => void)[] = [] + private static __CALLBACKS_ON_HELPERS_CHANGE__: ((newState: boolean) => void)[] = [] + private static __CALLBACKS_ON_GLASSMORPHISM_CHANGE__: ((newState: boolean) => void)[] = [] + + // Methods + static onHitboxesChange(callback: (newState: boolean) => void) { + this.__CALLBACKS_ON_HITBOXES_CHANGE__.push(callback) + } + + static onHelpersChange(callback: (newState: boolean) => void) { + this.__CALLBACKS_ON_HELPERS_CHANGE__.push(callback) + } + + static onGlassmorphismChange(callback: (newState: boolean) => void) { + this.__CALLBACKS_ON_GLASSMORPHISM_CHANGE__.push(callback) + } + + // Getters & setters + static get hitboxes() { + return this.__HITBOXES__ + } + + static set hitboxes(newState: boolean) { + this.__HITBOXES__ = newState + this.__CALLBACKS_ON_HITBOXES_CHANGE__.forEach(callback => callback(newState)) + } + + static get helpers() { + return this.__HELPERS__ + } + + static set helpers(newState: boolean) { + this.__HELPERS__ = newState + this.__CALLBACKS_ON_HELPERS_CHANGE__.forEach(callback => callback(newState)) + } + + static get glassmorphism() { + return this.__GLASSMORPHISM__ + } + + static set glassmorphism(newState: boolean) { + this.__GLASSMORPHISM__ = newState + this.__CALLBACKS_ON_GLASSMORPHISM_CHANGE__.forEach(callback => callback(newState)) + } +} diff --git a/packages/devtools/src/components/common/Settings.vue b/packages/devtools/src/components/common/Settings.vue index 9905b25b..ed089283 100644 --- a/packages/devtools/src/components/common/Settings.vue +++ b/packages/devtools/src/components/common/Settings.vue @@ -1,22 +1,43 @@ diff --git a/packages/devtools/src/components/common/Tooltip.vue b/packages/devtools/src/components/common/Tooltip.vue index c996a992..b826ffe2 100644 --- a/packages/devtools/src/components/common/Tooltip.vue +++ b/packages/devtools/src/components/common/Tooltip.vue @@ -62,13 +62,13 @@ function onMouseMove(event: MouseEvent) { .tooltip-wrapper { .tooltip { position: fixed; + width: 300px; z-index: 1000; background: #000000; color: #FFFFFF; padding: 4px 8px; border-radius: 4px; font-size: 12px; - white-space: nowrap; pointer-events: none; transition: opacity 0.1s ease; } From 15bfcc45baab76edf7435ec8e39dae0d3009b11e Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Tue, 19 Nov 2024 20:45:19 +0100 Subject: [PATCH 08/17] feat(devtools): wire all settings + sync with local storage --- packages/devtools/src/FDebug.ts | 4 ++++ packages/devtools/src/FDebug3d.ts | 3 +++ packages/devtools/src/State.ts | 23 +++++++++++++++++++ .../src/components/common/DebugPanel.vue | 16 +++++++++---- .../components/common/FComponentHeader.vue | 12 +--------- .../src/components/common/FComponents.vue | 18 +-------------- .../devtools/src/components/common/Tabs.vue | 16 ++----------- .../src/components/common/ToggleButton.vue | 15 ++++++++++-- .../src/components/forms/InputCheckbox.vue | 10 +------- 9 files changed, 60 insertions(+), 57 deletions(-) diff --git a/packages/devtools/src/FDebug.ts b/packages/devtools/src/FDebug.ts index a44ef789..b8b4113c 100644 --- a/packages/devtools/src/FDebug.ts +++ b/packages/devtools/src/FDebug.ts @@ -5,6 +5,7 @@ import type { FScene as FScene3d } from '@fibbojs/3d' import FDebugComponent from './components/FDebug.vue' import { FDebug2d } from './FDebug2d' import { FDebug3d } from './FDebug3d' +import { State } from './State' /** * A helper class to debug a given scene @@ -36,6 +37,9 @@ export class FDebug { // Define the scene this.scene = scene + // Load devtools state from local storage + State.load() + // Fetch the CSS fetch(import.meta.url.replace('index.es.js', 'style.css')) .then(res => res.text()) diff --git a/packages/devtools/src/FDebug3d.ts b/packages/devtools/src/FDebug3d.ts index fc9f7b51..65a0997f 100644 --- a/packages/devtools/src/FDebug3d.ts +++ b/packages/devtools/src/FDebug3d.ts @@ -15,10 +15,12 @@ export class FDebug3d { constructor(scene: FScene) { // Add grid helper const gridHelper = new scene.THREE.GridHelper(10, 10) + gridHelper.visible = State.helpers scene.scene.add(gridHelper) // Axes helper const axesHelper = new scene.THREE.AxesHelper(5) + axesHelper.visible = State.helpers scene.scene.add(axesHelper) /** @@ -40,6 +42,7 @@ export class FDebug3d { helper = new scene.THREE.SpotLightHelper(light.__LIGHT__) else return + helper.visible = State.helpers // Add the helper to the scene scene.scene.add(helper as any) // Add the helper to the list of helpers diff --git a/packages/devtools/src/State.ts b/packages/devtools/src/State.ts index bfc97861..0b7318f7 100644 --- a/packages/devtools/src/State.ts +++ b/packages/devtools/src/State.ts @@ -10,6 +10,26 @@ export class State { private static __CALLBACKS_ON_GLASSMORPHISM_CHANGE__: ((newState: boolean) => void)[] = [] // Methods + static load() { + // Check if the state is stored in the local storage + const state = localStorage.getItem('f-debug-state') + if (state) { + const parsedState = JSON.parse(state) + this.hitboxes = parsedState.hitboxes + this.helpers = parsedState.helpers + this.glassmorphism = parsedState.glassmorphism + } + } + + static store() { + // Store the state in the local storage + localStorage.setItem('f-debug-state', JSON.stringify({ + hitboxes: this.hitboxes, + helpers: this.helpers, + glassmorphism: this.glassmorphism, + })) + } + static onHitboxesChange(callback: (newState: boolean) => void) { this.__CALLBACKS_ON_HITBOXES_CHANGE__.push(callback) } @@ -30,6 +50,7 @@ export class State { static set hitboxes(newState: boolean) { this.__HITBOXES__ = newState this.__CALLBACKS_ON_HITBOXES_CHANGE__.forEach(callback => callback(newState)) + State.store() } static get helpers() { @@ -39,6 +60,7 @@ export class State { static set helpers(newState: boolean) { this.__HELPERS__ = newState this.__CALLBACKS_ON_HELPERS_CHANGE__.forEach(callback => callback(newState)) + State.store() } static get glassmorphism() { @@ -48,5 +70,6 @@ export class State { static set glassmorphism(newState: boolean) { this.__GLASSMORPHISM__ = newState this.__CALLBACKS_ON_GLASSMORPHISM_CHANGE__.forEach(callback => callback(newState)) + State.store() } } diff --git a/packages/devtools/src/components/common/DebugPanel.vue b/packages/devtools/src/components/common/DebugPanel.vue index 83d2fe7b..0863abdc 100644 --- a/packages/devtools/src/components/common/DebugPanel.vue +++ b/packages/devtools/src/components/common/DebugPanel.vue @@ -1,5 +1,5 @@