Use global DFL, fix debug UI component not updating

This commit is contained in:
NGnius (Graham) 2024-01-28 11:01:11 -05:00
parent 88d359e286
commit fa03202f6b
5 changed files with 45 additions and 37 deletions

View file

@ -36,10 +36,10 @@
"rollup-plugin-import-assets": "^1.1.1", "rollup-plugin-import-assets": "^1.1.1",
"shx": "^0.3.4", "shx": "^0.3.4",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"typescript": "^4.9.5" "typescript": "^4.9.5",
"decky-frontend-lib": "~3.24.4"
}, },
"dependencies": { "dependencies": {
"decky-frontend-lib": "~3.24.3",
"react-icons": "^5.0.1", "react-icons": "^5.0.1",
"usdpl-front": "file:src/usdpl_front" "usdpl-front": "file:src/usdpl_front"
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "PowerTools", "name": "PowerTools",
"author": "NGnius", "author": "NGnius",
"flags": ["root", "_debug"], "flags": ["root", "_debug", "global-dfl"],
"publish": { "publish": {
"discord_id": "106537989684887552", "discord_id": "106537989684887552",
"description": "Power tweaks for power users", "description": "Power tweaks for power users",

View file

@ -5,9 +5,6 @@ settings:
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
dependencies: dependencies:
decky-frontend-lib:
specifier: ~3.24.3
version: 3.24.3
react-icons: react-icons:
specifier: ^5.0.1 specifier: ^5.0.1
version: 5.0.1(react@18.2.0) version: 5.0.1(react@18.2.0)
@ -37,6 +34,9 @@ devDependencies:
'@types/webpack': '@types/webpack':
specifier: ^5.28.5 specifier: ^5.28.5
version: 5.28.5 version: 5.28.5
decky-frontend-lib:
specifier: ~3.24.4
version: 3.24.4
rollup: rollup:
specifier: ^2.79.1 specifier: ^2.79.1
version: 2.79.1 version: 2.79.1
@ -198,8 +198,8 @@ packages:
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
dev: true dev: true
/@types/node@20.11.5: /@types/node@20.11.9:
resolution: {integrity: sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==} resolution: {integrity: sha512-CQXNuMoS/VcoAMISe5pm4JnEd1Br5jildbQEToEMQvutmv+EaQr90ry9raiudgpyDuqFiV9e4rnjSfLNq12M5w==}
dependencies: dependencies:
undici-types: 5.26.5 undici-types: 5.26.5
dev: true dev: true
@ -218,15 +218,15 @@ packages:
/@types/resolve@1.17.1: /@types/resolve@1.17.1:
resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==}
dependencies: dependencies:
'@types/node': 20.11.5 '@types/node': 20.11.9
dev: true dev: true
/@types/webpack@5.28.5: /@types/webpack@5.28.5:
resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==} resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==}
dependencies: dependencies:
'@types/node': 20.11.5 '@types/node': 20.11.9
tapable: 2.2.1 tapable: 2.2.1
webpack: 5.89.0 webpack: 5.90.0
transitivePeerDependencies: transitivePeerDependencies:
- '@swc/core' - '@swc/core'
- esbuild - esbuild
@ -390,15 +390,15 @@ packages:
concat-map: 0.0.1 concat-map: 0.0.1
dev: true dev: true
/browserslist@4.22.2: /browserslist@4.22.3:
resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001579 caniuse-lite: 1.0.30001581
electron-to-chromium: 1.4.640 electron-to-chromium: 1.4.648
node-releases: 2.0.14 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 dev: true
/buffer-from@1.1.2: /buffer-from@1.1.2:
@ -410,8 +410,8 @@ packages:
engines: {node: '>=6'} engines: {node: '>=6'}
dev: true dev: true
/caniuse-lite@1.0.30001579: /caniuse-lite@1.0.30001581:
resolution: {integrity: sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==} resolution: {integrity: sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ==}
dev: true dev: true
/chrome-trace-event@1.0.3: /chrome-trace-event@1.0.3:
@ -435,17 +435,17 @@ packages:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
dev: true dev: true
/decky-frontend-lib@3.24.3: /decky-frontend-lib@3.24.4:
resolution: {integrity: sha512-293oUaAgLrezvoz+TOQkarjwAlVlejkelB1WjtxQV4Y5qMpUZhNUtfpQAscGhwg9oQy6UGpZ5urkdPzLiVY52w==} resolution: {integrity: sha512-aCrzVS74V68PQxi5qFS6rjQwWryVy+yYTQKZztXT/T5v1jlw3AKXpTi47pCQl+6TdAIru4hAAjOF8TSf4iONaw==}
dev: false dev: true
/deepmerge@4.3.1: /deepmerge@4.3.1:
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
/electron-to-chromium@1.4.640: /electron-to-chromium@1.4.648:
resolution: {integrity: sha512-z/6oZ/Muqk4BaE7P69bXhUhpJbUM9ZJeka43ZwxsDshKtePns4mhBlh8bU5+yrnOnz3fhG82XLzGUXazOmsWnA==} resolution: {integrity: sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==}
dev: true dev: true
/enhanced-resolve@5.15.0: /enhanced-resolve@5.15.0:
@ -605,7 +605,7 @@ packages:
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
engines: {node: '>= 10.13.0'} engines: {node: '>= 10.13.0'}
dependencies: dependencies:
'@types/node': 20.11.5 '@types/node': 20.11.9
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 8.1.1 supports-color: 8.1.1
dev: true dev: true
@ -836,7 +836,7 @@ packages:
engines: {node: '>=6'} engines: {node: '>=6'}
dev: true 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==} resolution: {integrity: sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==}
engines: {node: '>= 10.13.0'} engines: {node: '>= 10.13.0'}
peerDependencies: peerDependencies:
@ -857,7 +857,7 @@ packages:
schema-utils: 3.3.0 schema-utils: 3.3.0
serialize-javascript: 6.0.2 serialize-javascript: 6.0.2
terser: 5.27.0 terser: 5.27.0
webpack: 5.89.0 webpack: 5.90.0
dev: true dev: true
/terser@5.27.0: /terser@5.27.0:
@ -885,13 +885,13 @@ packages:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: true 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==} resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
browserslist: '>= 4.21.0' browserslist: '>= 4.21.0'
dependencies: dependencies:
browserslist: 4.22.2 browserslist: 4.22.3
escalade: 3.1.1 escalade: 3.1.1
picocolors: 1.0.0 picocolors: 1.0.0
dev: true dev: true
@ -919,8 +919,8 @@ packages:
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
dev: true dev: true
/webpack@5.89.0: /webpack@5.90.0:
resolution: {integrity: sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==} resolution: {integrity: sha512-bdmyXRCXeeNIePv6R6tGPyy20aUobw4Zy8r0LUS2EWO+U+Ke/gYDgsCh7bl5rB6jPpr4r0SZa6dPxBxLooDT3w==}
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -936,7 +936,7 @@ packages:
'@webassemblyjs/wasm-parser': 1.11.6 '@webassemblyjs/wasm-parser': 1.11.6
acorn: 8.11.3 acorn: 8.11.3
acorn-import-assertions: 1.9.0(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 chrome-trace-event: 1.0.3
enhanced-resolve: 5.15.0 enhanced-resolve: 5.15.0
es-module-lexer: 1.4.1 es-module-lexer: 1.4.1
@ -950,7 +950,7 @@ packages:
neo-async: 2.6.2 neo-async: 2.6.2
schema-utils: 3.3.0 schema-utils: 3.3.0
tapable: 2.2.1 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 watchpack: 2.4.0
webpack-sources: 3.2.3 webpack-sources: 3.2.3
transitivePeerDependencies: transitivePeerDependencies:

View file

@ -24,12 +24,13 @@ export default defineConfig({
}) })
], ],
context: 'window', context: 'window',
external: ['react', 'react-dom'], external: ['react', 'react-dom', 'decky-frontend-lib'],
output: { output: {
file: 'dist/index.js', file: 'dist/index.js',
globals: { globals: {
react: 'SP_REACT', react: 'SP_REACT',
'react-dom': 'SP_REACTDOM', 'react-dom': 'SP_REACTDOM',
'decky-frontend-lib': 'DFL',
}, },
format: 'iife', format: 'iife',
exports: 'default', exports: 'default',

View file

@ -22,11 +22,16 @@ let isSpecialDay = now.getDate() == 1 && now.getMonth() == 3;
export class Debug extends Component<backend.IdcProps> { export class Debug extends Component<backend.IdcProps> {
render() { 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 (<Fragment>{/* Version Info */} return (<Fragment>{/* Version Info */}
<div className={staticClasses.PanelSectionTitle}> <div className={staticClasses.PanelSectionTitle}>
{eggCount % 10 == 9 ? "Ha! Nerd" : tr("Debug")} {eggCount % 10 == 9 ? "Ha! Nerd" : tr("Debug")}
@ -41,6 +46,7 @@ function buildDebug() {
Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/PowerTools/releases"); Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/PowerTools/releases");
} }
eggCount++; eggCount++;
reloadGUI("BackendInfo");
}}> }}>
{eggCount % 10 == 9 ? "by NGnius" : get_value(BACKEND_INFO)} {eggCount % 10 == 9 ? "by NGnius" : get_value(BACKEND_INFO)}
</Field> </Field>
@ -48,14 +54,14 @@ function buildDebug() {
<PanelSectionRow> <PanelSectionRow>
<Field <Field
label={tr("Framework")} label={tr("Framework")}
onClick={()=> eggCount++}> onClick={() => {eggCount++; reloadGUI("FrameworkInfo");}}>
{eggCount % 10 == 9 ? "<3 <3 <3" : target_usdpl()} {eggCount % 10 == 9 ? "<3 <3 <3" : target_usdpl()}
</Field> </Field>
</PanelSectionRow> </PanelSectionRow>
<PanelSectionRow> <PanelSectionRow>
<Field <Field
label={ eggCount % 10 == 9 && tr("Driver") == "Driver" ? "Drive" : tr("Driver")} label={ eggCount % 10 == 9 && tr("Driver") == "Driver" ? "Drive" : tr("Driver")}
onClick={()=> eggCount++}> onClick={() => {eggCount++; reloadGUI("DriverInfo");}}>
{eggCount % 10 == 9 ? "Ryan Gosling" : get_value(DRIVER_INFO)} {eggCount % 10 == 9 ? "Ryan Gosling" : get_value(DRIVER_INFO)}
</Field> </Field>
</PanelSectionRow> </PanelSectionRow>
@ -69,6 +75,7 @@ function buildDebug() {
Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/usdpl-rs"); Navigation.NavigateToExternalWeb("https://git.ngni.us/NG-SD-Plugins/usdpl-rs");
} }
eggCount++; eggCount++;
reloadGUI("USDPLInfo");
}}> }}>
v{version_usdpl()} v{version_usdpl()}
</Field> </Field>