@decky/ui 4.10.5 → 4.11.0

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,4 +1,2 @@
1
- import { FC } from "react";
2
- export declare const ErrorBoundary: FC<{
3
- children?: import("react").ReactNode;
4
- }>;
1
+ import { FC, PropsWithChildren } from "react";
2
+ export declare const ErrorBoundary: FC<PropsWithChildren>;
@@ -1,4 +1,4 @@
1
1
  import { findModuleExport } from '../webpack';
2
2
  import { createPropListRegex } from '../utils';
3
3
  const focusableRegex = createPropListRegex(["flow-children", "onActivate", "onCancel", "focusClassName", "focusWithinClassName"]);
4
- export const Focusable = findModuleExport((e) => e?.render?.toString && focusableRegex.test(e.render.toString()));
4
+ export const Focusable = findModuleExport((e) => (typeof e == 'function' && e?.toString && focusableRegex.test(e.toString())) || (e?.render?.toString && focusableRegex.test(e.render.toString())));
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  import { useState } from 'react';
2
3
  import { ConfirmModal, SliderField } from '../components';
3
4
  import { gamepadSliderClasses } from '../utils/static-classes';
@@ -12,11 +13,10 @@ export const ColorPickerModal = ({ closeModal, onConfirm = () => { }, title = 'C
12
13
  '--decky-color-picker-lvalue': `${L}%`,
13
14
  '--decky-color-picker-avalue': `${A}`,
14
15
  };
15
- return (window.SP_REACT.createElement(ConfirmModal, { bAllowFullSize: true, onCancel: closeModal, onOK: () => {
16
+ return (_jsxs(ConfirmModal, { bAllowFullSize: true, onCancel: closeModal, onOK: () => {
16
17
  onConfirm(`hsla(${H}, ${S}%, ${L}%, ${A})`);
17
18
  closeModal();
18
- } },
19
- window.SP_REACT.createElement("style", null, `
19
+ }, children: [_jsx("style", { children: `
20
20
  /* This removes the cyan track color that is behind the slider head */
21
21
  .ColorPicker_Container .${gamepadSliderClasses.SliderTrack} {
22
22
  --left-track-color: #0000;
@@ -59,29 +59,15 @@ export const ColorPickerModal = ({ closeModal, onConfirm = () => { }, title = 'C
59
59
  hsla(var(--decky-color-picker-hvalue), var(--decky-color-picker-svalue), var(--decky-color-picker-lvalue), 1)
60
60
  );
61
61
  }
62
- `),
63
- window.SP_REACT.createElement("div", { className: "ColorPicker_ColorDisplayContainer", style: {
64
- display: 'flex',
65
- justifyContent: 'space-between',
66
- alignItems: 'center',
67
- marginBottom: '1em',
68
- marginTop: '-2.5em',
69
- } },
70
- window.SP_REACT.createElement("div", null,
71
- window.SP_REACT.createElement("span", { style: { fontSize: '1.5em' } },
72
- window.SP_REACT.createElement("b", null, title))),
73
- window.SP_REACT.createElement("div", { style: {
74
- backgroundColor: `hsla(${H}, ${S}%, ${L}%, ${A})`,
75
- width: '40px',
76
- height: '40px',
77
- } })),
78
- window.SP_REACT.createElement("div", { className: "ColorPicker_Container", style: colorPickerCSSVars },
79
- window.SP_REACT.createElement("div", { className: "ColorPicker_HSlider" },
80
- window.SP_REACT.createElement(SliderField, { showValue: true, editableValue: true, label: "Hue", value: H, min: 0, max: 360, onChange: setH })),
81
- window.SP_REACT.createElement("div", { className: "ColorPicker_SSlider" },
82
- window.SP_REACT.createElement(SliderField, { showValue: true, editableValue: true, label: "Saturation", value: S, min: 0, max: 100, onChange: setS })),
83
- window.SP_REACT.createElement("div", { className: "ColorPicker_LSlider" },
84
- window.SP_REACT.createElement(SliderField, { showValue: true, editableValue: true, label: "Lightness", value: L, min: 0, max: 100, onChange: setL })),
85
- window.SP_REACT.createElement("div", { className: "ColorPicker_ASlider" },
86
- window.SP_REACT.createElement(SliderField, { showValue: true, editableValue: true, label: "Alpha", value: A, step: 0.1, min: 0, max: 1, onChange: setA })))));
62
+ ` }), _jsxs("div", { className: "ColorPicker_ColorDisplayContainer", style: {
63
+ display: 'flex',
64
+ justifyContent: 'space-between',
65
+ alignItems: 'center',
66
+ marginBottom: '1em',
67
+ marginTop: '-2.5em',
68
+ }, children: [_jsx("div", { children: _jsx("span", { style: { fontSize: '1.5em' }, children: _jsx("b", { children: title }) }) }), _jsx("div", { style: {
69
+ backgroundColor: `hsla(${H}, ${S}%, ${L}%, ${A})`,
70
+ width: '40px',
71
+ height: '40px',
72
+ } })] }), _jsxs("div", { className: "ColorPicker_Container", style: colorPickerCSSVars, children: [_jsx("div", { className: "ColorPicker_HSlider", children: _jsx(SliderField, { showValue: true, editableValue: true, label: "Hue", value: H, min: 0, max: 360, onChange: setH }) }), _jsx("div", { className: "ColorPicker_SSlider", children: _jsx(SliderField, { showValue: true, editableValue: true, label: "Saturation", value: S, min: 0, max: 100, onChange: setS }) }), _jsx("div", { className: "ColorPicker_LSlider", children: _jsx(SliderField, { showValue: true, editableValue: true, label: "Lightness", value: L, min: 0, max: 100, onChange: setL }) }), _jsx("div", { className: "ColorPicker_ASlider", children: _jsx(SliderField, { showValue: true, editableValue: true, label: "Alpha", value: A, step: 0.1, min: 0, max: 1, onChange: setA }) })] })] }));
87
73
  };
@@ -14,7 +14,7 @@ export type ReorderableListProps<T> = {
14
14
  fieldProps?: FieldProps;
15
15
  animate?: boolean;
16
16
  };
17
- export declare function ReorderableList<T>(props: ReorderableListProps<T>): JSX.Element;
17
+ export declare function ReorderableList<T>(props: ReorderableListProps<T>): import("react/jsx-runtime").JSX.Element;
18
18
  export type ReorderableListEntryProps<T> = {
19
19
  fieldProps?: FieldProps;
20
20
  listData: ReorderableEntry<T>[];
@@ -22,5 +22,5 @@ export type ReorderableListEntryProps<T> = {
22
22
  reorderEntryFunc: CallableFunction;
23
23
  reorderEnabled: boolean;
24
24
  animate: boolean;
25
- children: ReactElement | null;
25
+ children: ReactElement<any> | null;
26
26
  };
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { Fragment, useEffect, useState } from 'react';
2
3
  import { Field, Focusable, GamepadButton } from '../components';
3
4
  export function ReorderableList(props) {
@@ -22,8 +23,7 @@ export function ReorderableList(props) {
22
23
  props.onSave(entryList);
23
24
  }
24
25
  }
25
- return (window.SP_REACT.createElement(Fragment, null,
26
- window.SP_REACT.createElement("div", { style: {
26
+ return (_jsx(Fragment, { children: _jsx("div", { style: {
27
27
  width: 'inherit',
28
28
  height: 'inherit',
29
29
  flex: '1 1 1px',
@@ -32,8 +32,7 @@ export function ReorderableList(props) {
32
32
  flexDirection: 'column',
33
33
  justifyContent: 'flex-start',
34
34
  alignContent: 'stretch',
35
- } },
36
- window.SP_REACT.createElement(Focusable, { onSecondaryButton: toggleReorderEnabled, onSecondaryActionDescription: reorderEnabled ? 'Save Order' : 'Reorder', onClick: toggleReorderEnabled, onButtonDown: saveOnBackout }, entryList.map((entry) => (window.SP_REACT.createElement(ReorderableItem, { animate: props.animate, listData: entryList, entryData: entry, reorderEntryFunc: setEntryList, reorderEnabled: reorderEnabled, fieldProps: props.fieldProps }, props.interactables ? window.SP_REACT.createElement(props.interactables, { entry: entry }) : null)))))));
35
+ }, children: _jsx(Focusable, { onSecondaryButton: toggleReorderEnabled, onSecondaryActionDescription: reorderEnabled ? 'Save Order' : 'Reorder', onClick: toggleReorderEnabled, onButtonDown: saveOnBackout, children: entryList.map((entry) => (_jsx(ReorderableItem, { animate: props.animate, listData: entryList, entryData: entry, reorderEntryFunc: setEntryList, reorderEnabled: reorderEnabled, fieldProps: props.fieldProps, children: props.interactables ? _jsx(props.interactables, { entry: entry }) : null }))) }) }) }));
37
36
  }
38
37
  function ReorderableItem(props) {
39
38
  const [isSelected, _setIsSelected] = useState(false);
@@ -70,7 +69,7 @@ function ReorderableItem(props) {
70
69
  await new Promise((res) => requestAnimationFrame(res));
71
70
  setIsSelectedLastFrame(val);
72
71
  }
73
- return (window.SP_REACT.createElement("div", { style: props.animate
72
+ return (_jsx("div", { style: props.animate
74
73
  ? {
75
74
  transition: isSelected || isSelectedLastFrame
76
75
  ? ''
@@ -78,7 +77,5 @@ function ReorderableItem(props) {
78
77
  transform: !props.reorderEnabled || isSelected ? 'scale(1)' : 'scale(0.9)',
79
78
  opacity: !props.reorderEnabled || isSelected ? 1 : 0.7,
80
79
  }
81
- : {} },
82
- window.SP_REACT.createElement(Field, { label: props.entryData.label, ...props.fieldProps, focusable: !props.children, onButtonDown: onReorder, onGamepadBlur: () => setIsSelected(false), onGamepadFocus: () => setIsSelected(true) },
83
- window.SP_REACT.createElement(Focusable, { style: { display: 'flex', width: '100%', position: 'relative' } }, props.children))));
80
+ : {}, children: _jsx(Field, { label: props.entryData.label, ...props.fieldProps, focusable: !props.children, onButtonDown: onReorder, onGamepadBlur: () => setIsSelected(false), onGamepadFocus: () => setIsSelected(true), children: _jsx(Focusable, { style: { display: 'flex', width: '100%', position: 'relative' }, children: props.children }) }) }));
84
81
  }
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { useEffect } from 'react';
2
3
  import { useState } from 'react';
3
4
  import { Spinner } from '../components';
@@ -16,12 +17,12 @@ export const SuspensefulImage = (props) => {
16
17
  setError(true);
17
18
  });
18
19
  }, [props.src]);
19
- return loading ? (window.SP_REACT.createElement("div", { style: {
20
+ return loading ? (_jsx("div", { style: {
20
21
  width: props.suspenseWidth || props.style?.width,
21
22
  height: props.suspenseHeight || props.style?.height,
22
23
  background: 'rgba(255, 255, 255, 0.2)',
23
24
  display: 'flex',
24
25
  alignItems: 'center',
25
26
  justifyContent: 'center',
26
- } }, error ? 'Missing image' : window.SP_REACT.createElement(Spinner, { style: { height: '48px' } }))) : (window.SP_REACT.createElement("img", { ...props }));
27
+ }, children: error ? 'Missing image' : _jsx(Spinner, { style: { height: '48px' } }) })) : (_jsx("img", { ...props }));
27
28
  };
@@ -38,7 +38,7 @@ export interface Input {
38
38
  RegisterForControllerCommandMessages(callback: (msg: ControllerCommandMessage) => void): Unregisterable;
39
39
  RegisterForControllerConfigCloudStateChanges(callback: (state: ControllerConfigCloudState) => void): Unregisterable;
40
40
  RegisterForControllerConfigInfoMessages(callback: (msgs: ControllerConfigInfoMessageList[] | ControllerConfigInfoMessageQuery[]) => void): Unregisterable;
41
- RegisterForControllerInputMessages(callback: (msgs: ControllerInputMessage[]) => void): Unregisterable;
41
+ RegisterForControllerInputMessages(callback: (controllerIndex: number, gamepadButton: ControllerInputGamepadButton, isButtonPressed: boolean) => void): Unregisterable;
42
42
  RegisterForControllerListChanges(callback: (controllerListChanges: ControllerInfo[]) => void): Unregisterable;
43
43
  RegisterForControllerStateChanges(callback: (changes: ControllerStateChange[]) => void): Unregisterable;
44
44
  RegisterForDualSenseUpdateNotification(callback: (m_strDualSenseUpdateProduct: string) => void): Unregisterable;
@@ -273,16 +273,64 @@ export declare enum EControllerRumbleSetting {
273
273
  Off = 1,
274
274
  On = 2
275
275
  }
276
+ export declare enum ControllerInputGamepadButton {
277
+ GAMEPAD_BUTTON_A = 0,
278
+ GAMEPAD_BUTTON_B = 1,
279
+ GAMEPAD_BUTTON_X = 2,
280
+ GAMEPAD_BUTTON_Y = 3,
281
+ GAMEPAD_BUTTON_DPAD_UP = 4,
282
+ GAMEPAD_BUTTON_DPAD_RIGHT = 5,
283
+ GAMEPAD_BUTTON_DPAD_DOWN = 6,
284
+ GAMEPAD_BUTTON_DPAD_LEFT = 7,
285
+ GAMEPAD_BUTTON_MENU = 8,
286
+ GAMEPAD_BUTTON_VIEW = 9,
287
+ GAMEPAD_LEFTPAD_UP = 10,
288
+ GAMEPAD_LEFTPAD_DOWN = 11,
289
+ GAMEPAD_LEFTPAD_LEFT = 12,
290
+ GAMEPAD_LEFTPAD_RIGHT = 13,
291
+ GAMEPAD_LEFTPAD_ANALOG = 14,
292
+ GAMEPAD_RIGHTPAD_UP = 15,
293
+ GAMEPAD_RIGHTPAD_DOWN = 16,
294
+ GAMEPAD_RIGHTPAD_LEFT = 17,
295
+ GAMEPAD_RIGHTPAD_RIGHT = 18,
296
+ GAMEPAD_RIGHTPAD_ANALOG = 19,
297
+ GAMEPAD_LEFTSTICK_UP = 20,
298
+ GAMEPAD_LEFTSTICK_DOWN = 21,
299
+ GAMEPAD_LEFTSTICK_LEFT = 22,
300
+ GAMEPAD_LEFTSTICK_RIGHT = 23,
301
+ GAMEPAD_LEFTSTICK_ANALOG = 24,
302
+ GAMEPAD_LEFTSTICK_CLICK = 25,
303
+ GAMEPAD_LTRIGGER_ANALOG = 26,
304
+ GAMEPAD_RTRIGGER_ANALOG = 27,
305
+ GAMEPAD_BUTTON_LTRIGGER = 28,
306
+ GAMEPAD_BUTTON_RTRIGGER = 29,
307
+ GAMEPAD_BUTTON_LSHOULDER = 30,
308
+ GAMEPAD_BUTTON_RSHOULDER = 31,
309
+ GAMEPAD_BUTTON_LBACK = 32,
310
+ GAMEPAD_BUTTON_RBACK = 33,
311
+ GAMEPAD_BUTTON_GUIDE = 34,
312
+ GAMEPAD_BUTTON_SELECT = 35,
313
+ GAMEPAD_BUTTON_START = 36,
314
+ GAMEPAD_BUTTON_LPAD_CLICKED = 37,
315
+ GAMEPAD_BUTTON_LPAD_TOUCH = 38,
316
+ GAMEPAD_BUTTON_RPAD_CLICKED = 39,
317
+ GAMEPAD_BUTTON_RPAD_TOUCH = 40,
318
+ GAMEPAD_RIGHTSTICK_CLICK = 41,
319
+ GAMEPAD_RIGHTSTICK_TOUCH = 42,
320
+ GAMEPAD_LEFTSTICK_TOUCH = 43,
321
+ GAMEPAD_BUTTON_LBACK_UPPER = 44,
322
+ GAMEPAD_BUTTON_RBACK_UPPER = 45,
323
+ GAMEPAD_BUTTON_LAST = 46,
324
+ GAMEPAD_ANALOG_SCROLL = 47,
325
+ GAMEPAD_ANALOG_LEFT_KEYBOARD_CURSOR = 48,
326
+ GAMEPAD_ANALOG_RIGHT_KEYBOARD_CURSOR = 49,
327
+ GAMEPAD_ANALOG_LAST = 50
328
+ }
276
329
  export declare enum EThirdPartyControllerConfiguration {
277
330
  Off = 0,
278
331
  DefaultSetting = 1,
279
332
  On = 2
280
333
  }
281
- export interface ControllerInputMessage {
282
- nA: number;
283
- bS: boolean;
284
- nC: number;
285
- }
286
334
  export interface ActiveAccount {
287
335
  strActiveAccountID: string;
288
336
  strName: string;
@@ -131,6 +131,60 @@ export var EControllerRumbleSetting;
131
131
  EControllerRumbleSetting[EControllerRumbleSetting["Off"] = 1] = "Off";
132
132
  EControllerRumbleSetting[EControllerRumbleSetting["On"] = 2] = "On";
133
133
  })(EControllerRumbleSetting || (EControllerRumbleSetting = {}));
134
+ export var ControllerInputGamepadButton;
135
+ (function (ControllerInputGamepadButton) {
136
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_A"] = 0] = "GAMEPAD_BUTTON_A";
137
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_B"] = 1] = "GAMEPAD_BUTTON_B";
138
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_X"] = 2] = "GAMEPAD_BUTTON_X";
139
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_Y"] = 3] = "GAMEPAD_BUTTON_Y";
140
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_DPAD_UP"] = 4] = "GAMEPAD_BUTTON_DPAD_UP";
141
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_DPAD_RIGHT"] = 5] = "GAMEPAD_BUTTON_DPAD_RIGHT";
142
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_DPAD_DOWN"] = 6] = "GAMEPAD_BUTTON_DPAD_DOWN";
143
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_DPAD_LEFT"] = 7] = "GAMEPAD_BUTTON_DPAD_LEFT";
144
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_MENU"] = 8] = "GAMEPAD_BUTTON_MENU";
145
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_VIEW"] = 9] = "GAMEPAD_BUTTON_VIEW";
146
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTPAD_UP"] = 10] = "GAMEPAD_LEFTPAD_UP";
147
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTPAD_DOWN"] = 11] = "GAMEPAD_LEFTPAD_DOWN";
148
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTPAD_LEFT"] = 12] = "GAMEPAD_LEFTPAD_LEFT";
149
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTPAD_RIGHT"] = 13] = "GAMEPAD_LEFTPAD_RIGHT";
150
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTPAD_ANALOG"] = 14] = "GAMEPAD_LEFTPAD_ANALOG";
151
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTPAD_UP"] = 15] = "GAMEPAD_RIGHTPAD_UP";
152
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTPAD_DOWN"] = 16] = "GAMEPAD_RIGHTPAD_DOWN";
153
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTPAD_LEFT"] = 17] = "GAMEPAD_RIGHTPAD_LEFT";
154
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTPAD_RIGHT"] = 18] = "GAMEPAD_RIGHTPAD_RIGHT";
155
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTPAD_ANALOG"] = 19] = "GAMEPAD_RIGHTPAD_ANALOG";
156
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_UP"] = 20] = "GAMEPAD_LEFTSTICK_UP";
157
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_DOWN"] = 21] = "GAMEPAD_LEFTSTICK_DOWN";
158
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_LEFT"] = 22] = "GAMEPAD_LEFTSTICK_LEFT";
159
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_RIGHT"] = 23] = "GAMEPAD_LEFTSTICK_RIGHT";
160
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_ANALOG"] = 24] = "GAMEPAD_LEFTSTICK_ANALOG";
161
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_CLICK"] = 25] = "GAMEPAD_LEFTSTICK_CLICK";
162
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LTRIGGER_ANALOG"] = 26] = "GAMEPAD_LTRIGGER_ANALOG";
163
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RTRIGGER_ANALOG"] = 27] = "GAMEPAD_RTRIGGER_ANALOG";
164
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LTRIGGER"] = 28] = "GAMEPAD_BUTTON_LTRIGGER";
165
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RTRIGGER"] = 29] = "GAMEPAD_BUTTON_RTRIGGER";
166
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LSHOULDER"] = 30] = "GAMEPAD_BUTTON_LSHOULDER";
167
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RSHOULDER"] = 31] = "GAMEPAD_BUTTON_RSHOULDER";
168
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LBACK"] = 32] = "GAMEPAD_BUTTON_LBACK";
169
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RBACK"] = 33] = "GAMEPAD_BUTTON_RBACK";
170
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_GUIDE"] = 34] = "GAMEPAD_BUTTON_GUIDE";
171
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_SELECT"] = 35] = "GAMEPAD_BUTTON_SELECT";
172
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_START"] = 36] = "GAMEPAD_BUTTON_START";
173
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LPAD_CLICKED"] = 37] = "GAMEPAD_BUTTON_LPAD_CLICKED";
174
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LPAD_TOUCH"] = 38] = "GAMEPAD_BUTTON_LPAD_TOUCH";
175
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RPAD_CLICKED"] = 39] = "GAMEPAD_BUTTON_RPAD_CLICKED";
176
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RPAD_TOUCH"] = 40] = "GAMEPAD_BUTTON_RPAD_TOUCH";
177
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTSTICK_CLICK"] = 41] = "GAMEPAD_RIGHTSTICK_CLICK";
178
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_RIGHTSTICK_TOUCH"] = 42] = "GAMEPAD_RIGHTSTICK_TOUCH";
179
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_LEFTSTICK_TOUCH"] = 43] = "GAMEPAD_LEFTSTICK_TOUCH";
180
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LBACK_UPPER"] = 44] = "GAMEPAD_BUTTON_LBACK_UPPER";
181
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_RBACK_UPPER"] = 45] = "GAMEPAD_BUTTON_RBACK_UPPER";
182
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_BUTTON_LAST"] = 46] = "GAMEPAD_BUTTON_LAST";
183
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_ANALOG_SCROLL"] = 47] = "GAMEPAD_ANALOG_SCROLL";
184
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_ANALOG_LEFT_KEYBOARD_CURSOR"] = 48] = "GAMEPAD_ANALOG_LEFT_KEYBOARD_CURSOR";
185
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_ANALOG_RIGHT_KEYBOARD_CURSOR"] = 49] = "GAMEPAD_ANALOG_RIGHT_KEYBOARD_CURSOR";
186
+ ControllerInputGamepadButton[ControllerInputGamepadButton["GAMEPAD_ANALOG_LAST"] = 50] = "GAMEPAD_ANALOG_LAST";
187
+ })(ControllerInputGamepadButton || (ControllerInputGamepadButton = {}));
134
188
  export var EThirdPartyControllerConfiguration;
135
189
  (function (EThirdPartyControllerConfiguration) {
136
190
  EThirdPartyControllerConfiguration[EThirdPartyControllerConfiguration["Off"] = 0] = "Off";
@@ -0,0 +1 @@
1
+ {"root":["../src/class-mapper.ts","../src/index.ts","../src/logger.ts","../src/webpack.ts","../src/components/Button.ts","../src/components/ButtonItem.ts","../src/components/Carousel.ts","../src/components/ControlsList.ts","../src/components/Dialog.ts","../src/components/DialogCheckbox.ts","../src/components/Dropdown.ts","../src/components/ErrorBoundary.ts","../src/components/Field.ts","../src/components/FocusRing.ts","../src/components/Focusable.ts","../src/components/FooterLegend.ts","../src/components/Item.ts","../src/components/Marquee.ts","../src/components/Menu.ts","../src/components/Modal.ts","../src/components/Panel.ts","../src/components/ProgressBar.ts","../src/components/Scroll.ts","../src/components/SidebarNavigation.ts","../src/components/SliderField.ts","../src/components/Spinner.ts","../src/components/SteamSpinner.ts","../src/components/Tabs.tsx","../src/components/TextField.ts","../src/components/Toggle.ts","../src/components/ToggleField.ts","../src/components/index.ts","../src/custom-components/ColorPickerModal.tsx","../src/custom-components/ReorderableList.tsx","../src/custom-components/SuspensefulImage.tsx","../src/custom-components/index.ts","../src/custom-hooks/index.ts","../src/custom-hooks/useQuickAccessVisible.ts","../src/deck-hooks/index.ts","../src/deck-hooks/useParams.ts","../src/globals/SteamClient.ts","../src/globals/index.ts","../src/globals/stores.ts","../src/globals/steam-client/App.ts","../src/globals/steam-client/Auth.ts","../src/globals/steam-client/Broadcast.ts","../src/globals/steam-client/Browser.ts","../src/globals/steam-client/ClientNotifications.ts","../src/globals/steam-client/Cloud.ts","../src/globals/steam-client/CommunityItems.ts","../src/globals/steam-client/Console.ts","../src/globals/steam-client/Customization.ts","../src/globals/steam-client/Downloads.ts","../src/globals/steam-client/FamilySharing.ts","../src/globals/steam-client/FriendSettings.ts","../src/globals/steam-client/Friends.ts","../src/globals/steam-client/GameNotes.ts","../src/globals/steam-client/GameRecording.ts","../src/globals/steam-client/GameSessions.ts","../src/globals/steam-client/Input.ts","../src/globals/steam-client/InstallFolder.ts","../src/globals/steam-client/Installs.ts","../src/globals/steam-client/Messaging.ts","../src/globals/steam-client/Music.ts","../src/globals/steam-client/Notifications.ts","../src/globals/steam-client/OpenVR.ts","../src/globals/steam-client/Overlay.ts","../src/globals/steam-client/Parental.ts","../src/globals/steam-client/RemotePlay.ts","../src/globals/steam-client/Screenshots.ts","../src/globals/steam-client/ServerBrowser.ts","../src/globals/steam-client/Settings.ts","../src/globals/steam-client/SharedConnection.ts","../src/globals/steam-client/Stats.ts","../src/globals/steam-client/SteamChina.ts","../src/globals/steam-client/Storage.ts","../src/globals/steam-client/Streaming.ts","../src/globals/steam-client/UI.ts","../src/globals/steam-client/URL.ts","../src/globals/steam-client/Updates.ts","../src/globals/steam-client/User.ts","../src/globals/steam-client/WebChat.ts","../src/globals/steam-client/WebUITransport.ts","../src/globals/steam-client/Window.ts","../src/globals/steam-client/index.ts","../src/globals/steam-client/shared.ts","../src/globals/steam-client/browser-view/BrowserViewPopup.ts","../src/globals/steam-client/browser-view/index.ts","../src/globals/steam-client/system/Audio.ts","../src/globals/steam-client/system/AudioDevice.ts","../src/globals/steam-client/system/Bluetooth.ts","../src/globals/steam-client/system/Devkit.ts","../src/globals/steam-client/system/Display.ts","../src/globals/steam-client/system/DisplayManager.ts","../src/globals/steam-client/system/Dock.ts","../src/globals/steam-client/system/Perf.ts","../src/globals/steam-client/system/Report.ts","../src/globals/steam-client/system/UI.ts","../src/globals/steam-client/system/index.ts","../src/globals/steam-client/system/network/Device.ts","../src/globals/steam-client/system/network/index.ts","../src/modules/Router.ts","../src/modules/index.ts","../src/utils/index.ts","../src/utils/patcher.ts","../src/utils/static-classes.ts","../src/utils/react/fc.ts","../src/utils/react/react.ts","../src/utils/react/treepatcher.ts"],"version":"5.9.2"}
@@ -39,66 +39,136 @@ export function injectFCTrampoline(component, customHooks) {
39
39
  }
40
40
  };
41
41
  let renderHookStep = 0;
42
- Object.defineProperty(component, "contextType", {
43
- configurable: true,
44
- get: function () {
45
- loggingEnabled && logger.debug("get contexttype", this, stubsApplied, renderHookStep);
46
- loggingEnabled && console.trace("contextType trace");
47
- if (renderHookStep == 0)
48
- renderHookStep = 1;
49
- else if (renderHookStep == 3)
50
- renderHookStep = 4;
51
- return this._contextType;
52
- },
53
- set: function (value) {
54
- this._contextType = value;
55
- }
56
- });
57
- Object.defineProperty(component, "contextTypes", {
58
- configurable: true,
59
- get: function () {
60
- loggingEnabled && logger.debug("get contexttypes", this, stubsApplied, renderHookStep);
61
- loggingEnabled && console.trace("contextTypes trace");
62
- if (renderHookStep == 1) {
63
- renderHookStep = 2;
64
- applyStubsIfNeeded();
42
+ if (window.SP_REACTDOM.version.startsWith("19.")) {
43
+ Object.defineProperty(component, "contextType", {
44
+ configurable: true,
45
+ get: function () {
46
+ loggingEnabled && logger.debug("get contexttype", this, this._contextType, stubsApplied, renderHookStep);
47
+ loggingEnabled && console.trace("contextType trace");
48
+ if (renderHookStep == 0) {
49
+ renderHookStep = 1;
50
+ }
51
+ if (this._contextType == null) {
52
+ this._contextType = {};
53
+ }
54
+ if (!this._contextType.appliedCurrentValueHook) {
55
+ logger.debug("applied currentvalue hook");
56
+ this._contextType.appliedCurrentValueHook = true;
57
+ Object.defineProperty(this._contextType, "_currentValue", {
58
+ configurable: true,
59
+ get: function () {
60
+ loggingEnabled && logger.debug("get currentValue", this, stubsApplied, renderHookStep);
61
+ loggingEnabled && console.trace("currentValue trace");
62
+ if (renderHookStep == 1) {
63
+ renderHookStep = 2;
64
+ applyStubsIfNeeded();
65
+ }
66
+ return this.__currentValue;
67
+ },
68
+ set: function (value) {
69
+ return this.__currentValue = value;
70
+ }
71
+ });
72
+ }
73
+ return this._contextType;
74
+ },
75
+ set: function (value) {
76
+ this._contextType = value;
65
77
  }
66
- ;
67
- return this._contextTypes;
68
- },
69
- set: function (value) {
70
- this._contextTypes = value;
71
- }
72
- });
73
- Object.defineProperty(component.prototype, "updater", {
74
- configurable: true,
75
- get: function () {
76
- return this._updater;
77
- },
78
- set: function (value) {
79
- loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
80
- loggingEnabled && console.trace("updater trace");
81
- if (renderHookStep == 2) {
82
- renderHookStep = 0;
83
- removeStubsIfNeeded();
78
+ });
79
+ Object.defineProperty(component.prototype, "updater", {
80
+ configurable: true,
81
+ get: function () {
82
+ return this._updater;
83
+ },
84
+ set: function (value) {
85
+ loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
86
+ loggingEnabled && console.trace("updater trace");
87
+ if (renderHookStep == 1 || renderHookStep == 2) {
88
+ renderHookStep = 0;
89
+ removeStubsIfNeeded();
90
+ }
91
+ return this._updater = value;
84
92
  }
85
- return this._updater = value;
86
- }
87
- });
88
- Object.defineProperty(component, "getDerivedStateFromProps", {
89
- configurable: true,
90
- get: function () {
91
- loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
92
- loggingEnabled && console.trace("getDerivedStateFromProps trace");
93
- if (renderHookStep == 2) {
94
- renderHookStep = 0;
95
- removeStubsIfNeeded();
93
+ });
94
+ Object.defineProperty(component, "getDerivedStateFromProps", {
95
+ configurable: true,
96
+ get: function () {
97
+ loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
98
+ loggingEnabled && console.trace("getDerivedStateFromProps trace");
99
+ if (renderHookStep == 1 || renderHookStep == 2) {
100
+ renderHookStep = 0;
101
+ removeStubsIfNeeded();
102
+ }
103
+ return this._getDerivedStateFromProps;
104
+ },
105
+ set: function (value) {
106
+ this._getDerivedStateFromProps = value;
96
107
  }
97
- return this._getDerivedStateFromProps;
98
- },
99
- set: function (value) {
100
- this._getDerivedStateFromProps = value;
101
- }
102
- });
108
+ });
109
+ }
110
+ else if (window.SP_REACTDOM.version.startsWith("18.")) {
111
+ Object.defineProperty(component, "contextType", {
112
+ configurable: true,
113
+ get: function () {
114
+ loggingEnabled && logger.debug("get contexttype", this, stubsApplied, renderHookStep);
115
+ loggingEnabled && console.trace("contextType trace");
116
+ if (renderHookStep == 0)
117
+ renderHookStep = 1;
118
+ else if (renderHookStep == 3)
119
+ renderHookStep = 4;
120
+ return this._contextType;
121
+ },
122
+ set: function (value) {
123
+ this._contextType = value;
124
+ }
125
+ });
126
+ Object.defineProperty(component, "contextTypes", {
127
+ configurable: true,
128
+ get: function () {
129
+ loggingEnabled && logger.debug("get contexttypes", this, stubsApplied, renderHookStep);
130
+ loggingEnabled && console.trace("contextTypes trace");
131
+ if (renderHookStep == 1) {
132
+ renderHookStep = 2;
133
+ applyStubsIfNeeded();
134
+ }
135
+ ;
136
+ return this._contextTypes;
137
+ },
138
+ set: function (value) {
139
+ this._contextTypes = value;
140
+ }
141
+ });
142
+ Object.defineProperty(component.prototype, "updater", {
143
+ configurable: true,
144
+ get: function () {
145
+ return this._updater;
146
+ },
147
+ set: function (value) {
148
+ loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
149
+ loggingEnabled && console.trace("updater trace");
150
+ if (renderHookStep == 2) {
151
+ renderHookStep = 0;
152
+ removeStubsIfNeeded();
153
+ }
154
+ return this._updater = value;
155
+ }
156
+ });
157
+ Object.defineProperty(component, "getDerivedStateFromProps", {
158
+ configurable: true,
159
+ get: function () {
160
+ loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
161
+ loggingEnabled && console.trace("getDerivedStateFromProps trace");
162
+ if (renderHookStep == 2) {
163
+ renderHookStep = 0;
164
+ removeStubsIfNeeded();
165
+ }
166
+ return this._getDerivedStateFromProps;
167
+ },
168
+ set: function (value) {
169
+ this._getDerivedStateFromProps = value;
170
+ }
171
+ });
172
+ }
103
173
  return userComponent;
104
174
  }
@@ -1,11 +1,16 @@
1
- import * as React from 'react';
1
+ import type * as React from 'react';
2
+ import type * as ReactDOM from 'react-dom';
3
+ import type * as JSXRuntime from 'react/jsx-runtime';
2
4
  import { Ref } from 'react';
3
5
  declare global {
4
6
  interface Window {
5
7
  SP_REACT: typeof React;
8
+ SP_REACTDOM: typeof ReactDOM;
9
+ SP_JSX: typeof JSXRuntime;
6
10
  }
7
11
  }
8
12
  export declare function createPropListRegex(propList: string[], fromStart?: boolean): RegExp;
13
+ export declare let INTERNAL_HOOKS: any;
9
14
  export declare function applyHookStubs(customHooks?: any): any;
10
15
  export declare function removeHookStubs(): void;
11
16
  export declare function fakeRenderComponent(fun: Function, customHooks?: any): any;
@@ -14,9 +14,10 @@ export function createPropListRegex(propList, fromStart = true) {
14
14
  return new RegExp(regexString);
15
15
  }
16
16
  let oldHooks = {};
17
+ export let INTERNAL_HOOKS = window.SP_REACT?.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher
18
+ .current || Object.values(window.SP_REACT?.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE).find((p) => p?.useEffect);
17
19
  export function applyHookStubs(customHooks = {}) {
18
- const hooks = window.SP_REACT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher
19
- .current;
20
+ const hooks = INTERNAL_HOOKS;
20
21
  oldHooks = {
21
22
  useContext: hooks.useContext,
22
23
  useCallback: hooks.useCallback,
@@ -27,7 +28,7 @@ export function applyHookStubs(customHooks = {}) {
27
28
  useState: hooks.useState,
28
29
  };
29
30
  hooks.useCallback = (cb) => cb;
30
- hooks.useContext = (cb) => cb._currentValue;
31
+ hooks.useContext = (cb) => cb?._currentValue;
31
32
  hooks.useLayoutEffect = (_) => { };
32
33
  hooks.useMemo = (cb, _) => cb;
33
34
  hooks.useEffect = (_) => { };
@@ -40,8 +41,7 @@ export function applyHookStubs(customHooks = {}) {
40
41
  return hooks;
41
42
  }
42
43
  export function removeHookStubs() {
43
- const hooks = window.SP_REACT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher
44
- .current;
44
+ const hooks = INTERNAL_HOOKS;
45
45
  Object.assign(hooks, oldHooks);
46
46
  oldHooks = {};
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.10.5",
3
+ "version": "4.11.0",
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",
@@ -41,30 +41,30 @@
41
41
  }
42
42
  },
43
43
  "devDependencies": {
44
- "@commitlint/cli": "^19.3.0",
45
- "@commitlint/config-conventional": "^19.2.2",
46
- "@commitlint/cz-commitlint": "^19.2.0",
44
+ "@commitlint/cli": "^19.8.1",
45
+ "@commitlint/config-conventional": "^19.8.1",
46
+ "@commitlint/cz-commitlint": "^19.8.1",
47
47
  "@semantic-release/changelog": "^6.0.3",
48
48
  "@semantic-release/git": "^10.0.1",
49
- "@types/jest": "^29.5.12",
50
- "@types/react": "18.3.3",
51
- "@types/react-dom": "18.3.0",
49
+ "@types/jest": "^29.5.14",
50
+ "@types/react": "19.1.1",
51
+ "@types/react-dom": "19.1.1",
52
52
  "@types/react-router": "5.1.20",
53
- "commitizen": "^4.3.0",
54
- "husky": "^9.0.11",
53
+ "commitizen": "^4.3.1",
54
+ "husky": "^9.1.7",
55
55
  "import-sort-style-module": "^6.0.0",
56
56
  "jest": "^29.7.0",
57
57
  "minimist": "^1.2.8",
58
- "prettier": "^3.3.2",
58
+ "prettier": "^3.6.2",
59
59
  "prettier-plugin-import-sort": "^0.0.7",
60
- "semantic-release": "^24.0.0",
60
+ "semantic-release": "^24.2.7",
61
61
  "shx": "^0.3.4",
62
- "ts-jest": "^29.1.4",
62
+ "ts-jest": "^29.4.1",
63
63
  "typedoc": "^0.25.13",
64
- "typedoc-plugin-mdn-links": "^3.1.29",
64
+ "typedoc-plugin-mdn-links": "^3.3.8",
65
65
  "typedoc-plugin-missing-exports": "^2.3.0",
66
66
  "typedoc-wikijs-theme": "^1.0.5",
67
- "typescript": "^5.4.5"
67
+ "typescript": "^5.9.2"
68
68
  },
69
69
  "pnpm": {
70
70
  "peerDependencyRules": {
@@ -17,5 +17,5 @@ export interface FocusableProps extends HTMLAttributes<HTMLDivElement>, FooterLe
17
17
  const focusableRegex = createPropListRegex(["flow-children", "onActivate", "onCancel", "focusClassName", "focusWithinClassName"]);
18
18
 
19
19
  export const Focusable = findModuleExport((e: Export) =>
20
- e?.render?.toString && focusableRegex.test(e.render.toString())
20
+ (typeof e == 'function' && e?.toString && focusableRegex.test(e.toString())) || (e?.render?.toString && focusableRegex.test(e.render.toString()))
21
21
  ) as FC<FocusableProps & RefAttributes<HTMLDivElement>>;
@@ -108,7 +108,7 @@ export type ReorderableListEntryProps<T> = {
108
108
  reorderEntryFunc: CallableFunction;
109
109
  reorderEnabled: boolean;
110
110
  animate: boolean;
111
- children: ReactElement | null;
111
+ children: ReactElement<any> | null;
112
112
  };
113
113
 
114
114
  function ReorderableItem<T>(props: ReorderableListEntryProps<T>) {
@@ -130,7 +130,7 @@ export interface Input {
130
130
  * @returns an object that can be used to unregister the callback.
131
131
  */
132
132
  RegisterForControllerInputMessages(
133
- callback: (msgs: ControllerInputMessage[]) => void,
133
+ callback: (controllerIndex: number, gamepadButton: ControllerInputGamepadButton, isButtonPressed: boolean) => void,
134
134
  ): Unregisterable;
135
135
 
136
136
  RegisterForControllerListChanges(callback: (controllerListChanges: ControllerInfo[]) => void): Unregisterable;
@@ -560,6 +560,60 @@ export enum EControllerRumbleSetting {
560
560
  On,
561
561
  }
562
562
 
563
+ export enum ControllerInputGamepadButton {
564
+ GAMEPAD_BUTTON_A = 0,
565
+ GAMEPAD_BUTTON_B = 1,
566
+ GAMEPAD_BUTTON_X = 2,
567
+ GAMEPAD_BUTTON_Y = 3,
568
+ GAMEPAD_BUTTON_DPAD_UP = 4,
569
+ GAMEPAD_BUTTON_DPAD_RIGHT = 5,
570
+ GAMEPAD_BUTTON_DPAD_DOWN = 6,
571
+ GAMEPAD_BUTTON_DPAD_LEFT = 7,
572
+ GAMEPAD_BUTTON_MENU = 8,
573
+ GAMEPAD_BUTTON_VIEW = 9,
574
+ GAMEPAD_LEFTPAD_UP = 10,
575
+ GAMEPAD_LEFTPAD_DOWN = 11,
576
+ GAMEPAD_LEFTPAD_LEFT = 12,
577
+ GAMEPAD_LEFTPAD_RIGHT = 13,
578
+ GAMEPAD_LEFTPAD_ANALOG = 14,
579
+ GAMEPAD_RIGHTPAD_UP = 15,
580
+ GAMEPAD_RIGHTPAD_DOWN = 16,
581
+ GAMEPAD_RIGHTPAD_LEFT = 17,
582
+ GAMEPAD_RIGHTPAD_RIGHT = 18,
583
+ GAMEPAD_RIGHTPAD_ANALOG = 19,
584
+ GAMEPAD_LEFTSTICK_UP = 20,
585
+ GAMEPAD_LEFTSTICK_DOWN = 21,
586
+ GAMEPAD_LEFTSTICK_LEFT = 22,
587
+ GAMEPAD_LEFTSTICK_RIGHT = 23,
588
+ GAMEPAD_LEFTSTICK_ANALOG = 24,
589
+ GAMEPAD_LEFTSTICK_CLICK = 25,
590
+ GAMEPAD_LTRIGGER_ANALOG = 26,
591
+ GAMEPAD_RTRIGGER_ANALOG = 27,
592
+ GAMEPAD_BUTTON_LTRIGGER = 28,
593
+ GAMEPAD_BUTTON_RTRIGGER = 29,
594
+ GAMEPAD_BUTTON_LSHOULDER = 30,
595
+ GAMEPAD_BUTTON_RSHOULDER = 31,
596
+ GAMEPAD_BUTTON_LBACK = 32,
597
+ GAMEPAD_BUTTON_RBACK = 33,
598
+ GAMEPAD_BUTTON_GUIDE = 34,
599
+ GAMEPAD_BUTTON_SELECT = 35,
600
+ GAMEPAD_BUTTON_START = 36,
601
+ GAMEPAD_BUTTON_LPAD_CLICKED = 37,
602
+ GAMEPAD_BUTTON_LPAD_TOUCH = 38,
603
+ GAMEPAD_BUTTON_RPAD_CLICKED = 39,
604
+ GAMEPAD_BUTTON_RPAD_TOUCH = 40,
605
+ GAMEPAD_RIGHTSTICK_CLICK = 41,
606
+ GAMEPAD_RIGHTSTICK_TOUCH = 42,
607
+ GAMEPAD_LEFTSTICK_TOUCH = 43,
608
+ GAMEPAD_BUTTON_LBACK_UPPER = 44,
609
+ GAMEPAD_BUTTON_RBACK_UPPER = 45,
610
+ GAMEPAD_BUTTON_LAST = 46,
611
+ GAMEPAD_ANALOG_SCROLL = 47,
612
+ GAMEPAD_ANALOG_LEFT_KEYBOARD_CURSOR = 48,
613
+ GAMEPAD_ANALOG_RIGHT_KEYBOARD_CURSOR = 49,
614
+ GAMEPAD_ANALOG_LAST = 50
615
+ }
616
+
563
617
  // TODO: Not the actual name, but the enum is only represented in a dropdown
564
618
  // options vector, ty valve
565
619
  export enum EThirdPartyControllerConfiguration {
@@ -568,12 +622,6 @@ export enum EThirdPartyControllerConfiguration {
568
622
  On,
569
623
  }
570
624
 
571
- export interface ControllerInputMessage {
572
- nA: number;
573
- bS: boolean;
574
- nC: number;
575
- }
576
-
577
625
  export interface ActiveAccount {
578
626
  strActiveAccountID: string;
579
627
  strName: string;
@@ -69,71 +69,145 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
69
69
 
70
70
  let renderHookStep = 0;
71
71
 
72
- // Accessed two times, once directly before class instantiation, and again in some extra logic we don't need to worry about that we hanlde below just in case.
73
- Object.defineProperty(component, "contextType", {
74
- configurable: true,
75
- get: function () {
76
- loggingEnabled && logger.debug("get contexttype", this, stubsApplied, renderHookStep);
77
- loggingEnabled && console.trace("contextType trace");
78
- if (renderHookStep == 0) renderHookStep = 1;
79
- else if (renderHookStep == 3) renderHookStep = 4;
80
- return this._contextType;
81
- },
82
- set: function (value) {
83
- this._contextType = value;
84
- }
85
- });
72
+ if (window.SP_REACTDOM.version.startsWith("19.")) {
73
+ // Accessed two times directly before class instantiation on path A and once on path B
74
+ Object.defineProperty(component, "contextType", {
75
+ configurable: true,
76
+ get: function () {
77
+ loggingEnabled && logger.debug("get contexttype", this, this._contextType, stubsApplied, renderHookStep);
78
+ loggingEnabled && console.trace("contextType trace");
79
+ if (renderHookStep == 0) {
80
+ renderHookStep = 1;
81
+ }
82
+ if (this._contextType == null) {
83
+ this._contextType = {};
84
+ }
85
+ if (!this._contextType.appliedCurrentValueHook) {
86
+ logger.debug("applied currentvalue hook");
87
+ this._contextType.appliedCurrentValueHook = true;
88
+ Object.defineProperty(this._contextType, "_currentValue", {
89
+ configurable: true,
90
+ get: function () {
91
+ loggingEnabled && logger.debug("get currentValue", this, stubsApplied, renderHookStep);
92
+ loggingEnabled && console.trace("currentValue trace");
93
+ if (renderHookStep == 1) {
94
+ renderHookStep = 2;
95
+ applyStubsIfNeeded();
96
+ }
97
+ return this.__currentValue;
98
+ },
99
+ set: function (value) {
100
+ return this.__currentValue = value;
101
+ }
102
+ });
103
+ }
104
+ return this._contextType;
105
+ },
106
+ set: function (value) {
107
+ this._contextType = value;
108
+ }
109
+ });
86
110
 
87
- // Always accessed directly after contextType for the path we want to catch.
88
- Object.defineProperty(component, "contextTypes", {
89
- configurable: true,
90
- get: function () {
91
- loggingEnabled && logger.debug("get contexttypes", this, stubsApplied, renderHookStep);
92
- loggingEnabled && console.trace("contextTypes trace");
93
- if (renderHookStep == 1) {
94
- renderHookStep = 2;
95
- applyStubsIfNeeded();
96
- };
97
- return this._contextTypes;
98
- },
99
- set: function (value) {
100
- this._contextTypes = value;
101
- }
102
- });
111
+ // Set directly after class is instantiated
112
+ Object.defineProperty(component.prototype, "updater", {
113
+ configurable: true,
114
+ get: function () {
115
+ return this._updater;
116
+ },
117
+ set: function (value) {
118
+ loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
119
+ loggingEnabled && console.trace("updater trace");
120
+ if (renderHookStep == 1 || renderHookStep == 2) {
121
+ renderHookStep = 0;
122
+ removeStubsIfNeeded();
123
+ }
124
+ return this._updater = value;
125
+ }
126
+ });
103
127
 
104
- // Set directly after class is instantiated
105
- Object.defineProperty(component.prototype, "updater", {
106
- configurable: true,
107
- get: function () {
108
- return this._updater;
109
- },
110
- set: function (value) {
111
- loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
112
- loggingEnabled && console.trace("updater trace");
113
- if (renderHookStep == 2) {
114
- renderHookStep = 0;
115
- removeStubsIfNeeded();
128
+ // Prevents the second contextType access from leaving its hooks around
129
+ Object.defineProperty(component, "getDerivedStateFromProps", {
130
+ configurable: true,
131
+ get: function () {
132
+ loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
133
+ loggingEnabled && console.trace("getDerivedStateFromProps trace");
134
+ if (renderHookStep == 1|| renderHookStep == 2) {
135
+ renderHookStep = 0;
136
+ removeStubsIfNeeded();
137
+ }
138
+ return this._getDerivedStateFromProps;
139
+ },
140
+ set: function (value) {
141
+ this._getDerivedStateFromProps = value;
116
142
  }
117
- return this._updater = value;
118
- }
119
- });
143
+ });
144
+ } else if (window.SP_REACTDOM.version.startsWith("18.")) {
145
+ // Accessed two times, once directly before class instantiation, and again in some extra logic we don't need to worry about that we hanlde below just in case.
146
+ Object.defineProperty(component, "contextType", {
147
+ configurable: true,
148
+ get: function () {
149
+ loggingEnabled && logger.debug("get contexttype", this, stubsApplied, renderHookStep);
150
+ loggingEnabled && console.trace("contextType trace");
151
+ if (renderHookStep == 0) renderHookStep = 1;
152
+ else if (renderHookStep == 3) renderHookStep = 4;
153
+ return this._contextType;
154
+ },
155
+ set: function (value) {
156
+ this._contextType = value;
157
+ }
158
+ });
120
159
 
121
- // Prevents the second contextType+contextTypes access from leaving its hooks around
122
- Object.defineProperty(component, "getDerivedStateFromProps", {
123
- configurable: true,
124
- get: function () {
125
- loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
126
- loggingEnabled && console.trace("getDerivedStateFromProps trace");
127
- if (renderHookStep == 2) {
128
- renderHookStep = 0;
129
- removeStubsIfNeeded();
160
+ // Always accessed directly after contextType for the path we want to catch.
161
+ Object.defineProperty(component, "contextTypes", {
162
+ configurable: true,
163
+ get: function () {
164
+ loggingEnabled && logger.debug("get contexttypes", this, stubsApplied, renderHookStep);
165
+ loggingEnabled && console.trace("contextTypes trace");
166
+ if (renderHookStep == 1) {
167
+ renderHookStep = 2;
168
+ applyStubsIfNeeded();
169
+ };
170
+ return this._contextTypes;
171
+ },
172
+ set: function (value) {
173
+ this._contextTypes = value;
130
174
  }
131
- return this._getDerivedStateFromProps;
132
- },
133
- set: function (value) {
134
- this._getDerivedStateFromProps = value;
135
- }
136
- });
175
+ });
176
+
177
+ // Set directly after class is instantiated
178
+ Object.defineProperty(component.prototype, "updater", {
179
+ configurable: true,
180
+ get: function () {
181
+ return this._updater;
182
+ },
183
+ set: function (value) {
184
+ loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
185
+ loggingEnabled && console.trace("updater trace");
186
+ if (renderHookStep == 2) {
187
+ renderHookStep = 0;
188
+ removeStubsIfNeeded();
189
+ }
190
+ return this._updater = value;
191
+ }
192
+ });
193
+
194
+ // Prevents the second contextType+contextTypes access from leaving its hooks around
195
+ Object.defineProperty(component, "getDerivedStateFromProps", {
196
+ configurable: true,
197
+ get: function () {
198
+ loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
199
+ loggingEnabled && console.trace("getDerivedStateFromProps trace");
200
+ if (renderHookStep == 2) {
201
+ renderHookStep = 0;
202
+ removeStubsIfNeeded();
203
+ }
204
+ return this._getDerivedStateFromProps;
205
+ },
206
+ set: function (value) {
207
+ this._getDerivedStateFromProps = value;
208
+ }
209
+ });
210
+ }
137
211
 
138
212
  return userComponent;
139
213
  }
@@ -1,4 +1,6 @@
1
- import * as React from 'react';
1
+ import type * as React from 'react';
2
+ import type * as ReactDOM from 'react-dom';
3
+ import type * as JSXRuntime from 'react/jsx-runtime';
2
4
  import { Ref, useState } from 'react';
3
5
 
4
6
  // this shouldn't need to be redeclared but it does for some reason
@@ -6,6 +8,8 @@ import { Ref, useState } from 'react';
6
8
  declare global {
7
9
  interface Window {
8
10
  SP_REACT: typeof React;
11
+ SP_REACTDOM: typeof ReactDOM;
12
+ SP_JSX: typeof JSXRuntime;
9
13
  }
10
14
  }
11
15
 
@@ -33,9 +37,11 @@ export function createPropListRegex(propList: string[], fromStart: boolean = tru
33
37
 
34
38
  let oldHooks = {};
35
39
 
40
+ export let INTERNAL_HOOKS = (window.SP_REACT as any)?.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentDispatcher
41
+ .current || Object.values((window.SP_REACT as any)?.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE).find((p: any) => p?.useEffect);
42
+
36
43
  export function applyHookStubs(customHooks: any = {}): any {
37
- const hooks = (window.SP_REACT as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher
38
- .current;
44
+ const hooks = INTERNAL_HOOKS;
39
45
 
40
46
  // TODO: add more hooks
41
47
 
@@ -50,7 +56,7 @@ export function applyHookStubs(customHooks: any = {}): any {
50
56
  };
51
57
 
52
58
  hooks.useCallback = (cb: Function) => cb;
53
- hooks.useContext = (cb: any) => cb._currentValue;
59
+ hooks.useContext = (cb: any) => cb?._currentValue;
54
60
  hooks.useLayoutEffect = (_: Function) => {}; //cb();
55
61
  hooks.useMemo = (cb: Function, _: any[]) => cb;
56
62
  hooks.useEffect = (_: Function) => {}; //cb();
@@ -67,8 +73,7 @@ export function applyHookStubs(customHooks: any = {}): any {
67
73
  }
68
74
 
69
75
  export function removeHookStubs() {
70
- const hooks = (window.SP_REACT as any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher
71
- .current;
76
+ const hooks = INTERNAL_HOOKS;
72
77
  Object.assign(hooks, oldHooks);
73
78
  oldHooks = {};
74
79
  }