Compare commits

..

94 Commits

Author SHA1 Message Date
semantic-release-bot
d46251bb91 chore(release): 1.3.0 [CI SKIP] 2022-08-02 22:55:55 +00:00
AAGaming
5b29447cfa feat(plugin): api for patching existing routes 2022-08-02 18:50:39 -04:00
TrainDoctor
e993d06963 Update README.md 2022-07-28 15:28:50 -07:00
semantic-release-bot
a3c136a07e chore(release): 1.2.4 [CI SKIP] 2022-07-25 19:44:53 +00:00
AAGaming
994b9e2cc6 fix(Modal): add closeModal 2022-07-25 15:44:06 -04:00
semantic-release-bot
801d70f300 chore(release): 1.2.3 [CI SKIP] 2022-07-25 19:34:45 +00:00
AAGaming
2fdfcdd478 fix(Modal): add another prop 2022-07-25 15:33:35 -04:00
semantic-release-bot
9a728611f4 chore(release): 1.2.2 [CI SKIP] 2022-07-25 19:30:30 +00:00
AAGaming
97997adfaf fix(Modal): add more props to typings 2022-07-25 15:29:38 -04:00
semantic-release-bot
279069ee34 chore(release): 1.2.1 [CI SKIP] 2022-07-13 01:07:46 +00:00
AAGaming
944a9024ff fix(ProgressBar): extend correct prop type 2022-07-12 21:06:46 -04:00
AAGaming
0a2220b4b4 chore(ProgressBar): formatting 2022-07-12 20:45:56 -04:00
semantic-release-bot
aa567e9dd0 chore(release): 1.2.0 [CI SKIP] 2022-07-13 00:34:28 +00:00
AAGaming
d9e4ff3ebd feat(ProgressBar): add new progress bars 2022-07-12 20:33:38 -04:00
semantic-release-bot
79d73dea2e chore(release): 1.1.0 [CI SKIP] 2022-07-09 14:34:48 +00:00
hulkrelax
602f93ae6a feat(Router.tsx): adds more methods to router (#9)
Adds the ability to get the main running app and to navigate to the running app
2022-07-09 10:34:09 -04:00
semantic-release-bot
d86c86cd80 chore(release): 1.0.2 [CI SKIP] 2022-07-07 04:03:42 +00:00
AAGaming
51c418d560 fix(Plugin): support non-ui plugins 2022-07-07 00:00:40 -04:00
semantic-release-bot
95de7346df chore(release): 1.0.1 [CI SKIP] 2022-06-29 15:53:25 +00:00
AAGaming
58933f827c fix(package): enable tree shaking 2022-06-29 11:50:20 -04:00
hulkrelax
0ff3476987 bugfix: Fix issue with incorrect typing on fetchNoCors (#7)
* make fetchNoCors have similar typing to fetch

* request param should be optional
2022-06-28 21:12:44 -04:00
semantic-release-bot
2c7d266c81 chore(release): 1.0.0 [CI SKIP] 2022-06-23 02:58:38 +00:00
AAGaming
9bd96227a0 refactor(components): rename Field components
BREAKING CHANGE: Toggle -> ToggleField Slider -> SliderField & add Toggle component
2022-06-22 22:57:51 -04:00
semantic-release-bot
ddafa5666d chore(release): 0.12.3 [CI SKIP] 2022-06-23 02:45:11 +00:00
AAGaming
46977496fd fix(Field): description is a string you idiot 2022-06-22 22:44:13 -04:00
semantic-release-bot
71a6c79384 chore(release): 0.12.2 [CI SKIP] 2022-06-23 01:53:07 +00:00
AAGaming
da4c79b5ae fix(Field): title -> label 2022-06-22 21:52:17 -04:00
semantic-release-bot
7b04bf5827 chore(release): 0.12.1 [CI SKIP] 2022-06-23 01:47:38 +00:00
AAGaming
a87e1bb46f fix(components): export FIeld 2022-06-22 21:46:50 -04:00
semantic-release-bot
b6e2e7e4dc chore(release): 0.12.0 [CI SKIP] 2022-06-23 01:45:47 +00:00
AAGaming
7d82a82e9c feat(components): add Field 2022-06-22 21:44:46 -04:00
semantic-release-bot
0cee60d122 chore(release): 0.11.1 [CI SKIP] 2022-06-23 00:42:16 +00:00
AAGaming
7efc0347f7 fix(Router): make specifying quick access tab not required 2022-06-22 20:41:22 -04:00
semantic-release-bot
d227858e62 chore(release): 0.11.0 [CI SKIP] 2022-06-20 21:37:03 +00:00
AAGaming
db64f34725 feat(utils): add sleep util 2022-06-20 17:35:56 -04:00
semantic-release-bot
b08aadb810 chore(release): 0.10.5 [CI SKIP] 2022-06-20 03:15:39 +00:00
AAGaming
2afb7f16bb fix(patcher): why the hell did i do it that way 2022-06-19 23:14:52 -04:00
semantic-release-bot
32d1303191 chore(release): 0.10.4 [CI SKIP] 2022-06-19 15:40:15 +00:00
AAGaming
1ce15d261f fix(plugin): correct return type on injectCssIntoTab 2022-06-19 11:39:35 -04:00
semantic-release-bot
bf52e0761c chore(release): 0.10.3 [CI SKIP] 2022-06-18 15:16:51 +00:00
AAGaming
823a2745f9 fix(ServerAPI): add injectCssIntoTab to serverAPI typings 2022-06-18 11:10:35 -04:00
semantic-release-bot
21f7874cab chore(release): 0.10.2 [CI SKIP] 2022-06-16 21:33:44 +00:00
AAGaming
077334e376 fix(Router): add NavigateBackOrOpenMenu() 2022-06-16 17:32:58 -04:00
semantic-release-bot
02f4c5c518 chore(release): 0.10.1 [CI SKIP] 2022-06-16 21:27:22 +00:00
AAGaming
f1e20cd0b5 fix(Focusable): add ref prop, fix event types 2022-06-16 17:26:31 -04:00
Jonas Dellinger
b5d9265705 chore(release): also include package-lock.json in release assets 2022-06-13 10:53:01 +02:00
semantic-release-bot
734ce33e1b chore(release): 0.10.0 [CI SKIP] 2022-06-10 20:57:30 +00:00
AAGaming
9beab5f7e9 feat(components): remove HorizontalFocus, add Focusable 2022-06-10 16:56:39 -04:00
semantic-release-bot
33aaf56f96 chore(release): 0.9.1 [CI SKIP] 2022-06-09 02:08:28 +00:00
AAGaming
dddb703a2e fix(SuspensefulImage): fix export 2022-06-08 22:07:51 -04:00
semantic-release-bot
ea2e072085 chore(release): 0.9.0 [CI SKIP] 2022-06-09 01:59:56 +00:00
AAGaming
6324282b48 feat(custom-components): add SuspensefulImage 2022-06-08 21:59:12 -04:00
semantic-release-bot
ace3f95a33 chore(release): 0.8.0 [CI SKIP] 2022-06-09 01:41:07 +00:00
AAGaming
4d30efc33b feat(components): add HorizontalFocus 2022-06-08 21:40:19 -04:00
semantic-release-bot
af2d3a29e2 chore(release): 0.7.2 [CI SKIP] 2022-06-08 22:30:10 +00:00
AAGaming
e5e561edd6 fix(package): fix pnpm peer dependencies errors 2022-06-08 18:29:27 -04:00
semantic-release-bot
7111d18667 chore(release): 0.7.1 [CI SKIP] 2022-06-08 21:55:07 +00:00
AAGaming
24244f6e91 fix(spinners): add SVG props 2022-06-08 17:54:20 -04:00
AAGaming
dd5c42c57d fix(Router): add NavigateToStore to interface 2022-06-08 17:53:49 -04:00
semantic-release-bot
09ab2fed4b chore(release): 0.7.0 [CI SKIP] 2022-06-08 17:25:30 +00:00
Jonas Dellinger
4328385391 feat(components): added shared item-props, progressbar, and more types for slider 2022-06-08 19:24:53 +02:00
semantic-release-bot
3fe986aaba chore(release): 0.6.0 [CI SKIP] 2022-06-08 08:00:06 +00:00
Jonas Dellinger
bc2bec4b83 fix(husky): wrong script for husky caused problems when installing 2022-06-08 09:59:20 +02:00
Jonas Dellinger
a99fb4a22d feat(dropdown): add dropdown 2022-06-08 09:59:20 +02:00
Jonas Dellinger
d8794ef4d3 feat(sidebar-navigation): add sidebar navigation component 2022-06-08 09:59:20 +02:00
Jonas Dellinger
23ed5dd157 chore(textfield): remove console.log 2022-06-08 09:59:20 +02:00
semantic-release-bot
210b0389f7 chore(release): 0.5.1 [CI SKIP] 2022-06-06 21:33:48 +00:00
AAGaming
198f96abb5 Merge branch 'main' of github.com:steamdeckhomebrew/decky-frontend-lib 2022-06-06 17:33:08 -04:00
AAGaming
244ae128da fix(classes): switch static-classes to findModule 2022-06-06 17:33:05 -04:00
semantic-release-bot
377d7adde8 chore(release): 0.5.0 [CI SKIP] 2022-06-06 21:28:39 +00:00
AAGaming
f34b9de97f feat(utils): add joinClassNames util 2022-06-06 17:27:56 -04:00
semantic-release-bot
b5192cf590 chore(release): 0.4.2 [CI SKIP] 2022-06-06 21:21:44 +00:00
AAGaming
2e7b4b664a fix(classes): add gamepadDialogClasses and quickAccessControlsClasses 2022-06-06 17:20:55 -04:00
semantic-release-bot
b92e6a5b9d chore(release): 0.4.1 [CI SKIP] 2022-06-05 13:11:12 +00:00
Jonas Dellinger
32c355f2a7 fix(textfield): correct type for onChange callback 2022-06-05 15:10:23 +02:00
semantic-release-bot
747d70dcca chore(release): 0.4.0 [CI SKIP] 2022-06-05 13:08:53 +00:00
Jonas Dellinger
7f9dfc5910 fix(typings): export all prop types 2022-06-05 15:07:47 +02:00
Jonas Dellinger
a3c1a7c7b7 feat(textfield): extract TextField component 2022-06-05 15:06:06 +02:00
semantic-release-bot
fccfdd6f11 chore(release): 0.3.0 [CI SKIP] 2022-06-04 17:43:17 +00:00
AAGaming
f124480af8 feat(typings): add Navigate to router typings 2022-06-04 13:42:23 -04:00
semantic-release-bot
15e672afef chore(release): 0.2.0 [CI SKIP] 2022-06-04 08:54:45 +00:00
Jonas Dellinger
bf0c2b17bf feat(router): expose GetQuickAccessTab and rename QuickAccessTabs to QuickAccessTab 2022-06-04 10:54:01 +02:00
Jonas Dellinger
0625dc385a chore(release): add NPM releaser 2022-06-04 10:49:30 +02:00
semantic-release-bot
b04992d29c chore(release): 0.1.0 [CI SKIP] 2022-06-04 08:44:52 +00:00
Jonas Dellinger
228fe1f22c chore(release): fix release script by installing commitlint cli 2022-06-04 10:44:01 +02:00
Jonas Dellinger
5d4214176e chore(release): try to fix commit message when releasing 2022-06-04 10:37:09 +02:00
Jonas Dellinger
62bf0eaffa feat(router): types for steam router 2022-06-04 10:33:59 +02:00
Jonas Dellinger
43b04b267e chore(release): disable jest for now 2022-06-04 10:19:04 +02:00
Jonas Dellinger
58595d54ea chore(release): fix branch selector 2022-06-04 10:17:17 +02:00
Jonas Dellinger
aec27a18a7 chore(release): introduce release pipeline 2022-06-04 10:14:59 +02:00
Jonas Dellinger
f101e23c1c 0.0.6 2022-06-02 17:58:18 +02:00
Jonas Dellinger
5b3ea8f63f 0.0.5 2022-06-02 17:57:48 +02:00
AAGaming
07ccceb990 add modal support, showModal->showContextMenu and new showModal 2022-06-01 17:51:17 -04:00
Jonas Dellinger
536269b1b7 Expose routerhook 2022-05-30 21:00:38 +02:00
35 changed files with 13306 additions and 164 deletions

3
.commitlintrc.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}

29
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-22.04
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup | Dependencies
run: npm ci
- name: Test
run: npm test
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm exec semantic-release

4
.husky/commit-msg Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit "${1}"

17
.releaserc.json Normal file
View File

@@ -0,0 +1,17 @@
{
"branches": ["main", "dev"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"],
"message": "chore(release): ${nextRelease.version} [CI SKIP]"
}
]
]
}

275
CHANGELOG.md Normal file
View File

@@ -0,0 +1,275 @@
# [1.3.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.4...v1.3.0) (2022-08-02)
### Features
* **plugin:** api for patching existing routes ([5b29447](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/5b29447cfa597773a81aa233da9362346683505d))
## [1.2.4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.3...v1.2.4) (2022-07-25)
### Bug Fixes
* **Modal:** add closeModal ([994b9e2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/994b9e2cc6f41da3d813e6f339bd2fd30e4fa3ad))
## [1.2.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.2...v1.2.3) (2022-07-25)
### Bug Fixes
* **Modal:** add another prop ([2fdfcdd](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2fdfcdd4788ea0d6483e92729c3102212f3ec0fb))
## [1.2.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.1...v1.2.2) (2022-07-25)
### Bug Fixes
* **Modal:** add more props to typings ([97997ad](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/97997adfaf1a68ef436279e6e48f34f5eaa9531c))
## [1.2.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.2.0...v1.2.1) (2022-07-13)
### Bug Fixes
* **ProgressBar:** extend correct prop type ([944a902](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/944a9024ff20f0b596869564d014d7dd73e74254))
# [1.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.1.0...v1.2.0) (2022-07-13)
### Features
* **ProgressBar:** add new progress bars ([d9e4ff3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d9e4ff3ebd22a31306f564e7f8ad82879c8fb699))
# [1.1.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.2...v1.1.0) (2022-07-09)
### Features
* **Router.tsx:** adds more methods to router ([#9](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/9)) ([602f93a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/602f93ae6a5ceca5383b888cd4803638799558c5))
## [1.0.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.1...v1.0.2) (2022-07-07)
### Bug Fixes
* **Plugin:** support non-ui plugins ([51c418d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/51c418d560247c917125cd5534a978256724e5f3))
## [1.0.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.0.0...v1.0.1) (2022-06-29)
### Bug Fixes
* **package:** enable tree shaking ([58933f8](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/58933f827ce2e2ae9b162da4e0061a7591c5759d))
# [1.0.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.3...v1.0.0) (2022-06-23)
### Code Refactoring
* **components:** rename Field components ([9bd9622](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/9bd96227a0bb295dcc29abca71e37983307f0505))
### BREAKING CHANGES
* **components:** Toggle -> ToggleField Slider -> SliderField & add Toggle component
## [0.12.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.2...v0.12.3) (2022-06-23)
### Bug Fixes
* **Field:** description is a string you idiot ([4697749](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/46977496fd4cbe266c370fcffe59a9d9b7543a92))
## [0.12.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.1...v0.12.2) (2022-06-23)
### Bug Fixes
* **Field:** title -> label ([da4c79b](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/da4c79b5aeb3c589527e17ad29610a8e3f929b79))
## [0.12.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.12.0...v0.12.1) (2022-06-23)
### Bug Fixes
* **components:** export FIeld ([a87e1bb](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a87e1bb46f749e10ea2b94a011df48f162834c25))
# [0.12.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.11.1...v0.12.0) (2022-06-23)
### Features
* **components:** add Field ([7d82a82](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7d82a82e9c4db59832593cb6f0f78775b252dc69))
## [0.11.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.11.0...v0.11.1) (2022-06-23)
### Bug Fixes
* **Router:** make specifying quick access tab not required ([7efc034](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7efc0347f7aa22773feccb0763280c4fd1c4a231))
# [0.11.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.5...v0.11.0) (2022-06-20)
### Features
* **utils:** add sleep util ([db64f34](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/db64f3472542b080b1d470c6b8d7aa441db0bfe6))
## [0.10.5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.4...v0.10.5) (2022-06-20)
### Bug Fixes
* **patcher:** why the hell did i do it that way ([2afb7f1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2afb7f16bb219013d338bc4e002605d32235385c))
## [0.10.4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.3...v0.10.4) (2022-06-19)
### Bug Fixes
* **plugin:** correct return type on injectCssIntoTab ([1ce15d2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/1ce15d261f4726a2f8bdaff7c8a98497f2622969))
## [0.10.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.2...v0.10.3) (2022-06-18)
### Bug Fixes
* **ServerAPI:** add injectCssIntoTab to serverAPI typings ([823a274](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/823a2745f9717ed2d2a5d95e2ef25739bffc18c9))
## [0.10.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.1...v0.10.2) (2022-06-16)
### Bug Fixes
* **Router:** add NavigateBackOrOpenMenu() ([077334e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/077334e376fb42283e094f0b57c818c580c6f7ba))
## [0.10.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.10.0...v0.10.1) (2022-06-16)
### Bug Fixes
* **Focusable:** add ref prop, fix event types ([f1e20cd](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/f1e20cd0b54622d634202c85cca920323e4df336))
# [0.10.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.9.1...v0.10.0) (2022-06-10)
### Features
* **components:** remove HorizontalFocus, add Focusable ([9beab5f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/9beab5f7e913f2ef2a8a3047046a524d3007c3b8))
## [0.9.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.9.0...v0.9.1) (2022-06-09)
### Bug Fixes
* **SuspensefulImage:** fix export ([dddb703](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/dddb703a2e712bf2e9d7e172a414c63ffd6a1cc9))
# [0.9.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.8.0...v0.9.0) (2022-06-09)
### Features
* **custom-components:** add SuspensefulImage ([6324282](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/6324282b480f358a3d5936ab6d08ab239d640997))
# [0.8.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.2...v0.8.0) (2022-06-09)
### Features
* **components:** add HorizontalFocus ([4d30efc](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4d30efc33b5398b91e756695fefa91cc37f83ff1))
## [0.7.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.1...v0.7.2) (2022-06-08)
### Bug Fixes
* **package:** fix pnpm peer dependencies errors ([e5e561e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e5e561edd67994b8c55f99c1228e47d77b1c2ee2))
## [0.7.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.7.0...v0.7.1) (2022-06-08)
### Bug Fixes
* **Router:** add NavigateToStore to interface ([dd5c42c](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/dd5c42c57d9ce6266f56237607bf37d8b5bd3b4c))
* **spinners:** add SVG props ([24244f6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/24244f6e91e39a11bb964ee2779662084dcd0fd0))
# [0.7.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.6.0...v0.7.0) (2022-06-08)
### Features
* **components:** added shared item-props, progressbar, and more types for slider ([4328385](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/43283853916f3993d92f6841b12f7ee47667e75b))
# [0.6.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.5.1...v0.6.0) (2022-06-08)
### Bug Fixes
* **husky:** wrong script for husky caused problems when installing ([bc2bec4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/bc2bec4b839d691e20beb090327a359c9e93f1cc))
### Features
* **dropdown:** add dropdown ([a99fb4a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a99fb4a22dcea3b6cd2a52f0dbd274d9a10f2e35))
* **sidebar-navigation:** add sidebar navigation component ([d8794ef](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d8794ef4d36b25e600123d41696b0d5cc10dc2af))
## [0.5.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.5.0...v0.5.1) (2022-06-06)
### Bug Fixes
* **classes:** switch static-classes to findModule ([244ae12](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/244ae128da03e0687f1ba0b0e5b5b548b581277a))
# [0.5.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.4.2...v0.5.0) (2022-06-06)
### Features
* **utils:** add joinClassNames util ([f34b9de](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/f34b9de97f61eb5b075d6adedfcacfa5e097943b))
## [0.4.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.4.1...v0.4.2) (2022-06-06)
### Bug Fixes
* **classes:** add gamepadDialogClasses and quickAccessControlsClasses ([2e7b4b6](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/2e7b4b664a673b46b402b995fb58f0ce8ffbafac))
## [0.4.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.4.0...v0.4.1) (2022-06-05)
### Bug Fixes
* **textfield:** correct type for onChange callback ([32c355f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/32c355f2a7e0b6ca6592b956e8174d217766bc5c))
# [0.4.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.3.0...v0.4.0) (2022-06-05)
### Bug Fixes
* **typings:** export all prop types ([7f9dfc5](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7f9dfc5910dfc172ba161d9b63763e85eb289a43))
### Features
* **textfield:** extract TextField component ([a3c1a7c](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a3c1a7c7b73eae475574a13b6ff9c75ff78cbcb6))
# [0.3.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.2.0...v0.3.0) (2022-06-04)
### Features
* **typings:** add Navigate to router typings ([f124480](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/f124480af8082d24730ed03fdf88742f76abc026))
# [0.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.1.0...v0.2.0) (2022-06-04)
### Features
* **router:** expose GetQuickAccessTab and rename QuickAccessTabs to QuickAccessTab ([bf0c2b1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/bf0c2b17bfc4e67a8aa90cfee6a91bd1482720d4))
# [0.1.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v0.0.6...v0.1.0) (2022-06-04)
### Features
* **router:** types for steam router ([62bf0ea](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/62bf0eaffa83d85245a038ffe3819315bd02f045))

View File

@@ -1 +1,27 @@
# Decky Frontend Library
Library used to develop plugins used for use with [decky-loader](https://github.com/SteamDeckHomebrew/decky-loader).
## Decky Loader Discord [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/ZU74G2NJzk)
Please contact the developers here for questions and support that cannot be addressed via a Github issue.
## Developers and Contributors
This library is focused on usage by developers to provide custom React components based on those found in the Steam Deck's React UI.
This method allows developers to add UI elements and code without clobbering the existing UI of the deck in order to do so.
This library can also theoretically be used to extend existing UI elements of the Steam Deck UI but this has not been tested extensively.
### Getting Started (Contributors)
1. Clone the repository to your preferred location
2. If you wish to add features such as new UI components, please create a feature branch to PR to the original repo.
3. Bug/hotfixes are acceptable on the main branch,
### Getting Started (Developers)
If you would like a feature added to decky-frontend-lib, please request it via a Github issue.
If you want to start making a plugin with decky-frontend-lib, please direct your attention to the [decky-plugin-template](https://github.com/SteamDeckHomebrew/decky-plugin-template) repository.
This library can be found on [npm](https://www.npmjs.com/package/decky-frontend-lib) and as such you can pull it without a local copy for your project as needed.

12418
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,18 @@
{
"name": "decky-frontend-lib",
"version": "0.0.4",
"version": "1.3.0",
"description": "A library for building decky plugins",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.js",
"sideEffects": false,
"scripts": {
"build": "shx rm -rf dist && tsc -b",
"dev": "tsc -b -w",
"prepack": "npm run build",
"test": "jest"
"test": "echo 'No tests for now!'",
"prepare": "husky install",
"commit": "git-cz"
},
"files": [
"/lib",
@@ -32,16 +35,38 @@
"url": "https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues"
},
"homepage": "https://github.com/SteamDeckHomebrew/decky-frontend-lib#readme",
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
},
"devDependencies": {
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@commitlint/cz-commitlint": "^17.0.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/jest": "^27.4.1",
"@types/react": "16.14.0",
"@types/react-router": "5.1.18",
"commitizen": "^4.2.4",
"husky": "^8.0.1",
"import-sort-style-module": "^6.0.0",
"jest": "^27.5.1",
"prettier-plugin-import-sort": "^0.0.7",
"semantic-release": "^19.0.2",
"shx": "^0.3.4",
"ts-jest": "^27.1.4",
"typescript": "^4.6.3"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"react",
"react-dom"
]
}
},
"importSort": {
".js, .jsx, .ts, .tsx": {
"style": "module",

View File

@@ -0,0 +1,41 @@
import { Spinner } from '../deck-components';
import { useEffect } from 'react';
import { FC, ImgHTMLAttributes, useState } from 'react';
interface SuspensefulImageProps extends ImgHTMLAttributes<HTMLImageElement> {
suspenseWidth?: string | number;
suspenseHeight?: string | number;
}
export const SuspensefulImage: FC<SuspensefulImageProps> = (props) => {
const [loading, setLoading] = useState(true);
const [error, setError] = useState(false);
useEffect(() => {
const img = new Image();
img.src = props.src || '';
img.addEventListener('load', () => {
setLoading(false);
});
img.addEventListener('error', () => {
setError(true);
});
}, []);
return loading ? (
<div
style={{
width: props.suspenseWidth || props.style?.width,
height: props.suspenseHeight || props.style?.height,
background: 'rgba(255, 255, 255, 0.2)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
{error ? 'Missing image' : <Spinner style={{ height: '48px' }} />}
</div>
) : (
<img {...props} />
);
};

View File

@@ -0,0 +1 @@
export * from './SuspensefulImage';

View File

@@ -2,7 +2,7 @@ import { FC } from 'react';
import { CommonUIModule } from '../webpack';
interface ButtonProps {
export interface ButtonProps {
className?: string;
noFocusRing?: boolean;
disabled?: boolean;

View File

@@ -1,15 +1,11 @@
import { FC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
interface ButtonItemProps {
label?: string;
description?: string;
layout?: 'below';
icon?: JSX.Element;
export interface ButtonItemProps extends ItemProps {
onClick?(e: MouseEvent): void;
disabled?: boolean;
bottomSeparator?: boolean;
}
export const ButtonItem = Object.values(CommonUIModule).find((mod: any) =>

View File

@@ -0,0 +1,44 @@
import { ReactNode, VFC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
export interface SingleDropdownOption {
data: number;
label: string;
options?: never;
}
export interface MultiDropdownOption {
label: string;
options: DropdownOption[];
data?: never;
}
export type DropdownOption = SingleDropdownOption | MultiDropdownOption;
export interface DropdownProps {
rgOptions: DropdownOption[];
selectedOption: number | null;
disabled?: boolean;
onMenuWillOpen?(showMenu: () => void): void;
onMenuOpened?(): void;
onChange?(data: SingleDropdownOption): void;
contextMenuPositionOptions?: any;
menuLabel?: string;
strDefaultLabel?: string;
renderButtonValue?(element: ReactNode): ReactNode;
focusable?: boolean;
}
export const Dropdown = Object.values(CommonUIModule).find(
(mod: any) => mod?.prototype?.SetSelectedOption && mod?.prototype?.BuildMenu,
) as VFC<DropdownProps>;
export interface DropdownItemProps extends DropdownProps, ItemProps {}
export const DropdownItem = Object.values(CommonUIModule).find((mod: any) =>
mod?.toString()?.includes('"dropDownControlRef","description"'),
) as VFC<DropdownItemProps>;

View File

@@ -0,0 +1,22 @@
import { FC, HTMLAttributes, ReactNode, RefAttributes } from 'react';
import { findModuleChild } from '../webpack';
export interface FieldProps extends HTMLAttributes<HTMLDivElement> {
label?: string | ReactNode;
description?: string | ReactNode;
disabled?: boolean;
icon?: ReactNode;
childrenLayout?: string;
childrenContainerWidth?: string;
padding?: string;
highlightOnFocus?: boolean;
indentLevel?: number;
verticalAlignment?: string;
}
export const Field = findModuleChild((m) => {
if (typeof m !== "object") return undefined;
for (let prop in m) {
if (m[prop]?.render?.toString().includes('"shift-children-below"')) return m[prop]
}
}) as FC<FieldProps & RefAttributes<HTMLDivElement>>;

View File

@@ -0,0 +1,19 @@
import { HTMLAttributes, ReactNode, RefAttributes, VFC } from "react";
import { findModuleChild } from "../webpack";
export interface FocusableProps extends HTMLAttributes<HTMLDivElement> {
children: ReactNode;
"flow-children"?: string;
focusClassName?: string;
focusWithinClassName?: string;
onActivate?: (e: CustomEvent) => void;
onCancel?: (e: CustomEvent) => void;
}
export const Focusable = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",'))
return m[prop];
}
}) as VFC<FocusableProps & RefAttributes<HTMLDivElement>>;

View File

@@ -0,0 +1,11 @@
import { ReactNode } from 'react';
export interface ItemProps {
label?: string;
description?: string;
layout?: 'below' | 'inline';
icon?: ReactNode;
bottomSeparator?: boolean;
indentLevel?: number;
tooltip?: string;
}

15
src/deck-components/Menu.tsx Normal file → Executable file
View File

@@ -1,8 +1,17 @@
import { FC } from 'react';
import { FC, ReactNode } from 'react';
import { findModuleChild } from '../webpack';
interface MenuProps {
export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (typeof m[prop] === 'function' && m[prop].toString().includes('stopPropagation))')) {
return m[prop];
}
}
});
export interface MenuProps {
label: string;
onCancel?(): void;
cancelText?: string;
@@ -18,7 +27,7 @@ export const Menu: FC<MenuProps> = findModuleChild((m) => {
}
});
interface MenuItemProps {
export interface MenuItemProps {
onSelected?(): void;
}

31
src/deck-components/Modal.tsx Normal file → Executable file
View File

@@ -1,12 +1,37 @@
import { ReactNode } from 'react';
import { FC, ReactNode } from 'react';
import { findModuleChild } from '../webpack';
export const showModal: (children: ReactNode, parent: EventTarget) => void = findModuleChild((m) => {
// TODO: there is another argument, figure out what it does
export const showModal: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (typeof m[prop] === 'function' && m[prop].toString().includes('stopPropagation))')) {
if (typeof m[prop] === 'function' && m[prop].toString().includes('bHideMainWindowForPopouts:!0')) {
return m[prop];
}
}
});
export interface ModalRootProps {
onMiddleButton?(): void;
onCancel?(): void;
onOK?(): void;
onEscKeypress?(): void;
closeModal?(): void;
className?: string;
modalClassName?: string;
bAllowFullSize?: boolean;
bDestructiveWarning?: boolean;
bDisableBackgroundDismiss?: boolean;
bHideCloseIcon?: boolean;
bOKDisabled?: boolean;
}
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

@@ -2,7 +2,7 @@ import { FC } from 'react';
import { findModuleChild } from '../webpack';
interface PanelSectionProps {
export interface PanelSectionProps {
title?: string;
spinner?: boolean;
}

View File

@@ -0,0 +1,44 @@
import { VFC, ReactNode } from 'react';
import { findModuleChild } from '../webpack';
import { ItemProps } from './Item';
export interface ProgressBarItemProps extends ItemProps {
indeterminate?: boolean;
nTransitionSec?: number;
nProgress?: number;
focusable?: boolean;
}
export interface ProgressBarProps {
indeterminate?: boolean;
nTransitionSec?: number;
nProgress?: number;
focusable?: boolean;
}
export interface ProgressBarWithInfoProps extends ProgressBarItemProps {
sTimeRemaining?: ReactNode;
sOperationText?: ReactNode;
}
export const ProgressBar = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.toString()?.includes('.ProgressBar,"standard"==')) return m[prop];
}
}) as VFC<ProgressBarProps>;
export const ProgressBarWithInfo = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.toString()?.includes('.ProgressBarFieldStatus},')) return m[prop];
}
}) as VFC<ProgressBarWithInfoProps>;
export const ProgressBarItem = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.toString()?.includes('"indeterminate","nTransitionSec"')) return m[prop];
}
}) as VFC<ProgressBarItemProps>;

View File

@@ -0,0 +1,88 @@
import { Module, findModuleChild } from '../webpack';
export enum SideMenu {
None,
Main,
QuickAccess,
}
export enum QuickAccessTab {
Notifications,
RemotePlayTogetherControls,
VoiceChat,
Friends,
Settings,
Perf,
Help,
Decky,
}
export enum DisplayStatus {
Invalid = 0,
Launching = 1,
Uninstalling = 2,
Installing = 3,
Running = 4,
Validating = 5,
Updating = 6,
Downloading = 7,
Synchronizing = 8,
ReadyToInstall = 9,
ReadyToPreload = 10,
ReadyToLaunch = 11,
RegionRestricted = 12,
PresaleOnly = 13,
InvalidPlatform = 14,
PreloadComplete = 16,
BorrowerLocked = 17,
UpdatePaused = 18,
UpdateQueued = 19,
UpdateRequired = 20,
UpdateDisabled = 21,
DownloadPaused = 22,
DownloadQueued = 23,
DownloadRequired = 24,
DownloadDisabled = 25,
LicensePending = 26,
LicenseExpired = 27,
AvailForFree = 28,
AvailToBorrow = 29,
AvailGuestPass = 30,
Purchase = 31,
Unavailable = 32,
NotLaunchable = 33,
CloudError = 34,
CloudOutOfDate = 35,
Terminating = 36,
}
export type AppOverview = {
appid: string
display_name: string
display_status: DisplayStatus
sort_as: string
}
export interface Router {
CloseSideMenus(): void;
OpenQuickAccessMenu(quickAccessTab?: QuickAccessTab): void;
GetQuickAccessTab(): QuickAccessTab;
Navigate(path: string): void;
NavigateBackOrOpenMenu(): void;
NavigateToExternalWeb(url: string): void;
NavigateToRunningApp(replace?: boolean): void;
NavigateToStore(): void;
ToggleSideMenu(sideMenu: SideMenu): void;
CloseSideMenus(): void;
OpenSideMenu(sideMenu: SideMenu): void;
OpenPowerMenu(unknown?: any): void;
get RunningApps(): any;
get MainRunningApp(): AppOverview | undefined;
}
export const Router = findModuleChild((m: Module) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.Navigate && m[prop]?.NavigationManager) return m[prop];
}
}) as Router;

View File

@@ -0,0 +1,25 @@
import { ReactNode, VFC } from 'react';
import { Module, findModuleChild } from '../webpack';
export interface SidebarNavigationPages {
title: string;
route: string;
content: ReactNode;
}
export interface SidebarNavigationProps {
title?: string;
pages: SidebarNavigationPages[];
showTitle?: boolean;
disableRouteReporting?: boolean;
}
export const SidebarNavigation = findModuleChild((mod: Module) => {
for (let prop in mod) {
if (mod[prop]?.toString()?.includes('"disableRouteReporting"')) {
return mod[prop];
}
}
return null;
}) as VFC<SidebarNavigationProps>;

View File

@@ -1,26 +0,0 @@
import { FC } from 'react';
import { CommonUIModule } from '../webpack';
interface NotchLabel {
notchIndex: number;
label: string;
value: number;
}
interface SliderProps {
label?: string;
value: number;
layout?: 'below';
icon?: JSX.Element;
min?: number;
max?: number;
step?: number;
notchCount?: number;
notchLabels?: NotchLabel[];
onChange?(value: number): void;
}
export const Slider = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('SliderField,fallback'),
) as FC<SliderProps>;

View File

@@ -0,0 +1,32 @@
import { FC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
export interface NotchLabel {
notchIndex: number;
label: string;
value?: number;
}
export interface SliderFieldProps extends ItemProps {
value: number;
min?: number;
max?: number;
step?: number;
notchCount?: number;
notchLabels?: NotchLabel[];
notchTicksVisible?: boolean;
showValue?: boolean;
resetValue?: number;
disabled?: boolean;
editableValue?: boolean;
validValues?: 'steps' | 'range' | ((value: number) => boolean);
valueSuffix?: string;
minimumDpadGranularity?: number;
onChange?(value: number): void;
}
export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
mod?.toString()?.includes('SliderField,fallback'),
) as FC<SliderFieldProps>;

14
src/deck-components/Spinner.tsx Normal file → Executable file
View File

@@ -1,16 +1,8 @@
import { FC } from 'react';
import { FC, SVGAttributes } from 'react';
import { IconsModule } from '../webpack';
// interface ButtonProps {
// label?: string;
// description?: string;
// layout?: 'below';
// onClick?(e: MouseEvent): void;
// disabled?: boolean;
// bottomSeparator?: boolean;
// }
// TODO type this and other icons?
export const Spinner = Object.values(IconsModule).find((mod: any) =>
mod?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(mod.toString())
) as FC<{}>;
) as FC<SVGAttributes<SVGElement>>;

View File

@@ -0,0 +1,9 @@
import { FC, SVGAttributes } from 'react';
import { findModuleChild } from '../webpack';
export const SteamSpinner = findModuleChild((m) => {
if (typeof m !== "object") return undefined;
for (let prop in m) {
if (m[prop]?.toString()?.includes("Steam Spinner") && m[prop].toString().includes("PreloadThrobber")) return m[prop]
}
}) as FC<SVGAttributes<SVGElement>>;

View File

@@ -0,0 +1,27 @@
import { ChangeEventHandler, ReactNode, VFC } from 'react';
import { CommonUIModule, Module } from '../webpack';
export interface TextFieldProps {
label?: ReactNode;
requiredLabel?: ReactNode;
description?: ReactNode;
bShowCopyAction?: boolean;
bShowClearAction?: boolean;
bAlwaysShowClearAction?: boolean;
bIsPassword?: boolean;
rangeMin?: number;
rangeMax?: number;
mustBeNumeric?: boolean;
mustBeURL?: boolean;
mustBeEmail?: boolean;
focusOnMount?: boolean;
tooltip?: string;
inlineControls?: ReactNode;
onChange?: ChangeEventHandler<HTMLInputElement>;
value?: string;
}
export const TextField = Object.values(CommonUIModule).find(
(mod: Module) => mod?.validateUrl && mod?.validateEmail,
) as VFC<TextFieldProps>;

View File

@@ -2,15 +2,13 @@ import { FC } from 'react';
import { CommonUIModule } from '../webpack';
interface ToggleProps {
label?: string;
description?: string;
checked: boolean;
icon?: JSX.Element;
export interface ToggleProps {
value: boolean;
disabled?: boolean;
onChange?(checked: boolean): void;
navRef?: any; // TODO figure out what this is
}
export const Toggle = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('ToggleField,fallback'),
mod?.render?.toString()?.includes('.ToggleOff)'),
) as FC<ToggleProps>;

View File

@@ -0,0 +1,14 @@
import { FC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
export interface ToggleFieldProps extends ItemProps {
checked: boolean;
disabled?: boolean;
onChange?(checked: boolean): void;
}
export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('ToggleField,fallback'),
) as FC<ToggleFieldProps>;

11
src/deck-components/index.ts Normal file → Executable file
View File

@@ -1,9 +1,18 @@
export * from './Button';
export * from './ButtonItem';
export * from './Dropdown';
export * from './Field';
export * from './Focusable';
export * from './Menu';
export * from './Modal';
export * from './Panel';
export * from './Slider';
export * from './ProgressBar';
export * from './Router';
export * from './SidebarNavigation';
export * from './SliderField';
export * from './Spinner';
export * from './static-classes';
export * from './SteamSpinner';
export * from './TextField';
export * from './Toggle';
export * from './ToggleField';

View File

@@ -1,4 +1,4 @@
import { findModuleChild } from '../webpack';
import { findModule } from '../webpack';
type StaticClasses = Record<
| 'ActiveTab'
@@ -63,10 +63,126 @@ type StaticClasses = Record<
string
>;
export const staticClasses: StaticClasses = findModuleChild((mod) => {
type GamepadDialogClasses = Record<
| 'duration-app-launch'
| 'GamepadDialogContent'
| 'GamepadDialogContent_InnerWidth'
| 'Field'
| 'Button'
| 'NoMinWidth'
| 'ActiveAndUnfocused'
| 'StandaloneFieldSeparator'
| 'StandardPadding'
| 'CompactPadding'
| 'WithDescription'
| 'WithBottomSeparatorStandard'
| 'WithBottomSeparatorThick'
| 'HighlightOnFocus'
| 'ItemFocusAnim-darkerGrey'
| 'ItemFocusAnim-darkGrey'
| 'WithBottomSeparator'
| 'Disabled'
| 'Clickable'
| 'FieldClickTarget'
| 'FieldChildren'
| 'FieldLeadIcon'
| 'FieldLabelRow'
| 'VerticalAlignCenter'
| 'InlineWrapShiftsChildrenBelow'
| 'ExtraPaddingOnChildrenBelow'
| 'ChildrenWidthFixed'
| 'ChildrenWidthGrow'
| 'WithFirstRow'
| 'WithChildrenBelow'
| 'FieldLabel'
| 'FieldLabelValue'
| 'FieldDescription'
| 'ModalPosition'
| 'WithStandardPadding'
| 'slideInAnimation'
| 'BasicTextInput'
| 'Toggle'
| 'ToggleRail'
| 'On'
| 'ToggleSwitch'
| 'LabelFieldValue'
| 'DropDownControlButtonContents'
| 'Spacer'
| 'ControlsListOuterPanel'
| 'StandardSpacing'
| 'ExtraSpacing'
| 'AlignRight'
| 'AlignLeft'
| 'AlignCenter'
| 'ControlsListChild'
| 'QuickAccess-Menu'
| 'BigButtons'
| 'BottomButtons'
| 'ItemFocusAnim-darkerGrey-nocolor'
| 'ItemFocusAnim-grey'
| 'ItemFocusAnimBorder-darkGrey'
| 'ItemFocusAnim-green'
| 'focusAnimation'
| 'hoverAnimation',
string
>;
type QuickAccessControlsClasses = Record<
| 'duration-app-launch'
| 'PanelSection'
| 'PanelSectionTitle'
| 'Text'
| 'PanelSectionRow'
| 'Label'
| 'ComingSoon'
| 'LowBattery'
| 'ReallyLow'
| 'LowBatteryGauge'
| 'Remaining'
| 'EmptyNotifications'
| 'BatterySectionContainer'
| 'BatteryIcon'
| 'BatteryPercentageLabel'
| 'BatteryDetailsLabels'
| 'BatteryProjectedValue'
| 'BatteryProjectedLabel'
| 'ItemFocusAnim-darkerGrey-nocolor'
| 'ItemFocusAnim-darkerGrey'
| 'ItemFocusAnim-darkGrey'
| 'ItemFocusAnim-grey'
| 'ItemFocusAnimBorder-darkGrey'
| 'ItemFocusAnim-green'
| 'focusAnimation'
| 'hoverAnimation',
string
>;
export const staticClasses: StaticClasses = findModule((mod) => {
if (typeof mod !== 'object') return false;
if (mod.TransitionMenuDelay) {
return mod;
return true;
}
return false;
});
export const gamepadDialogClasses: GamepadDialogClasses = findModule((mod) => {
if (typeof mod !== 'object') return false;
if (mod.WithFirstRow) {
return true;
}
return false;
});
export const quickAccessControlsClasses: QuickAccessControlsClasses = findModule((mod) => {
if (typeof mod !== 'object') return false;
if (mod.PanelSectionRow) {
return true;
}
return false;
});

View File

@@ -1,4 +1,5 @@
// export * from './deck-libs';
export * from './custom-components';
export * from './deck-components';
export * from './plugin';
export * from './webpack';

View File

@@ -1,7 +1,10 @@
import type { ComponentType } from 'react';
import { RouteProps } from 'react-router';
export interface Plugin {
title: JSX.Element;
icon: JSX.Element;
content: JSX.Element;
content?: JSX.Element;
onDismount?(): void;
}
@@ -17,11 +20,22 @@ interface ServerResponseError {
type ServerResponse<TRes> = ServerResponseSuccess<TRes> | ServerResponseError;
type RoutePatch = (route: RouteProps) => RouteProps;
interface RouterHook {
addRoute(path: string, component: ComponentType, props?: Omit<RouteProps, 'path' | 'children'>): void;
addPatch(path: string, patch: RoutePatch): RoutePatch;
removePatch(path: string, patch: RoutePatch): void;
removeRoute(path: string): void;
}
export interface ServerAPI {
routerHook: RouterHook;
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
fetchNoCors<TRes = {}>(url: string, request: RequestInfo): Promise<ServerResponse<TRes>>;
fetchNoCors<TRes = {}>(url: RequestInfo, request?: RequestInit): Promise<ServerResponse<TRes>>;
executeInTab(tab: string, runAsync: boolean, code: string): Promise<unknown>;
injectCssIntoTab<TRes = string>(tab: string, style: string): Promise<ServerResponse<TRes>>;
removeCssFromTab(tab: string, cssId: string): Promise<unknown>;
}

View File

@@ -42,7 +42,7 @@ export function fakeRenderComponent(fun: Function): any {
return res;
}
export function beforePatch(obj: any, name: string, fnc: Function): void {
export function beforePatch(obj: any, name: string, fnc: (args: any[]) => any): void {
const orig = obj[name];
obj[name] = function (...args: any[]) {
fnc.call(this, args);
@@ -53,7 +53,7 @@ export function beforePatch(obj: any, name: string, fnc: Function): void {
obj[name].__deckyOrig = orig;
}
export function afterPatch(obj: any, name: string, fnc: Function): void {
export function afterPatch(obj: any, name: string, fnc: (args: any[], ret: any) => any): void {
const orig = obj[name];
obj[name] = function (...args: any[]) {
let ret = orig.call(this, ...args);
@@ -65,7 +65,7 @@ export function afterPatch(obj: any, name: string, fnc: Function): void {
obj[name].__deckyOrig = orig;
}
export function replacePatch(obj: any, name: string, fnc: Function): void {
export function replacePatch(obj: any, name: string, fnc: (args: any[]) => any): void {
const orig = obj[name];
obj[name] = function (...args: any[]) {
const ret = fnc.call(this, args);
@@ -85,3 +85,11 @@ export function unpatch(obj: any, name: any): void {
export function getReactInstance(o: HTMLElement | Element | Node) {
return o[Object.keys(o).find(k => k.startsWith('__reactInternalInstance')) as string]
}
export function joinClassNames(...classes: string[]): string {
return classes.join(" ");
}
export function sleep(ms: number) {
return new Promise(res => setTimeout(res, ms));
}

View File

@@ -5,7 +5,7 @@ declare global {
}
// TODO
type Module = any;
export type Module = any;
type FilterFn = (module: any) => boolean;
type FindFn = (module: any) => any;
@@ -59,23 +59,17 @@ export const CommonUIModule = allModules.find((m: Module) => {
});
export const IconsModule = findModule((m: Module) => {
if (typeof m !== "object") return false;
if (typeof m !== 'object') return false;
for (let prop in m) {
if (m[prop]?.toString && /Spinner\)}\),.\.createElement\(\"path\",{d:\"M18 /.test(m[prop].toString())) return true;
}
return false;
})
export const Router = findModuleChild((m: Module) => {
if (typeof m !== "object") return undefined;
for (let prop in m) {
if (m[prop]?.Navigate && m[prop]?.NavigationManager) return m[prop]
}
})
});
export const ReactRouter = allModules.find((m: Module) => {
if (typeof m !== "object") return undefined;
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (m[prop]?.computeRootMatch) return true
if (m[prop]?.computeRootMatch) return true;
}
return false;
})
});