mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-17 08:40:08 +02:00
fix(components): update for latest beta
This commit is contained in:
@@ -1,4 +1 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx --no -- commitlint --edit "${1}"
|
||||
|
||||
@@ -52,8 +52,17 @@ export interface DialogButtonProps extends DialogCommonProps, FooterLegendProps
|
||||
}
|
||||
|
||||
const CommonDialogDivs = Object.values(CommonUIModule).filter(
|
||||
(m: any) => typeof m === 'object' && m?.render?.toString().includes('createElement("div",{...') ||
|
||||
m?.render?.toString().includes('createElement("div",Object.assign({},'),
|
||||
(m: any) => typeof m === 'object' &&
|
||||
// New
|
||||
(
|
||||
m?.render?.toString().includes('jsx)("div",{...') ||
|
||||
m?.render?.toString().includes('jsx)("div",Object.assign({},')
|
||||
) ||
|
||||
// Old
|
||||
(
|
||||
m?.render?.toString().includes('createElement("div",{...') ||
|
||||
m?.render?.toString().includes('createElement("div",Object.assign({},')
|
||||
)
|
||||
);
|
||||
const MappedDialogDivs = new Map(
|
||||
Object.values(CommonDialogDivs).map((m: any) => {
|
||||
|
||||
@@ -28,7 +28,8 @@ export const ProgressBar = findModuleExport((e: Export) =>
|
||||
) as FC<ProgressBarProps>;
|
||||
|
||||
export const ProgressBarWithInfo = findModuleExport((e: Export) =>
|
||||
e?.toString?.()?.includes('.ProgressBarFieldStatus},'),
|
||||
// new || old
|
||||
e?.toString?.()?.includes('.ProgressBarFieldStatus,children') || e?.toString?.()?.includes('.ProgressBarFieldStatus},'),
|
||||
) as FC<ProgressBarWithInfoProps>;
|
||||
|
||||
const progressBarItemRegex = createPropListRegex(["indeterminate", "nTransitionSec", "nProgress"]);
|
||||
|
||||
@@ -11,5 +11,6 @@ export const ScrollPanel = ScrollingModuleProps.find((prop: any) =>
|
||||
) as FC<{ children?: ReactNode }>;
|
||||
|
||||
export const ScrollPanelGroup: FC<{ children?: ReactNode }> = findModuleExport((e: Export) =>
|
||||
e?.render?.toString().includes('.FocusVisibleChild()),[])'),
|
||||
// new || old
|
||||
e?.render?.toString().includes('.FocusVisibleChild(),[])') || e?.render?.toString().includes('.FocusVisibleChild()),[])'),
|
||||
);
|
||||
|
||||
@@ -3,6 +3,6 @@ import { FC, SVGAttributes } from 'react';
|
||||
import { IconsModule } from '../webpack';
|
||||
|
||||
// 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()),
|
||||
export const Spinner = IconsModule && Object.values(IconsModule)?.find(
|
||||
(mod: any) => mod?.toString && /Spinner\),children:\[\(0,\w+\.jsx\)\("path",\{d:"M18 /.test(mod.toString()) || /Spinner\)}\)?,.\.createElement\(\"path\",{d:\"M18 /.test(mod.toString()),
|
||||
) as FC<SVGAttributes<SVGElement>>;
|
||||
|
||||
@@ -42,6 +42,9 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
|
||||
};
|
||||
component.prototype.isReactComponent = true;
|
||||
let stubsApplied = false;
|
||||
const patchJsx = window.SP_REACTDOM.version.startsWith("19.");
|
||||
let oldJsx = window.SP_JSX?.jsx;
|
||||
let oldJsxs = window.SP_JSX?.jsxs;
|
||||
let oldCreateElement = window.SP_REACT.createElement;
|
||||
|
||||
const applyStubsIfNeeded = () => {
|
||||
@@ -55,6 +58,18 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
|
||||
loggingEnabled && console.trace("createElement trace");
|
||||
return Object.create(component.prototype);
|
||||
};
|
||||
if (patchJsx) {
|
||||
window.SP_JSX.jsx = () => {
|
||||
loggingEnabled && logger.debug("jsx hook called");
|
||||
loggingEnabled && console.trace("jsx trace");
|
||||
return Object.create(component.prototype);
|
||||
}
|
||||
window.SP_JSX.jsxs = () => {
|
||||
loggingEnabled && logger.debug("jsxs hook called");
|
||||
loggingEnabled && console.trace("jsxs trace");
|
||||
return Object.create(component.prototype);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +79,10 @@ export function injectFCTrampoline(component: FC, customHooks?: any): FCTrampoli
|
||||
stubsApplied = false;
|
||||
removeHookStubs();
|
||||
window.SP_REACT.createElement = oldCreateElement;
|
||||
if (patchJsx) {
|
||||
window.SP_JSX.jsx = oldJsx;
|
||||
window.SP_JSX.jsxs = oldJsxs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ export const CommonUIModule = findModule((m: Module) => {
|
||||
});
|
||||
|
||||
export const IconsModule = findModuleByExport(
|
||||
(e) => e?.toString && /Spinner\)}\)?,.\.createElement\(\"path\",{d:\"M18 /.test(e.toString()),
|
||||
(e) => e?.toString && /Spinner\),children:\[\(0,\w+\.jsx\)\("path",\{d:"M18 /.test(e.toString()) || /Spinner\)}\)?,.\.createElement\(\"path\",{d:\"M18 /.test(e.toString()),
|
||||
);
|
||||
|
||||
export const ReactRouter = findModuleByExport((e) => e.computeRootMatch);
|
||||
|
||||
Reference in New Issue
Block a user