@decky/ui 4.11.5 → 4.12.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.
@@ -13,6 +13,7 @@ export type ReorderableListProps<T> = {
13
13
  }>;
14
14
  fieldProps?: FieldProps;
15
15
  animate?: boolean;
16
+ disableReordering?: boolean;
16
17
  };
17
18
  export declare function ReorderableList<T>(props: ReorderableListProps<T>): import("react/jsx-runtime").JSX.Element;
18
19
  export type ReorderableListEntryProps<T> = {
@@ -9,7 +9,15 @@ export function ReorderableList(props) {
9
9
  useEffect(() => {
10
10
  setEntryList([...props.entries].sort((a, b) => a.position - b.position));
11
11
  }, [props.entries]);
12
+ useEffect(() => {
13
+ if (props.disableReordering && reorderEnabled) {
14
+ setReorderEnabled(false);
15
+ props.onSave(entryList);
16
+ }
17
+ }, [props.disableReordering, reorderEnabled, entryList]);
12
18
  function toggleReorderEnabled() {
19
+ if (props.disableReordering)
20
+ return;
13
21
  let newReorderValue = !reorderEnabled;
14
22
  setReorderEnabled(newReorderValue);
15
23
  if (!newReorderValue) {
@@ -32,7 +40,7 @@ export function ReorderableList(props) {
32
40
  flexDirection: 'column',
33
41
  justifyContent: 'flex-start',
34
42
  alignContent: 'stretch',
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 }))) }) }) }));
43
+ }, children: _jsx(Focusable, { onSecondaryButton: props.disableReordering ? undefined : toggleReorderEnabled, onSecondaryActionDescription: props.disableReordering ? undefined : reorderEnabled ? 'Save Order' : 'Reorder', onClick: props.disableReordering ? undefined : 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 }))) }) }) }));
36
44
  }
37
45
  function ReorderableItem(props) {
38
46
  const [isSelected, _setIsSelected] = useState(false);
@@ -1,6 +1,6 @@
1
1
  type QuickAccessMenuClasses = Record<'ActiveTab' | 'AllTabContents' | 'BackgroundAnimation' | 'BatteryDetailsLabels' | 'BatteryIcon' | 'BatteryPercentageLabel' | 'BatteryProjectedLabel' | 'BatteryProjectedValue' | 'BatterySectionContainer' | 'Blocked' | 'ComingSoon' | 'Container' | 'ContentTransition' | 'Down' | 'EmptyNotifications' | 'Enter' | 'EnterActive' | 'Exit' | 'ExitActive' | 'FooterBoxShadow' | 'FriendsListTabPanel' | 'FriendsTitle' | 'FullHeight' | 'HeaderAndFooterVisible' | 'HeaderContainer' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'KeyboardButton' | 'Label' | 'LowBattery' | 'LowBatteryGauge' | 'Menu' | 'Open' | 'PanelExitAnchor' | 'PanelOuterNav' | 'PanelSection' | 'PanelSectionRow' | 'PanelSectionTitle' | 'PopupBody' | 'QuickAccessMenu' | 'QuickAccessNotifications' | 'ReallyLow' | 'Remaining' | 'Selected' | 'Tab' | 'TabContentColumn' | 'TabGroupPanel' | 'TabPanelHidden' | 'Tabs' | 'TabsWithFooter' | 'Text' | 'Title' | 'TransitionMenuDelay' | 'Up' | 'VR' | 'ViewPlaceholder' | 'VoiceTab' | 'duration-app-launch' | 'focusAnimation' | 'hoverAnimation' | 'vrgamepadui-floating-bar-popup-panel-height' | 'vrgamepadui-floating-bar-popup-panel-width' | 'vrgamepadui-floating-keyboard-height' | 'vrgamepadui-floating-keyboard-width' | 'vrgamepadui-floating-side-panel-height' | 'vrgamepadui-floating-side-panel-width', string>;
2
2
  type ScrollPanelClasses = Record<'ScrollBoth' | 'ScrollPanel' | 'ScrollX' | 'ScrollY', string>;
3
- type GamepadDialogClasses = Record<'ActiveAndUnfocused' | 'AlignCenter' | 'AlignLeft' | 'AlignRight' | 'BackgroundAnimation' | 'BasicTextInput' | 'BeforeChildren' | 'BottomButtons' | 'Button' | 'ChildrenWidthFixed' | 'ChildrenWidthGrow' | 'Clickable' | 'CompactPadding' | 'ControlsListChild' | 'ControlsListOuterPanel' | 'Disabled' | 'DropDownControlButtonContents' | 'DropDownRow' | 'ExtraPaddingOnChildrenBelow' | 'ExtraSpacing' | 'Field' | 'FieldChildrenInner' | 'FieldChildrenWithIcon' | 'FieldClickTarget' | 'FieldDescription' | 'FieldIcon' | 'FieldLabel' | 'FieldLabelRow' | 'FieldLabelValue' | 'Front' | 'FullWidth' | 'GamepadDialogContent' | 'GamepadDialogContent_InnerWidth' | 'HighlightOnFocus' | 'IconContainer' | 'InlineWrapShiftsChildrenBelow' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'ItemMaxSizeDesktop' | 'Label' | 'LabelFieldValue' | 'ModalClickToDismiss' | 'ModalPosition' | 'NoHeaderPadding' | 'NoMinWidth' | 'On' | 'QuickAccess-Menu' | 'ScrollWithin' | 'Spacer' | 'StandaloneFieldSeparator' | 'StandardPadding' | 'StandardSpacing' | 'Toggle' | 'ToggleRail' | 'ToggleSwitch' | 'VR' | 'VerticalAlignCenter' | 'WithBottomSeparator' | 'WithBottomSeparatorStandard' | 'WithBottomSeparatorThick' | 'WithChildrenBelow' | 'WithDescription' | 'WithFirstRow' | 'WithStandardPadding' | 'duration-app-launch' | 'focusAnimation' | 'hoverAnimation' | 'slideInAnimation', string>;
3
+ type GamepadDialogClasses = Record<'ActiveAndUnfocused' | 'AlignCenter' | 'AlignLeft' | 'AlignRight' | 'BackgroundAnimation' | 'BasicTextInput' | 'BeforeChildren' | 'BottomButtons' | 'Button' | 'ChildrenWidthFixed' | 'ChildrenWidthGrow' | 'Clickable' | 'CompactPadding' | 'ControlsListChild' | 'ControlsListOuterPanel' | 'Disabled' | 'DropDownControlButtonContents' | 'DropDownRow' | 'ExtraPaddingOnChildrenBelow' | 'ExtraSpacing' | 'Field' | 'FieldChildrenInner' | 'FieldChildrenWithIcon' | 'FieldClickTarget' | 'FieldDescription' | 'FieldIcon' | 'FieldLabel' | 'FieldLabelRow' | 'FieldLabelValue' | 'FieldLeftColumn' | 'Front' | 'FullWidth' | 'GamepadDialogContent' | 'GamepadDialogContent_InnerWidth' | 'HighlightOnFocus' | 'IconContainer' | 'InlineWrapShiftsChildrenBelow' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'ItemMaxSizeDesktop' | 'Label' | 'LabelFieldValue' | 'ModalClickToDismiss' | 'ModalPosition' | 'NoHeaderPadding' | 'NoMinWidth' | 'On' | 'QuickAccess-Menu' | 'ScrollWithin' | 'Spacer' | 'StandaloneFieldSeparator' | 'StandardPadding' | 'StandardSpacing' | 'Toggle' | 'ToggleRail' | 'ToggleSwitch' | 'VR' | 'VerticalAlignCenter' | 'WithBottomSeparator' | 'WithBottomSeparatorStandard' | 'WithBottomSeparatorThick' | 'WithChildrenBelow' | 'WithDescription' | 'WithFirstRow' | 'WithStandardPadding' | 'duration-app-launch' | 'focusAnimation' | 'hoverAnimation' | 'slideInAnimation', string>;
4
4
  type QuickAccessControlsClasses = Record<'BackgroundAnimation' | 'BatteryDetailsLabels' | 'BatteryIcon' | 'BatteryPercentageLabel' | 'BatteryProjectedLabel' | 'BatteryProjectedValue' | 'BatterySectionContainer' | 'ComingSoon' | 'EmptyNotifications' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'Label' | 'LowBattery' | 'LowBatteryGauge' | 'PanelSection' | 'PanelSectionRow' | 'PanelSectionTitle' | 'QuickAccessNotifications' | 'ReallyLow' | 'Remaining' | 'Text' | 'VR' | 'duration-app-launch' | 'focusAnimation' | 'hoverAnimation', string>;
5
5
  type UpdaterFieldClasses = Record<'ApplyingText' | 'BackgroundAnimation' | 'BatteryLowWarning' | 'Body' | 'CurrentStatus' | 'Denominator' | 'EventDetailTitle' | 'EventDetailsBody' | 'EventDetailsSubTitle' | 'InsufficientBatteryText' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'Label' | 'Numerator' | 'OOBEUpdateStatusContainer' | 'PatchNotes' | 'PostedTime' | 'ProgressInfoContainer' | 'ProgressStatus' | 'Separator' | 'Text' | 'TextContainer' | 'TimeRemaining' | 'Title' | 'TotalUpdateSize' | 'UnsupportedHardwareWarning' | 'UpdateBytesRemaining' | 'UpdatePanel' | 'UpdateScreen' | 'UpdateStatusContainer' | 'UpdaterFieldStatusApplying' | 'UpdaterFieldStatusSuccess' | 'duration-app-launch' | 'fadeInAnimation' | 'focusAnimation' | 'hoverAnimation', string>;
6
6
  type PlaySectionClasses = Record<'AchievementCountLabel' | 'AchievementProgressRow' | 'AchievementSVG' | 'ActionSection' | 'AppButtonsContainer' | 'Arrow' | 'AvatarAndPersona' | 'BackgroundAnimation' | 'BreakNarrow' | 'BreakShort' | 'BreakTall' | 'BreakUltraWide' | 'BreakWide' | 'ButtonChild' | 'ButtonText' | 'ChooseButton' | 'ClaimButton' | 'ClaimButtonContainer' | 'ClickablePlayBarItem' | 'CloudIconSVG' | 'CloudStatusIcon' | 'CloudStatusLabel' | 'CloudStatusRow' | 'CloudStatusSyncFail' | 'CloudSyncProblem' | 'CloudSynching' | 'ComingSoon' | 'Container' | 'ControllerConfigButton' | 'ControllerSupportInfo' | 'ControllerSupportRow' | 'DetailsProgressBar' | 'DetailsProgressContainer' | 'DetailsSection' | 'DetailsSectionExtra' | 'DetailsSectionStatus' | 'Disabled' | 'DotDotDot' | 'DownloadPaused' | 'DownloadProgressBar' | 'Downloading' | 'FavoriteButton' | 'Favorited' | 'FeatureHidden' | 'GameInfoButton' | 'GameStat' | 'GameStatIcon' | 'GameStatIconForced' | 'GameStatRight' | 'GameStatsSection' | 'GamepadUIBreakNarrow' | 'GamepadUIBreakShort' | 'GamepadUIBreakWide' | 'Glassy' | 'HideWhenNarrow' | 'Icon' | 'Icons' | 'InPage' | 'InnerContainer' | 'InvalidPlatform' | 'ItemFocusAnim-darkGrey' | 'ItemFocusAnim-darkerGrey' | 'ItemFocusAnim-darkerGrey-nocolor' | 'ItemFocusAnim-green' | 'ItemFocusAnim-grey' | 'ItemFocusAnim-translucent-white-10' | 'ItemFocusAnim-translucent-white-20' | 'ItemFocusAnimBorder-darkGrey' | 'LastPlayed' | 'LastPlayedInfo' | 'LaunchOptionCallout' | 'LaunchOptionCalloutMessage' | 'LaunchOptionCalloutMessageContainer' | 'LongButton' | 'MenuActive' | 'MenuButton' | 'MenuButtonContainer' | 'MiniAchievements' | 'OfflineMode' | 'OnlyDownloadBar' | 'PermanentlyUnavailable' | 'PlayBar' | 'PlayBarCloudStatusContainer' | 'PlayBarDetailLabel' | 'PlayBarGameIcon' | 'PlayBarGameName' | 'PlayBarIconAndGame' | 'PlayBarLabel' | 'Playtime' | 'PlaytimeIcon' | 'PlaytimeIconForced' | 'PortraitBar' | 'PrivateAppActiveIndicator' | 'RecentlyUpdated' | 'RecentlyUpdatedIcon' | 'RecentlyUpdatedLink' | 'RecentlyUpdatedText' | 'RightBreakNarrow' | 'RightBreakUltraNarrow' | 'RightBreakUltraWide' | 'RightBreakWide' | 'RightControls' | 'Row' | 'SharedLibrary' | 'ShowStreaming' | 'StatusAndStats' | 'StatusNameContainer' | 'StickyHeader' | 'StickyHeaderShadow' | 'SuperimposedGridItems' | 'SyncAnim' | 'Visible' | 'duration-app-launch' | 'favorited' | 'focusAnimation' | 'hoverAnimation', string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decky/ui",
3
- "version": "4.11.5",
3
+ "version": "4.12.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",
@@ -18,6 +18,7 @@ export type ReorderableEntry<T> = {
18
18
  * Properties for a ReorderableList component of type <T>.
19
19
  *
20
20
  * @param animate If the list should animate. @default true
21
+ * @param disableReordering If true, prevents entering reordering mode and hides reorder instructions. @default false
21
22
  */
22
23
  export type ReorderableListProps<T> = {
23
24
  entries: ReorderableEntry<T>[];
@@ -25,6 +26,7 @@ export type ReorderableListProps<T> = {
25
26
  interactables?: JSXElementConstructor<{ entry: ReorderableEntry<T> }>;
26
27
  fieldProps?: FieldProps;
27
28
  animate?: boolean;
29
+ disableReordering?: boolean;
28
30
  };
29
31
 
30
32
  /**
@@ -43,7 +45,16 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
43
45
  setEntryList([...props.entries].sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position));
44
46
  }, [props.entries]);
45
47
 
48
+ useEffect(() => {
49
+ if (props.disableReordering && reorderEnabled) {
50
+ setReorderEnabled(false);
51
+ props.onSave(entryList);
52
+ }
53
+ }, [props.disableReordering, reorderEnabled, entryList]);
54
+
46
55
  function toggleReorderEnabled(): void {
56
+ if (props.disableReordering) return;
57
+
47
58
  let newReorderValue = !reorderEnabled;
48
59
  setReorderEnabled(newReorderValue);
49
60
 
@@ -75,9 +86,9 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
75
86
  }}
76
87
  >
77
88
  <Focusable
78
- onSecondaryButton={toggleReorderEnabled}
79
- onSecondaryActionDescription={reorderEnabled ? 'Save Order' : 'Reorder'}
80
- onClick={toggleReorderEnabled}
89
+ onSecondaryButton={props.disableReordering ? undefined : toggleReorderEnabled}
90
+ onSecondaryActionDescription={props.disableReordering ? undefined : reorderEnabled ? 'Save Order' : 'Reorder'}
91
+ onClick={props.disableReordering ? undefined : toggleReorderEnabled}
81
92
  onButtonDown={saveOnBackout}
82
93
  >
83
94
  {entryList.map((entry: ReorderableEntry<T>) => (
@@ -108,6 +108,7 @@ type GamepadDialogClasses = Record<
108
108
  | 'FieldLabel'
109
109
  | 'FieldLabelRow'
110
110
  | 'FieldLabelValue'
111
+ | 'FieldLeftColumn'
111
112
  | 'Front'
112
113
  | 'FullWidth'
113
114
  | 'GamepadDialogContent'