mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-20 10:00:08 +02:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d22d32677b | ||
|
|
30e319425b | ||
|
|
aebdfaa089 | ||
|
|
de914b1a35 | ||
|
|
4c4fda47e3 | ||
|
|
678084e4fd | ||
|
|
4f8f65d429 | ||
|
|
8a352d288d | ||
|
|
fd0d011cbf | ||
|
|
70219d90bc | ||
|
|
1ff9351f96 | ||
|
|
c256d341c8 | ||
|
|
c9b583945c | ||
|
|
a06650cf09 | ||
|
|
3170779c6b |
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,3 +1,37 @@
|
||||
# [3.23.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.22.1...v3.23.0) (2023-10-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **static-classes:** add more css classes ([#94](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/94)) ([30e3194](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/30e319425bd4b0ee481dd7bd3245dacd90806afb))
|
||||
|
||||
## [3.22.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.22.0...v3.22.1) (2023-10-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **useQuickAccessVisible:** use the "Page Visibility API" instead of focus/blur ([4c4fda4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4c4fda47e3d9fd936b493c5965634a0ff443014f))
|
||||
|
||||
# [3.22.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.21.8...v3.22.0) (2023-08-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add patch indicator to prevent crashes ([3170779](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/3170779c6b3d02ea17f7b6c1fbd57e00498ffe4f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add components found while working on tabmaster ([4f8f65d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4f8f65d42979149cc80b4a86545d3d0d9bf14bf3))
|
||||
* add components found while working on tabmaster ([fd0d011](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/fd0d011cbf05790c5a1078970b5be72f9267402c))
|
||||
|
||||
## [3.21.8](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.21.7...v3.21.8) (2023-06-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* the typescript compiler was eating the enum ([c9b5839](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c9b583945c1cb5267b41a821743590a841572abe))
|
||||
|
||||
## [3.21.7](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.21.6...v3.21.7) (2023-06-26)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "3.21.7",
|
||||
"version": "3.23.0",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -9,14 +9,7 @@ function getQuickAccessWindow(): Window | null {
|
||||
/**
|
||||
* Returns state indicating the visibility of quick access menu.
|
||||
*
|
||||
* @remarks
|
||||
* During development it is possible to open the quick access menu without giving it
|
||||
* focus in some cases. In such cases, the quick access menu state is invisible.
|
||||
*
|
||||
* This seems to be impossible to replicate when running the deck normally. Even in
|
||||
* the edge cases it always seems to have a focus.
|
||||
*
|
||||
* @returns `true` if quick access menu is visible (focused) and `false` otherwise.
|
||||
* @returns `true` if quick access menu is visible and `false` otherwise.
|
||||
*
|
||||
* @example
|
||||
* import { VFC, useEffect } from "react";
|
||||
@@ -44,7 +37,10 @@ function getQuickAccessWindow(): Window | null {
|
||||
* };
|
||||
*/
|
||||
export function useQuickAccessVisible(): boolean {
|
||||
const [isVisible, setIsVisible] = useState(getQuickAccessWindow()?.document.hasFocus() ?? true);
|
||||
// By default we say that document is not hidden, unless we know otherwise.
|
||||
// This would cover the cases when Valve breaks something and the quick access window
|
||||
// cannot be accessed anymore - the plugins that use this would continue working somewhat.
|
||||
const [isHidden, setIsHidden] = useState(getQuickAccessWindow()?.document.hidden ?? false);
|
||||
|
||||
useEffect(() => {
|
||||
const quickAccessWindow = getQuickAccessWindow();
|
||||
@@ -53,16 +49,12 @@ export function useQuickAccessVisible(): boolean {
|
||||
return;
|
||||
}
|
||||
|
||||
const onBlur = () => setIsVisible(false);
|
||||
const onFocus = () => setIsVisible(true);
|
||||
|
||||
quickAccessWindow.addEventListener('blur', onBlur);
|
||||
quickAccessWindow.addEventListener('focus', onFocus);
|
||||
const onVisibilityChange = () => setIsHidden(quickAccessWindow.document.hidden);
|
||||
quickAccessWindow.addEventListener('visibilitychange', onVisibilityChange);
|
||||
return () => {
|
||||
quickAccessWindow.removeEventListener('blur', onBlur);
|
||||
quickAccessWindow.removeEventListener('focus', onFocus);
|
||||
quickAccessWindow.removeEventListener('visibilitychange', onVisibilityChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return isVisible;
|
||||
return !isHidden;
|
||||
}
|
||||
|
||||
@@ -154,3 +154,16 @@ export const ModalRoot = (Object.values(
|
||||
}
|
||||
}
|
||||
})) as FC<ModalRootProps>;
|
||||
|
||||
interface SimpleModalProps{
|
||||
active?: boolean,
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
const ModalModule = findModule((mod) => {
|
||||
if (typeof mod !== 'object' || !mod.__esModule) return undefined;
|
||||
if (mod.SimpleModal && mod.ModalPosition) return mod;
|
||||
})
|
||||
|
||||
export const SimpleModal = ModalModule.SimpleModal as FC<SimpleModalProps>
|
||||
export const ModalPosition = ModalModule.ModalPosition as FC<SimpleModalProps>
|
||||
@@ -2,6 +2,11 @@ import { FC, ReactNode } from 'react';
|
||||
|
||||
import { findModuleChild } from '../webpack';
|
||||
|
||||
export const Panel: FC<{ children?: ReactNode; }> = findModuleChild((mod) => {
|
||||
if (typeof mod !== 'object' || !mod.__esModule) return undefined;
|
||||
return mod.Panel;
|
||||
})
|
||||
|
||||
export interface PanelSectionProps {
|
||||
title?: string;
|
||||
spinner?: boolean;
|
||||
|
||||
14
src/deck-components/Scroll.tsx
Normal file
14
src/deck-components/Scroll.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { FC, ReactNode } from "react";
|
||||
import { findModuleChild, findModule } from "../webpack";
|
||||
|
||||
const ScrollingModule = findModule((mod) => {
|
||||
if (typeof mod !== 'object' || !mod.__esModule) return undefined;
|
||||
if (mod.ScrollPanel) return mod;
|
||||
});
|
||||
|
||||
export const ScrollPanel: FC<{ children?: ReactNode; }> = ScrollingModule.ScrollPanel;
|
||||
|
||||
export const ScrollPanelGroup: FC<{ children?: ReactNode; }> = findModuleChild((mod) => {
|
||||
if (typeof mod !== 'object' || !mod.__esModule) return undefined;
|
||||
return mod.ScrollPanelGroup;
|
||||
})
|
||||
@@ -25,6 +25,7 @@ export * from './TextField';
|
||||
export * from './Toggle';
|
||||
export * from './ToggleField';
|
||||
export * from './SteamClient';
|
||||
export * from './Scroll';
|
||||
|
||||
import { AppDetails, LogoPosition, SteamAppOverview, SteamClient } from './SteamClient';
|
||||
|
||||
|
||||
@@ -504,6 +504,169 @@ type GamepadUIClasses = Record<
|
||||
string
|
||||
>;
|
||||
|
||||
type GamepadTabbedPageClasses = Record<
|
||||
| 'duration-app-launch'
|
||||
| 'headerHeight'
|
||||
| 'contentPadding'
|
||||
| 'GamepadTabbedPage'
|
||||
| 'TabHeaderRowWrapper'
|
||||
| 'Floating'
|
||||
| 'TabRow'
|
||||
| 'TabRowTabs'
|
||||
| 'BleedGlyphs'
|
||||
| 'TabsRowScroll'
|
||||
| 'FixCenterAlignScroll'
|
||||
| 'Tab'
|
||||
| 'Selected'
|
||||
| 'HasAddon'
|
||||
| 'RightAddon'
|
||||
| 'TabTitle'
|
||||
| 'LeftAddon'
|
||||
| 'TabCount'
|
||||
| 'Active'
|
||||
| 'TabBadge'
|
||||
| 'TabCountBadge'
|
||||
| 'TabRowSpacer'
|
||||
| 'Glyphs'
|
||||
| 'Show'
|
||||
| 'TabContents'
|
||||
| 'ContentTransition'
|
||||
| 'TabContentsScroll'
|
||||
| 'Right'
|
||||
| 'Enter'
|
||||
| 'EnterActive'
|
||||
| 'Exit'
|
||||
| 'ExitActive'
|
||||
| 'Left'
|
||||
| 'TabIcon',
|
||||
string
|
||||
>;
|
||||
|
||||
type GamepadContextMenuClasses = Record<
|
||||
| "duration-app-launch"
|
||||
| "BasicContextMenuModal"
|
||||
| "BasicContextMenuHeader"
|
||||
| "BasicContextMenuHeaderShrinkableSpacing"
|
||||
| "BasicContextMenuContainer"
|
||||
| "slideInAnimation"
|
||||
| "contextMenu"
|
||||
| "contextMenuContents"
|
||||
| "hasSubMenu"
|
||||
| "contextMenuFade"
|
||||
| "contextMenuItem"
|
||||
| "active"
|
||||
| "Selected"
|
||||
| "Focused"
|
||||
| "Positive"
|
||||
| "Emphasis"
|
||||
| "Destructive"
|
||||
| "Capitalized"
|
||||
| "MenuSectionHeader"
|
||||
| "UpperCase"
|
||||
| "SubMenu"
|
||||
| "ContextMenuSeparator"
|
||||
| "Label"
|
||||
| "Arrow"
|
||||
| "ItemFocusAnim-darkerGrey-nocolor"
|
||||
| "ItemFocusAnim-darkerGrey"
|
||||
| "ItemFocusAnim-darkGrey"
|
||||
| "ItemFocusAnim-grey"
|
||||
| "ItemFocusAnimBorder-darkGrey"
|
||||
| "ItemFocusAnim-green"
|
||||
| "focusAnimation"
|
||||
| "hoverAnimation",
|
||||
string
|
||||
>;
|
||||
|
||||
type AchievementClasses = Record<
|
||||
| "nAchievementHeight"
|
||||
| "nGlobalAchievementHeight"
|
||||
| "nAchievementsListTitleHeight"
|
||||
| "nAchievementGap"
|
||||
| "AchievementList"
|
||||
| "ListTitle"
|
||||
| "AchievementListItemBase"
|
||||
| "Container"
|
||||
| "Content"
|
||||
| "Right"
|
||||
| "Footer"
|
||||
| "AchievementTitle"
|
||||
| "AchievementDescription"
|
||||
| "AchievementGlobalPercentage"
|
||||
| "InBody"
|
||||
| "VerticalContent"
|
||||
| "UnlockDate"
|
||||
| "AlignEnd"
|
||||
| "ProgressBar"
|
||||
| "ProgressCount"
|
||||
| "AchievementContent"
|
||||
| "HiddenAchievementContent"
|
||||
| "FriendAchievementFooter"
|
||||
| "GlobalPercentage"
|
||||
| "UserUnlockDateTime"
|
||||
| "GlobalAchievementsListHeader"
|
||||
| "SearchField"
|
||||
| "Avatar"
|
||||
| "HeaderText"
|
||||
| "GlobalAchievementListItem"
|
||||
| "UnlockContainer"
|
||||
| "Info"
|
||||
| "Title"
|
||||
| "Description"
|
||||
| "Percent"
|
||||
| "ImageContainer"
|
||||
| "ProgressFill"
|
||||
| "SpoilerWarning"
|
||||
| "Hidden"
|
||||
| "ComparisonAchieverColumn"
|
||||
| "ComparisonAchieverInfo"
|
||||
| "ProgressContainer"
|
||||
| "ProgressLabel"
|
||||
| "Secondary"
|
||||
| "AvatarContainer"
|
||||
| "Unachieved",
|
||||
string
|
||||
>;
|
||||
|
||||
type MainMenuAppRunningClasses = Record<
|
||||
| "duration-app-launch"
|
||||
| "ScrollMask"
|
||||
| "HideMask"
|
||||
| "MainMenuAppRunning"
|
||||
| "MenuOpen"
|
||||
| "NavigationColumn"
|
||||
| "ControllerColumnFocused"
|
||||
| "NavColumnFocused"
|
||||
| "NavigationBox"
|
||||
| "NavigationMenuItem"
|
||||
| "ItemFocusAnim-darkerGrey"
|
||||
| "Active"
|
||||
| "Disabled"
|
||||
| "SwitchAppsTitle"
|
||||
| "SelectableAppWindow"
|
||||
| "ActiveDot"
|
||||
| "NavigationMenuItemSeparator"
|
||||
| "AppColumn"
|
||||
| "FocusedColumn"
|
||||
| "AppColumnContent"
|
||||
| "ActiveContent"
|
||||
| "CurrentGameBackground"
|
||||
| "CurrentGameLogo"
|
||||
| "OverlayAchievements"
|
||||
| "Container"
|
||||
| "OverlayGuides"
|
||||
| "OverlayNotes"
|
||||
| "OverlayInplaceBrowser"
|
||||
| "ItemFocusAnim-darkerGrey-nocolor"
|
||||
| "ItemFocusAnim-darkGrey"
|
||||
| "ItemFocusAnim-grey"
|
||||
| "ItemFocusAnimBorder-darkGrey"
|
||||
| "ItemFocusAnim-green"
|
||||
| "focusAnimation"
|
||||
| "hoverAnimation",
|
||||
string
|
||||
>;
|
||||
|
||||
export const quickAccessMenuClasses: QuickAccessMenuClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.Title?.includes('quickaccessmenu'),
|
||||
);
|
||||
@@ -541,4 +704,16 @@ export const appDetailsClasses: AppDetailsClasses = findModule(
|
||||
);
|
||||
export const gamepadUIClasses: GamepadUIClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.BasicUiRoot?.includes('gamepadui_'),
|
||||
);
|
||||
export const gamepadTabbedPageClasses: GamepadTabbedPageClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.GamepadTabbedPage?.includes('gamepadtabbedpage_')
|
||||
);
|
||||
export const gamepadContextMenuClasses: GamepadContextMenuClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.BasicContextMenuModal?.includes('gamepadcontextmenu')
|
||||
);
|
||||
export const achievementClasses: AchievementClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.AchievementListItemBase?.includes('achievementslist')
|
||||
);
|
||||
export const mainMenuAppRunningClasses: MainMenuAppRunningClasses = findModule(
|
||||
(mod) => typeof mod === 'object' && mod?.MainMenuAppRunning?.includes('mainmenuapprunning')
|
||||
);
|
||||
@@ -57,7 +57,7 @@ export interface FilePickerRes {
|
||||
realpath: string;
|
||||
}
|
||||
|
||||
export enum FileSelectionType {
|
||||
export const enum FileSelectionType {
|
||||
FILE,
|
||||
FOLDER,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user