@decky/ui 4.7.3 → 4.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,7 @@
1
- import { findModule } from '../webpack';
2
- export const DialogCheckbox = Object.values(findModule((m) => {
3
- if (typeof m !== 'object')
4
- return false;
5
- for (const prop in m) {
6
- if (m[prop]?.prototype?.GetPanelElementProps)
7
- return true;
8
- }
9
- return false;
10
- })).find((m) => m?.prototype?.SetChecked &&
11
- m?.prototype?.Toggle &&
12
- m?.prototype?.GetPanelElementProps &&
13
- (m?.prototype?.render?.toString().includes('="DialogCheckbox"') || (m.contextType &&
14
- m.prototype?.render.toString().includes('fallback:'))));
1
+ import { findModuleExport } from '../webpack';
2
+ export const DialogCheckbox = findModuleExport(e => e.prototype &&
3
+ "GetPanelElementProps" in e?.prototype &&
4
+ "SetChecked" in e?.prototype &&
5
+ "Toggle" in e?.prototype &&
6
+ (e?.prototype?.render?.toString().includes('="DialogCheckbox"') || (e.contextType &&
7
+ e.prototype?.render?.toString().includes('fallback:'))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.7.3",
3
+ "version": "4.7.4",
4
4
  "description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
 
3
- import { findModule } from '../webpack';
3
+ import { findModuleExport } from '../webpack';
4
4
  import { DialogCommonProps } from './Dialog';
5
5
  import { FooterLegendProps } from './FooterLegend';
6
6
 
@@ -18,22 +18,15 @@ export interface DialogCheckboxProps extends DialogCommonProps, FooterLegendProp
18
18
  onClick?(evt: Event): void;
19
19
  }
20
20
 
21
- export const DialogCheckbox = Object.values(
22
- findModule((m: any) => {
23
- if (typeof m !== 'object') return false;
24
- for (const prop in m) {
25
- if (m[prop]?.prototype?.GetPanelElementProps) return true;
26
- }
27
- return false;
28
- }),
29
- ).find(
30
- (m: any) =>
31
- m?.prototype?.SetChecked &&
32
- m?.prototype?.Toggle &&
33
- m?.prototype?.GetPanelElementProps &&
34
- // beta || stable as of oct 2 2024
35
- (m?.prototype?.render?.toString().includes('="DialogCheckbox"') || (
36
- m.contextType &&
37
- m.prototype?.render.toString().includes('fallback:')
38
- ))
21
+ // Do not access KeyDown, SetChecked, Toggle here as they are getters and accessing them outside of a render breaks them globally
22
+ export const DialogCheckbox = findModuleExport(e =>
23
+ e.prototype &&
24
+ "GetPanelElementProps" in e?.prototype &&
25
+ "SetChecked" in e?.prototype &&
26
+ "Toggle" in e?.prototype &&
27
+ // beta || stable as of oct 2 2024
28
+ (e?.prototype?.render?.toString().includes('="DialogCheckbox"') || (
29
+ e.contextType &&
30
+ e.prototype?.render?.toString().includes('fallback:')
31
+ ))
39
32
  ) as FC<DialogCheckboxProps>;