mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-24 03:48:48 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0da85355c2 | ||
|
|
dcdbb2d6c7 | ||
|
|
58e3d35e1e | ||
|
|
bd1dc85b92 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# [4.2.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.1.1...v4.2.0) (2024-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **components:** add ErrorBoundary ([dcdbb2d](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/dcdbb2d6c7c0b72197f04153d7c3e73e9e71ea5c))
|
||||||
|
|
||||||
|
## [4.1.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.1.0...v4.1.1) (2024-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ReorderableList:** avoid mutating props ([#109](https://github.com/SteamDeckHomebrew/decky-frontend-lib/issues/109)) ([bd1dc85](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/bd1dc85b9202c8ec6ca994177417574fdd71cbd7))
|
||||||
|
|
||||||
# [4.1.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.0.1...v4.1.0) (2024-06-27)
|
# [4.1.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v4.0.1...v4.1.0) (2024-06-27)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@decky/ui",
|
"name": "@decky/ui",
|
||||||
"version": "4.1.0",
|
"version": "4.2.0",
|
||||||
"description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
|
"description": "A library for interacting with the Steam frontend in Decky plugins and elsewhere.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
@@ -85,5 +85,9 @@
|
|||||||
"style": "module",
|
"style": "module",
|
||||||
"parser": "typescript"
|
"parser": "typescript"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://registry.npmjs.org/",
|
||||||
|
"tag": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/components/ErrorBoundary.ts
Normal file
6
src/components/ErrorBoundary.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { Component, PropsWithChildren } from "react";
|
||||||
|
import { findModuleExport } from "../webpack";
|
||||||
|
|
||||||
|
export const ErrorBoundary = findModuleExport(
|
||||||
|
(e) => e.InstallErrorReportingStore && e?.prototype?.Reset && e?.prototype?.componentDidCatch,
|
||||||
|
) as Component<PropsWithChildren>;
|
||||||
@@ -5,6 +5,7 @@ export * from './ControlsList';
|
|||||||
export * from './Dialog';
|
export * from './Dialog';
|
||||||
export * from './DialogCheckbox';
|
export * from './DialogCheckbox';
|
||||||
export * from './Dropdown';
|
export * from './Dropdown';
|
||||||
|
export * from './ErrorBoundary';
|
||||||
export * from './Field';
|
export * from './Field';
|
||||||
export * from './Focusable';
|
export * from './Focusable';
|
||||||
export * from './FocusRing';
|
export * from './FocusRing';
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ export type ReorderableListProps<T> = {
|
|||||||
export function ReorderableList<T>(props: ReorderableListProps<T>) {
|
export function ReorderableList<T>(props: ReorderableListProps<T>) {
|
||||||
if (props.animate === undefined) props.animate = true;
|
if (props.animate === undefined) props.animate = true;
|
||||||
const [entryList, setEntryList] = useState<ReorderableEntry<T>[]>(
|
const [entryList, setEntryList] = useState<ReorderableEntry<T>[]>(
|
||||||
props.entries.sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position),
|
[...props.entries].sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position),
|
||||||
);
|
);
|
||||||
const [reorderEnabled, setReorderEnabled] = useState<boolean>(false);
|
const [reorderEnabled, setReorderEnabled] = useState<boolean>(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setEntryList(props.entries.sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position));
|
setEntryList([...props.entries].sort((a: ReorderableEntry<T>, b: ReorderableEntry<T>) => a.position - b.position));
|
||||||
}, [props.entries]);
|
}, [props.entries]);
|
||||||
|
|
||||||
function toggleReorderEnabled(): void {
|
function toggleReorderEnabled(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user