Compare commits

..

37 Commits

Author SHA1 Message Date
semantic-release-bot
7e7a325cd9 chore(release): 4.9.2 [CI SKIP] 2025-03-29 13:02:17 +00:00
Lukas Senionis
41d0555d31 fix(SidebarNavigation): change title to ReactNode type (#117) 2025-03-29 09:01:51 -04:00
semantic-release-bot
716f947710 chore(release): 4.9.1 [CI SKIP] 2025-01-29 04:57:54 +00:00
TrainDoctor
ed7ba9bbb6 Merge pull request #116 from ricewind012/patch-1
fix(Menu): add missing arg to showContextMenu and document it
2025-01-28 20:57:28 -08:00
ricewind012
c03db3e0d5 fix(Menu): add missing arg to showContextMenu and document it 2025-01-25 12:23:52 +00:00
TrainDoctor
aef063d2e2 Merge pull request #112 from SteamDeckHomebrew/dependabot/npm_and_yarn/micromatch-4.0.8
chore(deps): bump micromatch from 4.0.7 to 4.0.8
2025-01-14 12:40:51 -08:00
dependabot[bot]
33e5d8541d chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 (#114)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-10 07:43:59 -05:00
semantic-release-bot
9c34100215 chore(release): 4.9.0 [CI SKIP] 2025-01-02 20:11:27 +00:00
Party Wumpus
a1507ac55b Merge pull request #115 from alvaro-cuesta/feat/menu-separator
feat: add `MenuSeparator` component
2025-01-02 20:11:00 +00:00
Álvaro Cuesta
484a882015 feat: add MenuSeparator component 2024-12-27 14:30:35 +01:00
semantic-release-bot
200125cb98 chore(release): 4.8.3 [CI SKIP] 2024-12-14 03:28:48 +00:00
AAGaming
5ab8472ffe Merge branch 'main' of github.com:steamdeckhomebrew/decky-frontend-lib 2024-12-13 22:28:22 -05:00
AAGaming
a43cd7f3c5 fix(utils): add new nav root name 2024-12-13 22:27:26 -05:00
semantic-release-bot
41401b1d01 chore(release): 4.8.2 [CI SKIP] 2024-11-20 19:50:37 +00:00
Lukas Senionis
8117693427 fix(Footer): add missing focus/nav properties (#113) 2024-11-20 14:50:10 -05:00
dependabot[bot]
d80c047580 chore(deps): bump micromatch from 4.0.7 to 4.0.8
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.7 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.7...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-15 17:46:54 +00:00
semantic-release-bot
d6ecba605d chore(release): 4.8.1 [CI SKIP] 2024-10-11 19:00:25 +00:00
AAGaming
bf58e08e4b fix(DialogCheckbox): prevent some potential issues in dialogcheckbox 2024-10-11 14:59:42 -04:00
AAGaming
e965816144 fix(*): prevent issues where toString may not be a function (what) 2024-10-11 14:47:27 -04:00
semantic-release-bot
59ce9e450c chore(release): 4.8.0 [CI SKIP] 2024-10-05 03:52:37 +00:00
AAGaming
980df687e7 fix(components/Router): dont break in desktop ui 2024-10-04 23:52:04 -04:00
AAGaming
bea9ac7774 fix(components/Modal): dont break in desktop ui 2024-10-04 23:51:49 -04:00
AAGaming
063dedbbc1 feat(utils/react): add some window-related utils 2024-10-04 23:51:36 -04:00
semantic-release-bot
723e2ff76e chore(release): 4.7.4 [CI SKIP] 2024-10-04 17:16:01 +00:00
AAGaming
241b22cad7 fix(DialogCheckbox): don't access getters to prevent their side effects from breaking the component 2024-10-04 13:15:29 -04:00
semantic-release-bot
93c59d8026 chore(release): 4.7.3 [CI SKIP] 2024-10-03 20:50:33 +00:00
AAGaming
0f9fb5a3b8 fix(components): fix missing components on oct 2 2024 beta 2024-10-03 16:46:50 -04:00
semantic-release-bot
8c6043b5a7 chore(release): 4.7.2 [CI SKIP] 2024-09-16 23:30:08 +00:00
AAGaming
3aa07dc9ce fix(utils): fix potential race condition in findSP 2024-09-16 19:29:38 -04:00
semantic-release-bot
3f335b3583 chore(release): 4.7.1 [CI SKIP] 2024-08-08 18:18:52 +00:00
AAGaming
4c97097757 fix(utils/react): fix potential race condition in injectFCTrampoline 2024-08-08 14:18:19 -04:00
AAGaming
1ee43e86d6 chore(utils/react): get rid of ts-expect-error 2024-08-03 13:50:33 -04:00
AAGaming
db6ab9c448 chore(docs): add note to CloseSideMenus 2024-07-28 18:51:08 -04:00
semantic-release-bot
4646f22b0c chore(release): 4.7.0 [CI SKIP] 2024-07-28 22:18:51 +00:00
AAGaming
7eb484d55c feat(router): support desktop bpm overlay 2024-07-28 18:17:52 -04:00
AAGaming
5164f980b3 chore(stores): add SteamUIStore, securitystore 2024-07-28 18:15:51 -04:00
AAGaming
0457feec95 chore(tabs): port back to normal find 2024-07-28 18:15:34 -04:00
23 changed files with 487 additions and 220 deletions

View File

@@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- v4-dev
- main
jobs:
release:

View File

@@ -1,3 +1,94 @@
## [4.9.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.9.1...v4.9.2) (2025-03-29)
### Bug Fixes
* **SidebarNavigation:** change title to ReactNode type ([#117](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/117)) ([41d0555](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/41d0555d314f9f68d3cdcc45f454f13b952b4581))
## [4.9.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.9.0...v4.9.1) (2025-01-29)
### Bug Fixes
* **Menu:** add missing arg to showContextMenu and document it ([c03db3e](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/c03db3e0d55f2ba14a8d82ba1380e9838769efe1))
# [4.9.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.8.3...v4.9.0) (2025-01-02)
### Features
* add MenuSeparator component ([484a882](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/484a882015ceb51c2c80e08151e79056e751ac15))
## [4.8.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.8.2...v4.8.3) (2024-12-14)
### Bug Fixes
* **utils:** add new nav root name ([a43cd7f](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/a43cd7f3c56a2e30e332417e5b4abde8f4492be1))
## [4.8.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.8.1...v4.8.2) (2024-11-20)
### Bug Fixes
* **Footer:** add missing focus/nav properties ([#113](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/113)) ([8117693](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/8117693427e4dba2f3b5bd24f36704d8d5e65ae2))
## [4.8.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.8.0...v4.8.1) (2024-10-11)
### Bug Fixes
* **DialogCheckbox:** prevent some potential issues in dialogcheckbox ([bf58e08](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/bf58e08e4b5b183737c9ad43a858b642ce593f93))
* prevent issues where toString may not be a function (what) ([e965816](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e96581614471524cbf91bf962742df867ba3c3e9))
# [4.8.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.7.4...v4.8.0) (2024-10-05)
### Bug Fixes
* **components/Modal:** dont break in desktop ui ([bea9ac7](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/bea9ac777452b883c2f3f3ebf8510c22c4577cd0))
* **components/Router:** dont break in desktop ui ([980df68](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/980df687e7b7bf389f478e831f992fb9475eeb15))
### Features
* **utils/react:** add some window-related utils ([063dedb](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/063dedbbc1573a825571c675bf6bfa8a1bc1c6cd))
## [4.7.4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.7.3...v4.7.4) (2024-10-04)
### Bug Fixes
* **DialogCheckbox:** don't access getters to prevent their side effects from breaking the component ([241b22c](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/241b22cad711621a1695dfd11da857f13c3fffdf))
## [4.7.3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.7.2...v4.7.3) (2024-10-03)
### Bug Fixes
* **components:** fix missing components on oct 2 2024 beta ([0f9fb5a](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/0f9fb5a3b8ef4f9978025a28323ab080fb0e7a4c))
## [4.7.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.7.1...v4.7.2) (2024-09-16)
### Bug Fixes
* **utils:** fix potential race condition in findSP ([3aa07dc](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/3aa07dc9ce798ff8d1148424ee9e8a8bf2ba78c6))
## [4.7.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.7.0...v4.7.1) (2024-08-08)
### Bug Fixes
* **utils/react:** fix potential race condition in injectFCTrampoline ([4c97097](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/4c97097757919580a380b70785e6c161de6b03cc))
# [4.7.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.6.0...v4.7.0) (2024-07-28)
### Features
* **router:** support desktop bpm overlay ([7eb484d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7eb484d55c6be6e7844878eb47eda55591a6cf51))
# [4.6.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.5.0...v4.6.0) (2024-07-26)

View File

@@ -1,6 +1,6 @@
{
"name": "@decky/ui",
"version": "4.6.0",
"version": "4.9.2",
"description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
"main": "dist/index.js",
"types": "dist/index.d.ts",

102
pnpm-lock.yaml generated
View File

@@ -16,13 +16,13 @@ importers:
version: 19.2.2
'@commitlint/cz-commitlint':
specifier: ^19.2.0
version: 19.2.0(@types/node@20.14.2)(commitizen@4.3.0)(inquirer@9.2.23)(typescript@5.4.5)
version: 19.2.0(@types/node@20.14.2)(commitizen@4.3.0(@types/node@20.14.2)(typescript@5.4.5))(inquirer@9.2.23)(typescript@5.4.5)
'@semantic-release/changelog':
specifier: ^6.0.3
version: 6.0.3(semantic-release@24.0.0)
version: 6.0.3(semantic-release@24.0.0(typescript@5.4.5))
'@semantic-release/git':
specifier: ^10.0.1
version: 10.0.1(semantic-release@24.0.0)
version: 10.0.1(semantic-release@24.0.0(typescript@5.4.5))
'@types/jest':
specifier: ^29.5.12
version: 29.5.12
@@ -64,19 +64,19 @@ importers:
version: 0.3.4
ts-jest:
specifier: ^29.1.4
version: 29.1.4(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.4.5)
version: 29.1.4(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.2))(typescript@5.4.5)
typedoc:
specifier: ^0.25.13
version: 0.25.13(typescript@5.4.5)
typedoc-plugin-mdn-links:
specifier: ^3.1.29
version: 3.1.29(typedoc@0.25.13)
version: 3.1.29(typedoc@0.25.13(typescript@5.4.5))
typedoc-plugin-missing-exports:
specifier: ^2.3.0
version: 2.3.0(typedoc@0.25.13)
version: 2.3.0(typedoc@0.25.13(typescript@5.4.5))
typedoc-wikijs-theme:
specifier: ^1.0.5
version: 1.0.5(typedoc-plugin-markdown@4.0.3)(typedoc@0.25.13)
version: 1.0.5(typedoc-plugin-markdown@4.0.3(typedoc@0.25.13(typescript@5.4.5)))(typedoc@0.25.13(typescript@5.4.5))
typescript:
specifier: ^5.4.5
version: 5.4.5
@@ -999,8 +999,8 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
cross-spawn@7.0.3:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
cross-spawn@7.0.6:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'}
crypto-random-string@4.0.0:
@@ -2048,8 +2048,8 @@ packages:
merge@2.1.1:
resolution: {integrity: sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==}
micromatch@4.0.7:
resolution: {integrity: sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==}
micromatch@4.0.8:
resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}
engines: {node: '>=8.6'}
mime@4.0.3:
@@ -3285,7 +3285,7 @@ snapshots:
'@commitlint/types': 19.0.3
ajv: 8.16.0
'@commitlint/cz-commitlint@19.2.0(@types/node@20.14.2)(commitizen@4.3.0)(inquirer@9.2.23)(typescript@5.4.5)':
'@commitlint/cz-commitlint@19.2.0(@types/node@20.14.2)(commitizen@4.3.0(@types/node@20.14.2)(typescript@5.4.5))(inquirer@9.2.23)(typescript@5.4.5)':
dependencies:
'@commitlint/ensure': 19.0.3
'@commitlint/load': 19.2.0(@types/node@20.14.2)(typescript@5.4.5)
@@ -3335,7 +3335,7 @@ snapshots:
'@commitlint/types': 19.0.3
chalk: 5.3.0
cosmiconfig: 9.0.0(typescript@5.4.5)
cosmiconfig-typescript-loader: 5.0.0(@types/node@20.14.2)(cosmiconfig@9.0.0)(typescript@5.4.5)
cosmiconfig-typescript-loader: 5.0.0(@types/node@20.14.2)(cosmiconfig@9.0.0(typescript@5.4.5))(typescript@5.4.5)
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
lodash.uniq: 4.5.0
@@ -3434,7 +3434,7 @@ snapshots:
jest-util: 29.7.0
jest-validate: 29.7.0
jest-watcher: 29.7.0
micromatch: 4.0.7
micromatch: 4.0.8
pretty-format: 29.7.0
slash: 3.0.0
strip-ansi: 6.0.1
@@ -3545,7 +3545,7 @@ snapshots:
jest-haste-map: 29.7.0
jest-regex-util: 29.6.3
jest-util: 29.7.0
micromatch: 4.0.7
micromatch: 4.0.8
pirates: 4.0.6
slash: 3.0.0
write-file-atomic: 4.0.2
@@ -3666,7 +3666,7 @@ snapshots:
'@sec-ant/readable-stream@0.4.1': {}
'@semantic-release/changelog@6.0.3(semantic-release@24.0.0)':
'@semantic-release/changelog@6.0.3(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
'@semantic-release/error': 3.0.0
aggregate-error: 3.1.0
@@ -3674,7 +3674,7 @@ snapshots:
lodash: 4.17.21
semantic-release: 24.0.0(typescript@5.4.5)
'@semantic-release/commit-analyzer@13.0.0(semantic-release@24.0.0)':
'@semantic-release/commit-analyzer@13.0.0(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
conventional-changelog-angular: 8.0.0
conventional-changelog-writer: 8.0.0
@@ -3683,7 +3683,7 @@ snapshots:
debug: 4.3.5
import-from-esm: 1.3.4
lodash-es: 4.17.21
micromatch: 4.0.7
micromatch: 4.0.8
semantic-release: 24.0.0(typescript@5.4.5)
transitivePeerDependencies:
- supports-color
@@ -3692,7 +3692,7 @@ snapshots:
'@semantic-release/error@4.0.0': {}
'@semantic-release/git@10.0.1(semantic-release@24.0.0)':
'@semantic-release/git@10.0.1(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
'@semantic-release/error': 3.0.0
aggregate-error: 3.1.0
@@ -3700,13 +3700,13 @@ snapshots:
dir-glob: 3.0.1
execa: 5.1.1
lodash: 4.17.21
micromatch: 4.0.7
micromatch: 4.0.8
p-reduce: 2.1.0
semantic-release: 24.0.0(typescript@5.4.5)
transitivePeerDependencies:
- supports-color
'@semantic-release/github@10.0.6(semantic-release@24.0.0)':
'@semantic-release/github@10.0.6(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
'@octokit/core': 6.1.2
'@octokit/plugin-paginate-rest': 11.3.0(@octokit/core@6.1.2)
@@ -3728,7 +3728,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@semantic-release/npm@12.0.1(semantic-release@24.0.0)':
'@semantic-release/npm@12.0.1(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
'@semantic-release/error': 4.0.0
aggregate-error: 5.0.0
@@ -3745,7 +3745,7 @@ snapshots:
semver: 7.6.2
tempy: 3.1.0
'@semantic-release/release-notes-generator@14.0.0(semantic-release@24.0.0)':
'@semantic-release/release-notes-generator@14.0.0(semantic-release@24.0.0(typescript@5.4.5))':
dependencies:
conventional-changelog-angular: 8.0.0
conventional-changelog-writer: 8.0.0
@@ -4228,7 +4228,7 @@ snapshots:
core-util-is@1.0.3: {}
cosmiconfig-typescript-loader@5.0.0(@types/node@20.14.2)(cosmiconfig@9.0.0)(typescript@5.4.5):
cosmiconfig-typescript-loader@5.0.0(@types/node@20.14.2)(cosmiconfig@9.0.0(typescript@5.4.5))(typescript@5.4.5):
dependencies:
'@types/node': 20.14.2
cosmiconfig: 9.0.0(typescript@5.4.5)
@@ -4248,6 +4248,7 @@ snapshots:
import-fresh: 3.3.0
js-yaml: 4.1.0
parse-json: 5.2.0
optionalDependencies:
typescript: 5.4.5
create-jest@29.7.0(@types/node@20.14.2):
@@ -4265,7 +4266,7 @@ snapshots:
- supports-color
- ts-node
cross-spawn@7.0.3:
cross-spawn@7.0.6:
dependencies:
path-key: 3.1.1
shebang-command: 2.0.0
@@ -4463,7 +4464,7 @@ snapshots:
execa@5.1.1:
dependencies:
cross-spawn: 7.0.3
cross-spawn: 7.0.6
get-stream: 6.0.1
human-signals: 2.1.0
is-stream: 2.0.1
@@ -4475,7 +4476,7 @@ snapshots:
execa@8.0.1:
dependencies:
cross-spawn: 7.0.3
cross-spawn: 7.0.6
get-stream: 8.0.1
human-signals: 5.0.0
is-stream: 3.0.0
@@ -4488,7 +4489,7 @@ snapshots:
execa@9.2.0:
dependencies:
'@sindresorhus/merge-streams': 4.0.0
cross-spawn: 7.0.3
cross-spawn: 7.0.6
figures: 6.1.0
get-stream: 9.0.1
human-signals: 7.0.0
@@ -4528,7 +4529,7 @@ snapshots:
'@nodelib/fs.walk': 1.2.8
glob-parent: 5.1.2
merge2: 1.4.1
micromatch: 4.0.7
micromatch: 4.0.8
fast-json-stable-stringify@2.1.0: {}
@@ -4591,7 +4592,7 @@ snapshots:
dependencies:
detect-file: 1.0.0
is-glob: 4.0.3
micromatch: 4.0.7
micromatch: 4.0.8
resolve-dir: 1.0.1
for-each@0.3.3:
@@ -5153,7 +5154,6 @@ snapshots:
'@babel/core': 7.24.7
'@jest/test-sequencer': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.14.2
babel-jest: 29.7.0(@babel/core@7.24.7)
chalk: 4.1.2
ci-info: 3.9.0
@@ -5168,11 +5168,13 @@ snapshots:
jest-runner: 29.7.0
jest-util: 29.7.0
jest-validate: 29.7.0
micromatch: 4.0.7
micromatch: 4.0.8
parse-json: 5.2.0
pretty-format: 29.7.0
slash: 3.0.0
strip-json-comments: 3.1.1
optionalDependencies:
'@types/node': 20.14.2
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@@ -5218,7 +5220,7 @@ snapshots:
jest-regex-util: 29.6.3
jest-util: 29.7.0
jest-worker: 29.7.0
micromatch: 4.0.7
micromatch: 4.0.8
walker: 1.0.8
optionalDependencies:
fsevents: 2.3.3
@@ -5242,7 +5244,7 @@ snapshots:
'@types/stack-utils': 2.0.3
chalk: 4.1.2
graceful-fs: 4.2.11
micromatch: 4.0.7
micromatch: 4.0.8
pretty-format: 29.7.0
slash: 3.0.0
stack-utils: 2.0.6
@@ -5254,7 +5256,7 @@ snapshots:
jest-util: 29.7.0
jest-pnp-resolver@1.2.3(jest-resolve@29.7.0):
dependencies:
optionalDependencies:
jest-resolve: 29.7.0
jest-regex-util@29.6.3: {}
@@ -5546,7 +5548,7 @@ snapshots:
merge@2.1.1: {}
micromatch@4.0.7:
micromatch@4.0.8:
dependencies:
braces: 3.0.3
picomatch: 2.3.1
@@ -5939,11 +5941,11 @@ snapshots:
semantic-release@24.0.0(typescript@5.4.5):
dependencies:
'@semantic-release/commit-analyzer': 13.0.0(semantic-release@24.0.0)
'@semantic-release/commit-analyzer': 13.0.0(semantic-release@24.0.0(typescript@5.4.5))
'@semantic-release/error': 4.0.0
'@semantic-release/github': 10.0.6(semantic-release@24.0.0)
'@semantic-release/npm': 12.0.1(semantic-release@24.0.0)
'@semantic-release/release-notes-generator': 14.0.0(semantic-release@24.0.0)
'@semantic-release/github': 10.0.6(semantic-release@24.0.0(typescript@5.4.5))
'@semantic-release/npm': 12.0.1(semantic-release@24.0.0(typescript@5.4.5))
'@semantic-release/release-notes-generator': 14.0.0(semantic-release@24.0.0(typescript@5.4.5))
aggregate-error: 5.0.0
cosmiconfig: 9.0.0(typescript@5.4.5)
debug: 4.3.5
@@ -5959,7 +5961,7 @@ snapshots:
lodash-es: 4.17.21
marked: 12.0.2
marked-terminal: 7.0.0(marked@12.0.2)
micromatch: 4.0.7
micromatch: 4.0.8
p-each-series: 3.0.0
p-reduce: 3.0.0
read-package-up: 11.0.0
@@ -6223,9 +6225,8 @@ snapshots:
typedarray.prototype.slice: 1.0.3
which-typed-array: 1.1.15
ts-jest@29.1.4(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.4.5):
ts-jest@29.1.4(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.2))(typescript@5.4.5):
dependencies:
'@babel/core': 7.24.7
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest: 29.7.0(@types/node@20.14.2)
@@ -6236,6 +6237,11 @@ snapshots:
semver: 7.6.2
typescript: 5.4.5
yargs-parser: 21.1.1
optionalDependencies:
'@babel/core': 7.24.7
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
babel-jest: 29.7.0(@babel/core@7.24.7)
tslib@2.6.3: {}
@@ -6290,22 +6296,22 @@ snapshots:
typed-array-buffer: 1.0.2
typed-array-byte-offset: 1.0.2
typedoc-plugin-markdown@4.0.3(typedoc@0.25.13):
typedoc-plugin-markdown@4.0.3(typedoc@0.25.13(typescript@5.4.5)):
dependencies:
typedoc: 0.25.13(typescript@5.4.5)
typedoc-plugin-mdn-links@3.1.29(typedoc@0.25.13):
typedoc-plugin-mdn-links@3.1.29(typedoc@0.25.13(typescript@5.4.5)):
dependencies:
typedoc: 0.25.13(typescript@5.4.5)
typedoc-plugin-missing-exports@2.3.0(typedoc@0.25.13):
typedoc-plugin-missing-exports@2.3.0(typedoc@0.25.13(typescript@5.4.5)):
dependencies:
typedoc: 0.25.13(typescript@5.4.5)
typedoc-wikijs-theme@1.0.5(typedoc-plugin-markdown@4.0.3)(typedoc@0.25.13):
typedoc-wikijs-theme@1.0.5(typedoc-plugin-markdown@4.0.3(typedoc@0.25.13(typescript@5.4.5)))(typedoc@0.25.13(typescript@5.4.5)):
dependencies:
typedoc: 0.25.13(typescript@5.4.5)
typedoc-plugin-markdown: 4.0.3(typedoc@0.25.13)
typedoc-plugin-markdown: 4.0.3(typedoc@0.25.13(typescript@5.4.5))
typedoc@0.25.13(typescript@5.4.5):
dependencies:

View File

@@ -78,11 +78,11 @@ export const DialogControlsSection = MappedDialogDivs.get('DialogControlsSection
export const DialogControlsSectionHeader = MappedDialogDivs.get('DialogControlsSectionHeader') as FC<DialogCommonProps>;
export const DialogButtonPrimary = Object.values(CommonUIModule).find(
(mod: any) => mod?.render?.toString()?.includes('"DialogButton","_DialogLayout","Primary"'),
(mod: any) => mod?.render?.toString?.()?.includes('"DialogButton","_DialogLayout","Primary"'),
) as FC<DialogButtonProps>;
export const DialogButtonSecondary = Object.values(CommonUIModule).find(
(mod: any) => mod?.render?.toString()?.includes('"DialogButton","_DialogLayout","Secondary"')
(mod: any) => mod?.render?.toString?.()?.includes('"DialogButton","_DialogLayout","Secondary"')
) as FC<DialogButtonProps>;
// This is the "main" button. The Primary can act as a submit button,

View File

@@ -1,6 +1,6 @@
import { FC, ReactNode } from 'react';
import { findModule } from '../webpack';
import { findModuleExport } from '../webpack';
import { DialogCommonProps } from './Dialog';
import { FooterLegendProps } from './FooterLegend';
@@ -18,19 +18,16 @@ export interface DialogCheckboxProps extends DialogCommonProps, FooterLegendProp
onClick?(evt: Event): void;
}
export const DialogCheckbox = Object.values(
findModule((m: any) => {
if (typeof m !== 'object') return false;
for (const prop in m) {
if (m[prop]?.prototype?.GetPanelElementProps) return true;
}
return false;
}),
).find(
(m: any) =>
m.contextType &&
m.prototype?.render.toString().includes('fallback:') &&
m?.prototype?.SetChecked &&
m?.prototype?.Toggle &&
m?.prototype?.GetPanelElementProps,
// Do not access KeyDown, SetChecked, Toggle here as they are getters and accessing them outside of a render breaks them globally
export const DialogCheckbox = findModuleExport(e =>
e?.prototype &&
typeof e?.prototype == "object" &&
"GetPanelElementProps" in e?.prototype &&
"SetChecked" in e?.prototype &&
"Toggle" in e?.prototype &&
// beta || stable as of oct 2 2024
(e?.prototype?.render?.toString?.().includes('="DialogCheckbox"') || (
e.contextType &&
e.prototype?.render?.toString?.().includes('fallback:')
))
) as FC<DialogCheckboxProps>;

View File

@@ -3,6 +3,7 @@ import { ReactNode, FC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
import { createPropListRegex } from '../utils';
import type { ContextMenuPositionOptions } from './Menu';
export interface SingleDropdownOption {
data: any;
@@ -20,11 +21,6 @@ export interface MultiDropdownOption {
export type DropdownOption = SingleDropdownOption | MultiDropdownOption;
export interface DropdownMenuPositionOptions {
[_: string]: unknown
bMatchWidth?: boolean
}
export interface DropdownProps {
rgOptions: DropdownOption[];
selectedOption: any;
@@ -32,7 +28,7 @@ export interface DropdownProps {
onMenuWillOpen?(showMenu: () => void): void;
onMenuOpened?(): void;
onChange?(data: SingleDropdownOption): void;
contextMenuPositionOptions?: DropdownMenuPositionOptions;
contextMenuPositionOptions?: ContextMenuPositionOptions;
menuLabel?: string;
strDefaultLabel?: string;
renderButtonValue?(element: ReactNode): ReactNode;

View File

@@ -11,5 +11,5 @@ export interface FocusRingProps {
}
export const FocusRing = findModuleExport((e: Export) =>
e?.toString()?.includes('.GetShowDebugFocusRing())'),
e?.toString?.()?.includes('.GetShowDebugFocusRing())'),
) as FC<FocusRingProps>;

View File

@@ -31,11 +31,42 @@ export enum GamepadButton {
STEAM_GUIDE,
STEAM_QUICK_MENU,
}
export declare enum NavEntryPositionPreferences {
export enum NavEntryPositionPreferences {
/**
* Always give focus to the first child element.
*/
FIRST,
/**
* Always give focus to the last child element.
*/
LAST,
/**
* Give focus to the child element that would maintain the flow in the X axis.
*
* Imagine you have a calculator window with 9 standard buttons.
* You have 3 rows of buttons, with 3 buttons per row.
* If you select button with number 8 and navigate down, the buttons
* will be navigated in the following order 8->5->3.
* The flow is maintained for the X axis while you're navigating the Y axis.
*/
MAINTAIN_X,
/**
* Give focus to the child element that would maintain the flow in the Y axis.
*
* Imagine you have a calculator window with 9 standard buttons.
* You have 3 columns of buttons, with 3 buttons per column.
* If you select button with number 4 and navigate right, the buttons
* will be navigated in the following order 4->5->6.
* The flow is maintained for the Y axis while you're navigating the X axis.
*/
MAINTAIN_Y,
/**
* Give focus to the first child element with `preferredFocus == true` prop.
*/
PREFERRED_CHILD,
}
export interface GamepadEventDetail {
@@ -48,6 +79,25 @@ export declare type ActionDescriptionMap = {
};
export declare type GamepadEvent = CustomEvent<GamepadEventDetail>;
export interface FooterLegendProps {
/**
* Navigation entry strategy to be used when gaining focus during navigation.
*
* This is meant to be used on a parent container that has children. Once the
* container (e.g. Focusable) is navigated to and has children in it, the children
* is then navigated to (focused) using the provided strategy.
*
* If no strategy is provided, it seems that the `NavEntryPositionPreferences.FIRST`
* is used initialy, but for the next time the parent remembers previously focused
* child and focused back on it instead.
*/
navEntryPreferPosition?: NavEntryPositionPreferences;
/**
* Mark the element as the preferred child (to be focused) whenever the parent uses the
* `NavEntryPositionPreferences.PREFERRED_CHILD` navigation strategy.
*/
preferredFocus?: boolean;
actionDescriptionMap?: ActionDescriptionMap;
onOKActionDescription?: ReactNode;
onCancelActionDescription?: ReactNode;

View File

@@ -3,9 +3,128 @@ import { FC, ReactNode } from 'react';
import { Export, findModuleByExport, findModuleExport } from '../webpack';
import { FooterLegendProps } from './FooterLegend';
export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleExport(
(e: Export) => typeof e === 'function' && e.toString().includes('GetContextMenuManagerFromWindow(')
&& e.toString().includes('.CreateContextMenuInstance('),
interface PopupCreationOptions {
/**
* Initially hidden, make it appear with {@link ContextMenuInstance.Show}.
*/
bCreateHidden?: boolean;
bModal?: boolean;
/**
* Document title.
*/
title?: string;
}
// Separate interface, since one of webpack module exports uses this exact object,
// so maybe it could be reused elsewhere.
interface MonitorOptions {
targetMonitor: {
flMonitorScale: number;
nScreenLeft: number;
nScreenTop: number;
nScreenWidth: number;
nScreenHeight: number;
};
flGamepadScale: number;
}
export interface ContextMenuPositionOptions extends PopupCreationOptions, Partial<MonitorOptions> {
/**
* When {@link bForcePopup} is true, makes the window appear above everything else.
*/
bAlwaysOnTop?: boolean;
/**
* Disables the mouse overlay, granting the ability to click anywhere while
* the menu's active.
*/
bDisableMouseOverlay?: boolean;
/**
* Disables the {@link bPreferPopTop} behavior.
*/
bDisablePopTop?: boolean;
bFitToWindow?: boolean;
/**
* Forces the menu to open in a separate window instead of inside the parent.
*/
bForcePopup?: boolean;
/**
* Like {@link bMatchWidth}, but don't shrink below the menu's minimum width.
*/
bGrowToElementWidth?: boolean;
/**
* Match the parent's exact height.
*/
bMatchHeight?: boolean;
/**
* Match the parent's exact width.
*/
bMatchWidth?: boolean;
bNoFocusWhenShown?: boolean;
/**
* Makes the menu **invisible**, instead of getting removed from the DOM.
*/
bRetainOnHide?: boolean;
bScreenCoordinates?: boolean;
/**
* Set to `true` to not account for the parent's width.
*/
bOverlapHorizontal?: boolean;
/**
* Set to `true` to not account for the parent's height.
*/
bOverlapVertical?: boolean;
/**
* Set to `true` to make the entire menu try to appear on the left side from
* the parent.
*/
bPreferPopLeft?: boolean;
/**
* Set to `true` to make the entire menu try to appear above the parent.
*/
bPreferPopTop?: boolean;
bShiftToFitWindow?: boolean;
// different window creation flags (StandaloneContextMenu vs PopupContextMenu)
bStandalone?: boolean;
/**
* Class name **replacement** for the container element, i.e. it replaces the
* default class.
*/
strClassName?: string;
}
interface ContextMenuInstance {
Hide(): void;
Show(): void;
}
export const showContextMenu: (
children: ReactNode,
parent?: EventTarget,
options?: ContextMenuPositionOptions,
) => ContextMenuInstance = findModuleExport(
(e: Export) =>
typeof e === 'function' &&
e.toString().includes('GetContextMenuManagerFromWindow(') &&
e.toString().includes('.CreateContextMenuInstance('),
);
export interface MenuProps extends FooterLegendProps {
@@ -26,7 +145,7 @@ export interface MenuGroupProps {
}
const MenuGoupModule = findModuleByExport(e => e?.prototype?.Focus && e?.prototype?.OnOKButton && e?.prototype?.render?.toString().includes?.(`"emphasis"==this.props.tone`));
export const MenuGroup: FC<MenuGroupProps> = MenuGoupModule && Object.values(MenuGoupModule).find((e: Export) => typeof e == "function" && e?.toString()?.includes("bInGamepadUI:"));
export const MenuGroup: FC<MenuGroupProps> = MenuGoupModule && Object.values(MenuGoupModule).find((e: Export) => typeof e == "function" && e?.toString?.()?.includes("bInGamepadUI:"));
export interface MenuItemProps extends FooterLegendProps {
bInteractableItem?: boolean;
onClick?(evt: Event): void;
@@ -42,7 +161,11 @@ export interface MenuItemProps extends FooterLegendProps {
export const MenuItem: FC<MenuItemProps> = findModuleExport(
(e: Export) =>
e?.render?.toString()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter),
e?.render?.toString?.()?.includes('bPlayAudio:') || (e?.prototype?.OnOKButton && e?.prototype?.OnMouseEnter),
);
export const MenuSeparator: FC = findModuleExport(
(e: Export) => typeof e === 'function' && /className:.+?\.ContextMenuSeparator/.test(e.toString()),
);
/*

View File

@@ -1,7 +1,7 @@
import { FC, ReactNode } from 'react';
import { findSP } from '../utils';
import { Export, findModule, findModuleByExport, findModuleExport } from '../webpack';
import { Export, findModule, findModuleDetailsByExport, findModuleExport } from '../webpack';
// All of the popout options + strTitle are related. Proper usage is not yet known...
export interface ShowModalProps {
@@ -50,7 +50,7 @@ export const showModal = (
bHideMainWindowForPopouts: false,
},
): ShowModalResult => {
return showModalRaw(modal, parent || findSP(), props.strTitle, props, undefined, {
return showModalRaw(modal, parent || findSP() || window, props.strTitle, props, undefined, {
bHideActions: props.bHideActionIcons,
});
};
@@ -98,14 +98,14 @@ export const ModalRoot = Object.values(
return false;
}) || {},
)?.find((x: any) => x?.type?.toString()?.includes('((function(){')) as FC<ModalRootProps>;
)?.find((x: any) => x?.type?.toString?.()?.includes('((function(){')) as FC<ModalRootProps>;
interface SimpleModalProps {
active?: boolean;
children: ReactNode;
}
const ModalModule = findModuleByExport((e: Export) => e?.toString().includes('.ModalPosition,fallback:'), 5);
const [ModalModule, _ModalPosition] = findModuleDetailsByExport((e: Export) => e?.toString().includes('.ModalPosition'), 5)
const ModalModuleProps = ModalModule ? Object.values(ModalModule) : [];
@@ -114,6 +114,4 @@ export const SimpleModal = ModalModuleProps.find((prop) => {
return string?.includes('.ShowPortalModal()') && string?.includes('.OnElementReadyCallbacks.Register(');
}) as FC<SimpleModalProps>;
export const ModalPosition = ModalModuleProps.find((prop) =>
prop?.toString().includes('.ModalPosition,fallback:'),
) as FC<SimpleModalProps>;
export const ModalPosition = _ModalPosition as FC<SimpleModalProps>;

View File

@@ -22,5 +22,5 @@ export interface PanelSectionRowProps {
children?: ReactNode;
}
export const PanelSectionRow = Object.values(mod).filter(
(exp: any) => !exp?.toString()?.includes('.PanelSection'),
(exp: any) => !exp?.toString?.()?.includes('.PanelSection'),
)[0] as FC<PanelSectionRowProps>;

View File

@@ -24,11 +24,11 @@ export interface ProgressBarWithInfoProps extends ProgressBarItemProps {
}
export const ProgressBar = findModuleExport((e: Export) =>
e?.toString()?.includes('.ProgressBar,"standard"=='),
e?.toString?.()?.includes('.ProgressBar,"standard"=='),
) as FC<ProgressBarProps>;
export const ProgressBarWithInfo = findModuleExport((e: Export) =>
e?.toString()?.includes('.ProgressBarFieldStatus},'),
e?.toString?.()?.includes('.ProgressBarFieldStatus},'),
) as FC<ProgressBarWithInfoProps>;
const progressBarItemRegex = createPropListRegex(["indeterminate", "nTransitionSec", "nProgress"]);

View File

@@ -16,7 +16,7 @@ export interface SidebarNavigationPage {
}
export interface SidebarNavigationProps {
title?: string;
title?: ReactNode;
pages: (SidebarNavigationPage | 'separator')[];
showTitle?: boolean;
disableRouteReporting?: boolean;

View File

@@ -29,5 +29,6 @@ export interface SliderFieldProps extends ItemProps {
}
export const SliderField = Object.values(CommonUIModule).find((mod: any) =>
mod?.toString()?.includes('SliderField,fallback'),
// stable || beta as of oct 2 2024
mod?.toString?.()?.includes('SliderField,fallback') || mod?.toString?.()?.includes("SliderField\",")
) as FC<SliderFieldProps>;

View File

@@ -1,9 +1,6 @@
import { FC, ReactNode, createElement, useEffect, useState } from 'react';
import { fakeRenderComponent, findInReactTree, sleep } from '../utils';
import { Export, findModuleByExport } from '../webpack';
import { FC, ReactNode } from 'react';
import { findModuleByExport } from '../webpack';
import { FooterLegendProps } from './FooterLegend';
import { SteamSpinner } from './SteamSpinner';
/**
* Individual tab objects for the Tabs component
@@ -65,63 +62,9 @@ export interface TabsProps {
autoFocusContents?: boolean;
}
let tabsComponent: any;
const getTabs = async () => {
if (tabsComponent) return tabsComponent;
// @ts-ignore
while (!window?.DeckyPluginLoader?.routerHook?.routes) {
console.debug('[DFL:Tabs]: Waiting for Decky router...');
await sleep(500);
}
return (tabsComponent = fakeRenderComponent(
() => {
return findInReactTree(
findInReactTree(
// @ts-ignore
window.DeckyPluginLoader.routerHook.routes
.find((x: any) => x.props.path == '/library/app/:appid/achievements')
.props.children.type(),
(x) => x?.props?.scrollTabsTop,
).type({ appid: 1 }),
(x) => x?.props?.tabs,
).type;
},
{
useRef: () => ({ current: { reaction: { track: () => {} } } }),
useContext: () => ({ match: { params: { appid: 1 } } }),
useMemo: () => ({ data: {} }),
},
));
};
let oldTabs: any;
try {
const oldTabsModule = findModuleByExport((e: Export) => e.Unbleed);
if (oldTabsModule)
oldTabs = Object.values(oldTabsModule).find((x: any) => x?.type?.toString()?.includes('((function(){'));
} catch (e) {
console.error('Error finding oldTabs:', e);
}
const tabsModule = findModuleByExport(e => e?.toString?.()?.includes(".TabRowTabs") && e?.toString?.()?.includes("activeTab:"));
/**
* Tabs component as used in the library and media tabs. See {@link TabsProps}.
* Unlike other components in `decky-frontend-lib`, this requires Decky Loader to be running.
*/
export const Tabs = (oldTabs ||
((props: TabsProps) => {
const found = tabsComponent;
const [tc, setTC] = useState<FC<TabsProps>>(found);
useEffect(() => {
if (found) return;
(async () => {
console.debug('[DFL:Tabs]: Finding component...');
const t = await getTabs();
console.debug('[DFL:Tabs]: Found!');
setTC(t);
})();
}, []);
console.log('tc', tc);
return tc ? createElement(tc, props) : <SteamSpinner />;
})) as FC<TabsProps>;
export const Tabs = tabsModule && Object.values(tabsModule).find((e: any) => e?.type?.toString?.()?.includes("((function()")) as FC<TabsProps>;

View File

@@ -10,5 +10,5 @@ export interface ToggleProps {
}
export const Toggle = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('.ToggleOff)'),
mod?.render?.toString?.()?.includes('.ToggleOff)'),
) as FC<ToggleProps>;

View File

@@ -11,5 +11,6 @@ export interface ToggleFieldProps extends ItemProps {
}
export const ToggleField = Object.values(CommonUIModule).find((mod: any) =>
mod?.render?.toString()?.includes('ToggleField,fallback'),
// stable || beta as of oct 2 2024
mod?.render?.toString?.()?.includes('ToggleField,fallback') || mod?.render?.toString?.()?.includes("ToggleField\",")
) as FC<ToggleFieldProps>;

View File

@@ -1,3 +1,4 @@
import { WindowRouter } from '../modules/Router';
import { AppDetails, LogoPosition, SteamAppOverview } from './SteamClient';
declare global {
interface Window {
@@ -46,5 +47,11 @@ declare global {
GetCustomLogoPosition: (app: SteamAppOverview) => LogoPosition | null;
SaveCustomLogoPosition: (app: SteamAppOverview, logoPositions: LogoPosition) => any;
};
SteamUIStore: {
GetFocusedWindowInstance: () => WindowRouter;
};
securitystore: {
IsLockScreenActive: () => boolean;
};
}
}

View File

@@ -1,4 +1,4 @@
import { sleep } from '../utils';
import Logger from '../logger';
import { Export, findModuleExport } from '../webpack';
export enum SideMenu {
@@ -88,14 +88,23 @@ export interface WindowStore {
export interface Router {
WindowStore?: WindowStore;
/** @deprecated use {@link Navigation} instead */
CloseSideMenus(): void;
/** @deprecated use {@link Navigation} instead */
Navigate(path: string): void;
/** @deprecated use {@link Navigation} instead */
NavigateToAppProperties(): void;
/** @deprecated use {@link Navigation} instead */
NavigateToExternalWeb(url: string): void;
/** @deprecated use {@link Navigation} instead */
NavigateToInvites(): void;
/** @deprecated use {@link Navigation} instead */
NavigateToChat(): void;
/** @deprecated use {@link Navigation} instead */
NavigateToLibraryTab(): void;
/** @deprecated use {@link Navigation} instead */
NavigateToLayoutPreview(e: unknown): void;
/** @deprecated use {@link Navigation} instead */
OpenPowerMenu(unknown?: any): void;
get RunningApps(): AppOverview[];
get MainRunningApp(): AppOverview | undefined;
@@ -117,58 +126,58 @@ export interface Navigation {
OpenQuickAccessMenu(quickAccessTab?: QuickAccessTab): void;
OpenMainMenu(): void;
OpenPowerMenu(unknown?: any): void;
/** if calling this to perform navigation, call it after Navigate to prevent a race condition in desktop Big Picture mode that hides the overlay unintentionally */
CloseSideMenus(): void;
}
export let Navigation = {} as Navigation;
const logger = new Logger("Navigation");
try {
(async () => {
let InternalNavigators: any = {};
if (!Router.NavigateToAppProperties || (Router as unknown as any).deckyShim) {
function initInternalNavigators() {
try {
InternalNavigators = findModuleExport((e: Export) => e.GetNavigator && e.SetNavigator)?.GetNavigator();
} catch (e) {
console.error('[DFL:Router]: Failed to init internal navigators, trying again');
}
function createNavigationFunction(fncName: string, handler?: (win: any) => any) {
return (...args: any) => {
let win: WindowRouter | undefined;
try {
win = window.SteamUIStore.GetFocusedWindowInstance();
} catch (e) {
logger.warn("Navigation interface failed to call GetFocusedWindowInstance", e);
}
initInternalNavigators();
while (!InternalNavigators?.AppProperties) {
console.log('[DFL:Router]: Trying to init internal navigators again');
await sleep(2000);
initInternalNavigators();
if (!win) {
logger.warn("Navigation interface could not find any focused window. Falling back to Main Window Instance");
win = Router.WindowStore?.GamepadUIMainWindowInstance || Router?.WindowStore?.SteamUIWindows?.[0];
}
if (win) {
try {
const thisObj = handler && handler(win);
(thisObj || win)[fncName](...args);
} catch (e) {
logger.error("Navigation handler failed", e);
}
} else {
logger.error("Navigation interface could not find a window to navigate");
}
}
const newNavigation = {
Navigate: Router.Navigate?.bind(Router),
NavigateBack: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateBack?.bind(
Router.WindowStore.GamepadUIMainWindowInstance,
),
NavigateToAppProperties: InternalNavigators?.AppProperties || Router.NavigateToAppProperties?.bind(Router),
NavigateToExternalWeb: InternalNavigators?.ExternalWeb || Router.NavigateToExternalWeb?.bind(Router),
NavigateToInvites: InternalNavigators?.Invites || Router.NavigateToInvites?.bind(Router),
NavigateToChat: InternalNavigators?.Chat || Router.NavigateToChat?.bind(Router),
NavigateToLibraryTab: InternalNavigators?.LibraryTab || Router.NavigateToLibraryTab?.bind(Router),
NavigateToLayoutPreview: Router.NavigateToLayoutPreview?.bind(Router),
NavigateToSteamWeb: Router.WindowStore?.GamepadUIMainWindowInstance?.NavigateToSteamWeb?.bind(
Router.WindowStore.GamepadUIMainWindowInstance,
),
OpenSideMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenSideMenu?.bind(
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
),
OpenQuickAccessMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenQuickAccessMenu?.bind(
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
),
OpenMainMenu: Router.WindowStore?.GamepadUIMainWindowInstance?.MenuStore.OpenMainMenu?.bind(
Router.WindowStore.GamepadUIMainWindowInstance.MenuStore,
),
CloseSideMenus: Router.CloseSideMenus?.bind(Router),
OpenPowerMenu: Router.OpenPowerMenu?.bind(Router),
} as Navigation;
}
const newNavigation = {
Navigate: createNavigationFunction("Navigate"),
NavigateBack: createNavigationFunction("NavigateBack"),
NavigateToAppProperties: createNavigationFunction("AppProperties", win => win.Navigator),
NavigateToExternalWeb: createNavigationFunction("ExternalWeb", win => win.Navigator),
NavigateToInvites: createNavigationFunction("Invites", win => win.Navigator),
NavigateToChat: createNavigationFunction("Chat", win => win.Navigator),
NavigateToLibraryTab: createNavigationFunction("LibraryTab", win => win.Navigator),
NavigateToLayoutPreview: Router.NavigateToLayoutPreview?.bind(Router),
NavigateToSteamWeb: createNavigationFunction("NavigateToSteamWeb"),
OpenSideMenu: createNavigationFunction("OpenSideMenu", win => win.MenuStore),
OpenQuickAccessMenu: createNavigationFunction("OpenQuickAccessMenu", win => win.MenuStore),
OpenMainMenu: createNavigationFunction("OpenMainMenu", win => win.MenuStore),
CloseSideMenus: createNavigationFunction("CloseSideMenus", win => win.MenuStore),
OpenPowerMenu: Router.OpenPowerMenu?.bind(Router),
} as Navigation;
Object.assign(Navigation, newNavigation);
})();
Object.assign(Navigation, newNavigation);
} catch (e) {
console.error('[DFL:Router]: Error initializing Navigation interface', e);
logger.error('Error initializing Navigation interface', e);
}

View File

@@ -25,7 +25,7 @@ export function findSP(): Window {
if (document.title == 'SP') return window;
// new (SP as popup)
const navTrees = getGamepadNavigationTrees();
return navTrees?.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView;
return navTrees?.find((x: any) => x.m_ID == 'GamepadUI_Full_Root' || x.m_ID == 'root_1_')?.Root?.Element?.ownerDocument?.defaultView;
}
/**
@@ -40,6 +40,6 @@ export function getFocusNavController(): any {
*/
export function getGamepadNavigationTrees(): any {
const focusNav = getFocusNavController();
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
const context = focusNav?.m_ActiveContext || focusNav?.m_LastActiveContext;
return context?.m_rgGamepadNavigationTrees;
}

View File

@@ -52,6 +52,7 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
// we have to redirect this to return an object with component's prototype as a constructor returning a value overrides its prototype
window.SP_REACT.createElement = () => {
loggingEnabled && logger.debug("createElement hook called");
loggingEnabled && console.trace("createElement trace");
return Object.create(component.prototype);
};
}
@@ -66,12 +67,16 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
}
}
let renderHookStep = 0;
// Accessed two times, once directly before class instantiation, and again in some extra logic we don't need to worry about that we hanlde below just in case.
Object.defineProperty(component, "contextType", {
configurable: true,
get: function () {
loggingEnabled && logger.debug("get contexttype", this, stubsApplied);
applyStubsIfNeeded();
loggingEnabled && logger.debug("get contexttype", this, stubsApplied, renderHookStep);
loggingEnabled && console.trace("contextType trace");
if (renderHookStep == 0) renderHookStep = 1;
else if (renderHookStep == 3) renderHookStep = 4;
return this._contextType;
},
set: function (value) {
@@ -79,16 +84,20 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
}
});
// Undoes the second contextType access we can't detect shortly before render before it's able to cause any damage
Object.defineProperty(component, "getDerivedStateFromProps", {
// Always accessed directly after contextType for the path we want to catch.
Object.defineProperty(component, "contextTypes", {
configurable: true,
get: function () {
loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied);
removeStubsIfNeeded();
return this._getDerivedStateFromProps;
loggingEnabled && logger.debug("get contexttypes", this, stubsApplied, renderHookStep);
loggingEnabled && console.trace("contextTypes trace");
if (renderHookStep == 1) {
renderHookStep = 2;
applyStubsIfNeeded();
};
return this._contextTypes;
},
set: function (value) {
this._getDerivedStateFromProps = value;
this._contextTypes = value;
}
});
@@ -99,11 +108,32 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
return this._updater;
},
set: function (value) {
loggingEnabled && logger.debug("set updater", this, value, stubsApplied);
removeStubsIfNeeded();
loggingEnabled && logger.debug("set updater", this, value, stubsApplied, renderHookStep);
loggingEnabled && console.trace("updater trace");
if (renderHookStep == 2) {
renderHookStep = 0;
removeStubsIfNeeded();
}
return this._updater = value;
}
});
// Prevents the second contextType+contextTypes access from leaving its hooks around
Object.defineProperty(component, "getDerivedStateFromProps", {
configurable: true,
get: function () {
loggingEnabled && logger.debug("get getDerivedStateFromProps", this, stubsApplied, renderHookStep);
loggingEnabled && console.trace("getDerivedStateFromProps trace");
if (renderHookStep == 2) {
renderHookStep = 0;
removeStubsIfNeeded();
}
return this._getDerivedStateFromProps;
},
set: function (value) {
this._getDerivedStateFromProps = value;
}
});
return userComponent;
}

View File

@@ -1,4 +1,5 @@
import * as React from 'react';
import { Ref, useState } from 'react';
// this shouldn't need to be redeclared but it does for some reason
@@ -104,19 +105,15 @@ export function wrapReactClass(node: any, prop: any = 'type') {
export function getReactRoot(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] ||
// @ts-expect-error 7053
o['_reactRootContainer']?._internalRoot?.current
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] ||
(o as any)['_reactRootContainer']?._internalRoot?.current
);
}
export function getReactInstance(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] ||
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] ||
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
);
}
@@ -154,3 +151,21 @@ export const findInReactTree = (node: any, filter: findInTreeFilter) =>
// Specialised findInTree for React nodes
walkable: ['props', 'children', 'child', 'sibling'],
});
/**
* Finds the parent window of a DOM element
*/
export function getParentWindow<WindowType = Window>(elem: HTMLElement | null): WindowType | null | undefined {
return elem?.ownerDocument?.defaultView as any;
}
/**
* React hook to find the host window of a component
* Pass the returned ref into a React element and window will be its host window.
* @returns [ref, window]
*/
export function useWindowRef<RefElementType extends HTMLElement, WindowType = Window>(): [Ref<RefElementType>, WindowType | null | undefined] {
const [win, setWin] = useState<WindowType | null | undefined>(null);
return [(elem) => setWin(getParentWindow<WindowType>(elem)), win];
}