@decky/ui 4.7.1 → 4.7.3

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.
@@ -7,8 +7,8 @@ export const DialogCheckbox = Object.values(findModule((m) => {
7
7
  return true;
8
8
  }
9
9
  return false;
10
- })).find((m) => m.contextType &&
11
- m.prototype?.render.toString().includes('fallback:') &&
12
- m?.prototype?.SetChecked &&
10
+ })).find((m) => m?.prototype?.SetChecked &&
13
11
  m?.prototype?.Toggle &&
14
- m?.prototype?.GetPanelElementProps);
12
+ m?.prototype?.GetPanelElementProps &&
13
+ (m?.prototype?.render?.toString().includes('="DialogCheckbox"') || (m.contextType &&
14
+ m.prototype?.render.toString().includes('fallback:'))));
@@ -1,5 +1,5 @@
1
1
  import { findSP } from '../utils';
2
- import { findModule, findModuleByExport, findModuleExport } from '../webpack';
2
+ import { findModule, findModuleDetailsByExport, findModuleExport } from '../webpack';
3
3
  const showModalRaw = findModuleExport((e) => typeof e === 'function' && e.toString().includes('props.bDisableBackgroundDismiss') && !e?.prototype?.Cancel);
4
4
  export const showModal = (modal, parent, props = {
5
5
  strTitle: 'Decky Dialog',
@@ -20,10 +20,10 @@ export const ModalRoot = Object.values(findModule((m) => {
20
20
  }
21
21
  return false;
22
22
  }) || {})?.find((x) => x?.type?.toString()?.includes('((function(){'));
23
- const ModalModule = findModuleByExport((e) => e?.toString().includes('.ModalPosition,fallback:'), 5);
23
+ const [ModalModule, _ModalPosition] = findModuleDetailsByExport((e) => e?.toString().includes('.ModalPosition'), 5);
24
24
  const ModalModuleProps = ModalModule ? Object.values(ModalModule) : [];
25
25
  export const SimpleModal = ModalModuleProps.find((prop) => {
26
26
  const string = prop?.toString();
27
27
  return string?.includes('.ShowPortalModal()') && string?.includes('.OnElementReadyCallbacks.Register(');
28
28
  });
29
- export const ModalPosition = ModalModuleProps.find((prop) => prop?.toString().includes('.ModalPosition,fallback:'));
29
+ export const ModalPosition = _ModalPosition;
@@ -1,2 +1,2 @@
1
1
  import { CommonUIModule } from '../webpack';
2
- export const SliderField = Object.values(CommonUIModule).find((mod) => mod?.toString()?.includes('SliderField,fallback'));
2
+ export const SliderField = Object.values(CommonUIModule).find((mod) => mod?.toString()?.includes('SliderField,fallback') || mod?.toString()?.includes("SliderField\","));
@@ -1,2 +1,2 @@
1
1
  import { CommonUIModule } from '../webpack';
2
- export const ToggleField = Object.values(CommonUIModule).find((mod) => mod?.render?.toString()?.includes('ToggleField,fallback'));
2
+ export const ToggleField = Object.values(CommonUIModule).find((mod) => mod?.render?.toString()?.includes('ToggleField,fallback') || mod?.render?.toString()?.includes("ToggleField\","));
@@ -13,13 +13,13 @@ export function findSP() {
13
13
  if (document.title == 'SP')
14
14
  return window;
15
15
  const navTrees = getGamepadNavigationTrees();
16
- return navTrees?.find((x) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView;
16
+ return navTrees?.find((x) => x.m_ID == 'root_1_')?.Root?.Element?.ownerDocument?.defaultView;
17
17
  }
18
18
  export function getFocusNavController() {
19
19
  return window.GamepadNavTree?.m_context?.m_controller || window.FocusNavController;
20
20
  }
21
21
  export function getGamepadNavigationTrees() {
22
22
  const focusNav = getFocusNavController();
23
- const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
23
+ const context = focusNav?.m_ActiveContext || focusNav?.m_LastActiveContext;
24
24
  return context?.m_rgGamepadNavigationTrees;
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.7.1",
3
+ "version": "4.7.3",
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",
@@ -28,9 +28,12 @@ export const DialogCheckbox = Object.values(
28
28
  }),
29
29
  ).find(
30
30
  (m: any) =>
31
- m.contextType &&
32
- m.prototype?.render.toString().includes('fallback:') &&
33
31
  m?.prototype?.SetChecked &&
34
32
  m?.prototype?.Toggle &&
35
- m?.prototype?.GetPanelElementProps,
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
+ ))
36
39
  ) as FC<DialogCheckboxProps>;
@@ -1,7 +1,7 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
 
3
3
  import { findSP } from '../utils';
4
- import { Export, findModule, findModuleByExport, findModuleExport } from '../webpack';
4
+ import { Export, findModule, findModuleDetailsByExport, findModuleExport } from '../webpack';
5
5
 
6
6
  // All of the popout options + strTitle are related. Proper usage is not yet known...
7
7
  export interface ShowModalProps {
@@ -105,7 +105,7 @@ interface SimpleModalProps {
105
105
  children: ReactNode;
106
106
  }
107
107
 
108
- const ModalModule = findModuleByExport((e: Export) => e?.toString().includes('.ModalPosition,fallback:'), 5);
108
+ const [ModalModule, _ModalPosition] = findModuleDetailsByExport((e: Export) => e?.toString().includes('.ModalPosition'), 5)
109
109
 
110
110
  const ModalModuleProps = ModalModule ? Object.values(ModalModule) : [];
111
111
 
@@ -114,6 +114,4 @@ export const SimpleModal = ModalModuleProps.find((prop) => {
114
114
  return string?.includes('.ShowPortalModal()') && string?.includes('.OnElementReadyCallbacks.Register(');
115
115
  }) as FC<SimpleModalProps>;
116
116
 
117
- export const ModalPosition = ModalModuleProps.find((prop) =>
118
- prop?.toString().includes('.ModalPosition,fallback:'),
119
- ) as FC<SimpleModalProps>;
117
+ export const ModalPosition = _ModalPosition as FC<SimpleModalProps>;
@@ -29,5 +29,6 @@ export interface SliderFieldProps extends ItemProps {
29
29
  }
30
30
 
31
31
  export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
32
- mod?.toString()?.includes('SliderField,fallback'),
32
+ // stable || beta as of oct 2 2024
33
+ mod?.toString()?.includes('SliderField,fallback') || mod?.toString()?.includes("SliderField\",")
33
34
  ) as FC<SliderFieldProps>;
@@ -11,5 +11,6 @@ export interface ToggleFieldProps extends ItemProps {
11
11
  }
12
12
 
13
13
  export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
14
- mod?.render?.toString()?.includes('ToggleField,fallback'),
14
+ // stable || beta as of oct 2 2024
15
+ mod?.render?.toString()?.includes('ToggleField,fallback') || mod?.render?.toString()?.includes("ToggleField\",")
15
16
  ) as FC<ToggleFieldProps>;
@@ -25,7 +25,7 @@ export function findSP(): Window {
25
25
  if (document.title == 'SP') return window;
26
26
  // new (SP as popup)
27
27
  const navTrees = getGamepadNavigationTrees();
28
- return navTrees?.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView;
28
+ return navTrees?.find((x: any) => x.m_ID == 'root_1_')?.Root?.Element?.ownerDocument?.defaultView;
29
29
  }
30
30
 
31
31
  /**
@@ -40,6 +40,6 @@ export function getFocusNavController(): any {
40
40
  */
41
41
  export function getGamepadNavigationTrees(): any {
42
42
  const focusNav = getFocusNavController();
43
- const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
43
+ const context = focusNav?.m_ActiveContext || focusNav?.m_LastActiveContext;
44
44
  return context?.m_rgGamepadNavigationTrees;
45
45
  }