Compare commits

..

5 Commits

Author SHA1 Message Date
semantic-release-bot
cd61f57a6f chore(release): 3.0.0 [CI SKIP] 2022-09-09 20:19:05 +00:00
AAGaming
8eb921e8b7 feat(serverAPI): add FilePicker 2022-09-09 16:18:06 -04:00
AAGaming
26017e7de4 feat(modal): add more props, refactor
BREAKING CHANGE: ModalRoot ->ConfirmModal
add the actual ModalRoot which does not contain buttons
2022-09-09 16:17:44 -04:00
AAGaming
71c7afa1a6 fix(textfield): extend HTMLAttributes 2022-09-09 16:16:15 -04:00
AAGaming
d6a08feca0 fix(button): add style prop 2022-09-09 16:15:51 -04:00
7 changed files with 49 additions and 10 deletions

View File

@@ -1,3 +1,23 @@
# [3.0.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v2.0.0...v3.0.0) (2022-09-09)
### Bug Fixes
* **button:** add style prop ([d6a08fe](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d6a08feca0f7c42e88b4d227b2953a28ac6c424d))
* **textfield:** extend HTMLAttributes ([71c7afa](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/71c7afa1a641b6651e6e73ff5575b665e5e3c48e))
### Features
* **modal:** add more props, refactor ([26017e7](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/26017e7de4600cc677a8a1e0881f2e58b3d5fe65))
* **serverAPI:** add FilePicker ([8eb921e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/8eb921e8b787a8e5045badff58cd9a1a54038692))
### BREAKING CHANGES
* **modal:** ModalRoot ->ConfirmModal
add the actual ModalRoot which does not contain buttons
# [2.0.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.8.3...v2.0.0) (2022-09-04)

4
package-lock.json generated
View File

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

View File

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

View File

@@ -1,8 +1,9 @@
import { FC } from 'react';
import { CSSProperties, FC } from 'react';
import { CommonUIModule } from '../webpack';
export interface ButtonProps {
style: CSSProperties;
className?: string;
noFocusRing?: boolean;
disabled?: boolean;

View File

@@ -13,11 +13,10 @@ export const showModal: (children: ReactNode, parent?: EventTarget) => void = fi
});
export interface ModalRootProps {
onMiddleButton?(): void;
onCancel?(): void;
closeModal?(): void;
onOK?(): void;
onEscKeypress?(): void;
closeModal?(): void;
className?: string;
modalClassName?: string;
bAllowFullSize?: boolean;
@@ -27,11 +26,24 @@ export interface ModalRootProps {
bOKDisabled?: boolean;
}
export const ModalRoot = findModuleChild((m) => {
export interface ConfirmModalProps extends ModalRootProps {
onMiddleButton?(): void;
}
export const ConfirmModal = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (!m[prop]?.prototype?.OK && m[prop]?.prototype?.Cancel && m[prop]?.prototype?.render) {
return m[prop];
}
}
}) as FC<ModalRootProps>;
}) as FC<ConfirmModalProps>;
export const ModalRoot = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.prototype?.OK && m[prop]?.prototype?.Cancel && m[prop]?.prototype?.render) {
return m[prop];
}
}
}) as FC<ModalRootProps>;

View File

@@ -1,8 +1,8 @@
import { ChangeEventHandler, ReactNode, VFC } from 'react';
import { ChangeEventHandler, HTMLAttributes, ReactNode, VFC } from 'react';
import { CommonUIModule, Module } from '../webpack';
export interface TextFieldProps {
export interface TextFieldProps extends HTMLAttributes<HTMLInputElement> {
label?: ReactNode;
requiredLabel?: ReactNode;
description?: ReactNode;

View File

@@ -45,9 +45,15 @@ export interface Toaster {
toast(toast: ToastData): void;
}
export interface FilePickerRes {
path: string;
realpath: string;
}
export interface ServerAPI {
routerHook: RouterHook;
toaster: Toaster;
openFilePicker(startPath: string, includeFiles?: boolean, regex?: RegExp): Promise<FilePickerRes>
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
fetchNoCors<TRes = {}>(url: RequestInfo, request?: RequestInit): Promise<ServerResponse<TRes>>;