mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-20 10:00:08 +02:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f126fe471 | ||
|
|
e644de35d7 | ||
|
|
9b79f70ac7 | ||
|
|
d237bd48e4 | ||
|
|
f7d73b4dc3 | ||
|
|
9edb1e6b97 | ||
|
|
605e4f5eae |
@@ -1,7 +1,15 @@
|
||||
{
|
||||
"branches": ["main", "dev"],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "angular",
|
||||
"releaseRules": [
|
||||
{"type": "chore", "scope": "classes", "release": "patch"}
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,3 +1,19 @@
|
||||
## [1.7.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.7.0...v1.7.1) (2022-08-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **utils:** better method to wrap react classes ([e644de3](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/e644de35d70680d17d70e89cc9b929a5aae08b48))
|
||||
|
||||
# [1.7.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.6.2...v1.7.0) (2022-08-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **utils:** add wrapReactClass ([d237bd4](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/d237bd48e4b9e6436d7daefdf70327875e9e940d))
|
||||
|
||||
## [1.6.2](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.6.1...v1.6.2) (2022-08-15)
|
||||
|
||||
## [1.6.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v1.6.0...v1.6.1) (2022-08-13)
|
||||
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "1.6.1",
|
||||
"version": "1.7.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "1.6.1",
|
||||
"version": "1.7.1",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.6"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "decky-frontend-lib",
|
||||
"version": "1.6.1",
|
||||
"version": "1.7.1",
|
||||
"description": "A library for building decky plugins",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -63,6 +63,14 @@ type StaticClasses = Record<
|
||||
string
|
||||
>;
|
||||
|
||||
type ScrollClasses = Record<
|
||||
| 'ScrollBoth'
|
||||
| 'ScrollPanel'
|
||||
| 'ScrollX'
|
||||
| 'ScrollY',
|
||||
string
|
||||
>;
|
||||
|
||||
type GamepadDialogClasses = Record<
|
||||
| 'duration-app-launch'
|
||||
| 'GamepadDialogContent'
|
||||
@@ -167,6 +175,16 @@ export const staticClasses: StaticClasses = findModule((mod) => {
|
||||
return false;
|
||||
});
|
||||
|
||||
export const scrollClasses: ScrollClasses = findModule((mod) => {
|
||||
if (typeof mod !== 'object') return false;
|
||||
|
||||
if (mod.ScrollPanel && mod.ScrollY) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
export const gamepadDialogClasses: GamepadDialogClasses = findModule((mod) => {
|
||||
if (typeof mod !== 'object') return false;
|
||||
|
||||
|
||||
17
src/utils.ts
17
src/utils.ts
@@ -82,8 +82,21 @@ export function unpatch(obj: any, name: any): void {
|
||||
obj[name] = obj[name].__deckyOrig;
|
||||
}
|
||||
|
||||
export function wrapReactType(node: any) {
|
||||
return node.type = {...node.type}
|
||||
export function wrapReactType(node: any, prop?: any) {
|
||||
return node[prop || "type"] = {...node[prop || "type"]};
|
||||
}
|
||||
|
||||
export function wrapReactClass(node: any, prop?: any) {
|
||||
const cls = node[prop || "type"];
|
||||
const wrappedCls = class extends cls {};
|
||||
Object.getOwnPropertyNames(cls.prototype).forEach((prop: any) => {
|
||||
wrappedCls.prototype[prop] = cls.prototype[prop]
|
||||
});
|
||||
Object.getOwnPropertyNames(cls).forEach((prop: any) => {
|
||||
if (prop != "prototype") wrappedCls[prop] = cls[prop]
|
||||
});
|
||||
wrappedCls.prototype.__proto__ = cls.prototype.__proto__;
|
||||
return node[prop || "type"] = wrappedCls;
|
||||
}
|
||||
|
||||
export function getReactInstance(o: HTMLElement | Element | Node) {
|
||||
|
||||
Reference in New Issue
Block a user