Compare commits

..

5 Commits

Author SHA1 Message Date
semantic-release-bot
35a061759a chore(release): 3.2.2 [CI SKIP] 2022-09-29 16:36:04 +00:00
Lukas Senionis
1fbe55aa54 fix(modal): extend props for modals (#32) 2022-09-29 12:34:00 -04:00
semantic-release-bot
66eb0cbbf3 chore(release): 3.2.1 [CI SKIP] 2022-09-24 17:49:57 +00:00
Lukas Senionis
6996e5424f fix(modal): update showModal types (#27) 2022-09-24 13:49:23 -04:00
Travis Lane
ad643836f0 updated DialogButton props and added nav pref enum (#25) 2022-09-22 17:50:07 -04:00
6 changed files with 64 additions and 9 deletions

View File

@@ -1,3 +1,17 @@
## [3.2.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.2.1...v3.2.2) (2022-09-29)
### Bug Fixes
* **modal:** extend props for modals ([#32](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/32)) ([1fbe55a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/1fbe55aa544c9e84e2b3e2d6af9950db2fe7546c))
## [3.2.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.2.0...v3.2.1) (2022-09-24)
### Bug Fixes
* **modal:** update showModal types ([#27](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/27)) ([6996e54](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/6996e5424f33467ef5bb93f47614058c127cb3ee))
# [3.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.1.4...v3.2.0) (2022-09-20) # [3.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.1.4...v3.2.0) (2022-09-20)

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "decky-frontend-lib", "name": "decky-frontend-lib",
"version": "3.2.0", "version": "3.2.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "decky-frontend-lib", "name": "decky-frontend-lib",
"version": "3.2.0", "version": "3.2.2",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"dependencies": { "dependencies": {
"minimist": "^1.2.6" "minimist": "^1.2.6"

View File

@@ -1,6 +1,6 @@
{ {
"name": "decky-frontend-lib", "name": "decky-frontend-lib",
"version": "3.2.0", "version": "3.2.2",
"description": "A library for building decky plugins", "description": "A library for building decky plugins",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@@ -1,8 +1,9 @@
import { CSSProperties, FC, RefAttributes } from 'react'; import { CSSProperties, FC, RefAttributes } from 'react';
import { CommonUIModule } from '../webpack'; import { CommonUIModule } from '../webpack';
import { FooterLegendProps } from './FooterLegend';
export interface DialogButtonProps extends RefAttributes<HTMLDivElement> { export interface DialogButtonProps extends RefAttributes<HTMLDivElement>, FooterLegendProps {
label?: string; label?: string;
style?: CSSProperties; style?: CSSProperties;
className?: string; className?: string;

View File

@@ -30,6 +30,14 @@ export enum GamepadButton {
STEAM_QUICK_MENU STEAM_QUICK_MENU
} }
export enum NavEntryPositionPreferences {
FIRST,
LAST,
MAINTAIN_X,
MAINTAIN_Y,
PREFERRED_CHILD
}
export interface GamepadEventDetail { export interface GamepadEventDetail {
button: number; button: number;
is_repeat?: boolean; is_repeat?: boolean;

View File

@@ -1,9 +1,33 @@
import { FC, ReactNode } from 'react'; import { FC, ReactNode } from 'react';
import { findModuleChild } from '../webpack'; import { findModuleChild } from '../webpack';
// TODO: there is another argument, figure out what it does // All of the popout options + strTitle are related. Proper usage is not yet known...
export const showModal: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => { export interface ShowModalProps {
browserContext?: unknown; // This is another Deck Object that is yet to be found
bForcePopOut?: boolean;
bHideActionIcons?: boolean;
bHideMainWindowForPopouts?: boolean;
bNeverPopOut?: boolean;
fnOnClose?: () => void; // Seems to be the same as "closeModal" callback, but only when the modal is a popout. Will no longer work after "Update" invocation!
popupHeight?: number;
popupWidth?: number;
promiseRenderComplete?: Promise<void>; // Invoked once the render is complete. Currently, it seems to be used as image loading success/error callback...
strTitle?: string;
}
export interface ShowModalResult {
// This method will not invoke any of the variations of "closeModal" callbacks!
Close: () => void;
// This method will replace the modal element completely and will not update the callback chains,
// meaning that "closeModal" and etc. will not automatically close the modal anymore (also "fnOnClose"
// will not be even called upon close anymore)! You have to manually call the "Close" method when, for example,
// the "closeModal" is invoked in the newly updated modal:
// <ModalRoot closeModal={() => { console.log("ABOUT TO CLOSE"); showModalRes.Close(); }} />
Update: (modal: ReactNode) => void;
}
export const showModal: (modal: ReactNode, parent?: EventTarget, props?: ShowModalProps) => Promise<ShowModalResult> = findModuleChild((m) => {
if (typeof m !== 'object') return undefined; if (typeof m !== 'object') return undefined;
for (let prop in m) { for (let prop in m) {
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) { if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
@@ -24,10 +48,18 @@ export interface ModalRootProps {
bDisableBackgroundDismiss?: boolean; bDisableBackgroundDismiss?: boolean;
bHideCloseIcon?: boolean; bHideCloseIcon?: boolean;
bOKDisabled?: boolean; bOKDisabled?: boolean;
bCancelDisabled?: boolean;
} }
export interface ConfirmModalProps extends ModalRootProps { export interface ConfirmModalProps extends ModalRootProps {
onMiddleButton?(): void; onMiddleButton?(): void; // setting this prop will enable the middle button
strTitle?: ReactNode;
strDescription?: ReactNode;
strOKButtonText?: ReactNode;
strCancelButtonText?: ReactNode;
strMiddleButtonText?: ReactNode;
bAlertDialog?: boolean; // This will open a modal with only OK button enabled
bMiddleDisabled?: boolean;
} }
export const ConfirmModal = findModuleChild((m) => { export const ConfirmModal = findModuleChild((m) => {
@@ -46,4 +78,4 @@ export const ModalRoot = findModuleChild((m) => {
return m[prop]; return m[prop];
} }
} }
}) as FC<ModalRootProps>; }) as FC<ModalRootProps>;