From fa03202f6b4f92196fa645d090f0564c8ef855bd Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sun, 28 Jan 2024 11:01:11 -0500 Subject: [PATCH] Use global DFL, fix debug UI component not updating --- package.json | 4 +-- plugin.json | 2 +- pnpm-lock.yaml | 58 ++++++++++++++++++++-------------------- rollup.config.js | 3 ++- src/components/debug.tsx | 15 ++++++++--- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 433c5b1..7f17bc1 100644 --- a/package.json +++ b/package.json @@ -36,10 +36,10 @@ "rollup-plugin-import-assets": "^1.1.1", "shx": "^0.3.4", "tslib": "^2.6.2", - "typescript": "^4.9.5" + "typescript": "^4.9.5", + "decky-frontend-lib": "~3.24.4" }, "dependencies": { - "decky-frontend-lib": "~3.24.3", "react-icons": "^5.0.1", "usdpl-front": "file:src/usdpl_front" } diff --git a/plugin.json b/plugin.json index fdcb585..2a5ee54 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "PowerTools", "author": "NGnius", - "flags": ["root", "_debug"], + "flags": ["root", "_debug", "global-dfl"], "publish": { "discord_id": "106537989684887552", "description": "Power tweaks for power users", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c87589..c6e3504 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,9 +5,6 @@ settings: excludeLinksFromLockfile: false dependencies: - decky-frontend-lib: - specifier: ~3.24.3 - version: 3.24.3 react-icons: specifier: ^5.0.1 version: 5.0.1(react@18.2.0) @@ -37,6 +34,9 @@ devDependencies: '@types/webpack': specifier: ^5.28.5 version: 5.28.5 + decky-frontend-lib: + specifier: ~3.24.4 + version: 3.24.4 rollup: specifier: ^2.79.1 version: 2.79.1 @@ -198,8 +198,8 @@ packages: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true - /@types/node@20.11.5: - resolution: {integrity: sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==} + /@types/node@20.11.9: + resolution: {integrity: sha512-CQXNuMoS/VcoAMISe5pm4JnEd1Br5jildbQEToEMQvutmv+EaQr90ry9raiudgpyDuqFiV9e4rnjSfLNq12M5w==} dependencies: undici-types: 5.26.5 dev: true @@ -218,15 +218,15 @@ packages: /@types/resolve@1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.11.9 dev: true /@types/webpack@5.28.5: resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.11.9 tapable: 2.2.1 - webpack: 5.89.0 + webpack: 5.90.0 transitivePeerDependencies: - '@swc/core' - esbuild @@ -390,15 +390,15 @@ packages: concat-map: 0.0.1 dev: true - /browserslist@4.22.2: - resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} + /browserslist@4.22.3: + resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001579 - electron-to-chromium: 1.4.640 + caniuse-lite: 1.0.30001581 + electron-to-chromium: 1.4.648 node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.22.2) + update-browserslist-db: 1.0.13(browserslist@4.22.3) dev: true /buffer-from@1.1.2: @@ -410,8 +410,8 @@ packages: engines: {node: '>=6'} dev: true - /caniuse-lite@1.0.30001579: - resolution: {integrity: sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==} + /caniuse-lite@1.0.30001581: + resolution: {integrity: sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ==} dev: true /chrome-trace-event@1.0.3: @@ -435,17 +435,17 @@ packages: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} dev: true - /decky-frontend-lib@3.24.3: - resolution: {integrity: sha512-293oUaAgLrezvoz+TOQkarjwAlVlejkelB1WjtxQV4Y5qMpUZhNUtfpQAscGhwg9oQy6UGpZ5urkdPzLiVY52w==} - dev: false + /decky-frontend-lib@3.24.4: + resolution: {integrity: sha512-aCrzVS74V68PQxi5qFS6rjQwWryVy+yYTQKZztXT/T5v1jlw3AKXpTi47pCQl+6TdAIru4hAAjOF8TSf4iONaw==} + dev: true /deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} dev: true - /electron-to-chromium@1.4.640: - resolution: {integrity: sha512-z/6oZ/Muqk4BaE7P69bXhUhpJbUM9ZJeka43ZwxsDshKtePns4mhBlh8bU5+yrnOnz3fhG82XLzGUXazOmsWnA==} + /electron-to-chromium@1.4.648: + resolution: {integrity: sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==} dev: true /enhanced-resolve@5.15.0: @@ -605,7 +605,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.11.5 + '@types/node': 20.11.9 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -836,7 +836,7 @@ packages: engines: {node: '>=6'} dev: true - /terser-webpack-plugin@5.3.10(webpack@5.89.0): + /terser-webpack-plugin@5.3.10(webpack@5.90.0): resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -857,7 +857,7 @@ packages: schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.27.0 - webpack: 5.89.0 + webpack: 5.90.0 dev: true /terser@5.27.0: @@ -885,13 +885,13 @@ packages: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true - /update-browserslist-db@1.0.13(browserslist@4.22.2): + /update-browserslist-db@1.0.13(browserslist@4.22.3): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.22.2 + browserslist: 4.22.3 escalade: 3.1.1 picocolors: 1.0.0 dev: true @@ -919,8 +919,8 @@ packages: engines: {node: '>=10.13.0'} dev: true - /webpack@5.89.0: - resolution: {integrity: sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==} + /webpack@5.90.0: + resolution: {integrity: sha512-bdmyXRCXeeNIePv6R6tGPyy20aUobw4Zy8r0LUS2EWO+U+Ke/gYDgsCh7bl5rB6jPpr4r0SZa6dPxBxLooDT3w==} engines: {node: '>=10.13.0'} hasBin: true peerDependencies: @@ -936,7 +936,7 @@ packages: '@webassemblyjs/wasm-parser': 1.11.6 acorn: 8.11.3 acorn-import-assertions: 1.9.0(acorn@8.11.3) - browserslist: 4.22.2 + browserslist: 4.22.3 chrome-trace-event: 1.0.3 enhanced-resolve: 5.15.0 es-module-lexer: 1.4.1 @@ -950,7 +950,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(webpack@5.89.0) + terser-webpack-plugin: 5.3.10(webpack@5.90.0) watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/rollup.config.js b/rollup.config.js index 8717908..3b2e789 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -24,12 +24,13 @@ export default defineConfig({ }) ], context: 'window', - external: ['react', 'react-dom'], + external: ['react', 'react-dom', 'decky-frontend-lib'], output: { file: 'dist/index.js', globals: { react: 'SP_REACT', 'react-dom': 'SP_REACTDOM', + 'decky-frontend-lib': 'DFL', }, format: 'iife', exports: 'default', diff --git a/src/components/debug.tsx b/src/components/debug.tsx index 69b6ffd..e41d8ac 100644 --- a/src/components/debug.tsx +++ b/src/components/debug.tsx @@ -22,11 +22,16 @@ let isSpecialDay = now.getDate() == 1 && now.getMonth() == 3; export class Debug extends Component { render() { - return buildDebug(); + const reloadGUI = (x: string) => this.setState((_state) => { + return { + reloadThingy: x, + }; + }); + return buildDebug(reloadGUI); } } -function buildDebug() { +function buildDebug(reloadGUI: (x: string) => void) { return ({/* Version Info */}
{eggCount % 10 == 9 ? "Ha! Nerd" : tr("Debug")} @@ -41,6 +46,7 @@ function buildDebug() { Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/PowerTools/releases"); } eggCount++; + reloadGUI("BackendInfo"); }}> {eggCount % 10 == 9 ? "by NGnius" : get_value(BACKEND_INFO)} @@ -48,14 +54,14 @@ function buildDebug() { eggCount++}> + onClick={() => {eggCount++; reloadGUI("FrameworkInfo");}}> {eggCount % 10 == 9 ? "<3 <3 <3" : target_usdpl()} eggCount++}> + onClick={() => {eggCount++; reloadGUI("DriverInfo");}}> {eggCount % 10 == 9 ? "Ryan Gosling" : get_value(DRIVER_INFO)} @@ -69,6 +75,7 @@ function buildDebug() { Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/usdpl-rs"); } eggCount++; + reloadGUI("USDPLInfo"); }}> v{version_usdpl()}